SquareRootException Class Reference

This class allows to manage exceptions due to a negative value inside a square root. More...

#include <SquareRootException.h>

Inherits ArithmeticException.

Inheritance diagram for SquareRootException:

Inheritance graph
[legend]
Collaboration diagram for SquareRootException:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SquareRootException () throw ()
 Default constructor.
 SquareRootException (std::string sElementName, double dValue) throw ()
 This constructor requires 2 parameters :
  • the name of the element which is not compliant with the use of the root square function
  • the bad value which is not compliant with the use of the root square function.

 SquareRootException (std::string sElementName, double dValue, std::string sOrigin, std::string sFilename, unsigned int iLineNumber) throw ()
 This constructor requires 5 parameters :
  • the name of the element which is not compliant with the use of the root square function
  • the bad value which is not compliant with the use of the root square function
  • the method which throw the exception
  • the name of the file where the exception was thrown
  • the line number in the file where the exception was thrown.

virtual ~SquareRootException () throw ()
 Destructor.
virtual std::string makeDescription ()
 The message provides by the square root exception.
virtual std::string makeReason ()
 The reason message provides by the square root exception.
virtual std::string makeOrigin (std::string sOrigin)
 The origin message provides by the square root exception.

Private Attributes

std::string _sElementName
double _dValue

Detailed Description

This class allows to manage exceptions due to a negative value inside a square root.

Definition at line 16 of file SquareRootException.h.


Constructor & Destructor Documentation

SquareRootException::SquareRootException  )  throw ()
 

Default constructor.

Definition at line 15 of file SquareRootException.cpp.

00016 {
00017 
00018 }

SquareRootException::SquareRootException std::string  sElementName,
double  dValue
throw ()
 

This constructor requires 2 parameters :

  • the name of the element which is not compliant with the use of the root square function
  • the bad value which is not compliant with the use of the root square function.

Definition at line 29 of file SquareRootException.cpp.

00029                                                                                       : _sElementName(sElementName),_dValue(dValue)
00030 {               
00031                 setType("SquareRootException");
00032                 setLineNumber(0);
00033                 setFileName("");
00034                 
00035                 setDescription(makeDescription());
00036                 setReason(makeReason());
00037                 setOrigin("");
00038 
00039 }

SquareRootException::SquareRootException std::string  sElementName,
double  dValue,
std::string  sOrigin,
std::string  sFilename,
unsigned int  iLineNumber
throw ()
 

This constructor requires 5 parameters :

  • the name of the element which is not compliant with the use of the root square function
  • the bad value which is not compliant with the use of the root square function
  • the method which throw the exception
  • the name of the file where the exception was thrown
  • the line number in the file where the exception was thrown.

Definition at line 48 of file SquareRootException.cpp.

00048                                                                                                                                                     : _sElementName(sElementName),_dValue(dValue)
00049 {               
00050                 setType("SquareRootException");
00051                 setLineNumber(iLineNumber);
00052                 setFileName(sFilename);
00053                 
00054                 setDescription(makeDescription());
00055                 setReason(makeReason());
00056                 setOrigin(makeOrigin(sOrigin));
00057 }

SquareRootException::~SquareRootException  )  throw () [virtual]
 

Destructor.

Definition at line 21 of file SquareRootException.cpp.

00022 {
00023 
00024 }


Member Function Documentation

std::string SquareRootException::makeDescription  )  [virtual]
 

The message provides by the square root exception.

Implements ArithmeticException.

Definition at line 61 of file SquareRootException.cpp.

References _dValue, _sElementName, and dtos().

00062 { 
00063         std::string     sExceptionMessage       =       "The value ";
00064                         sExceptionMessage       +=      dtos(_dValue);
00065                         sExceptionMessage       +=  " of the ";
00066                         sExceptionMessage       +=  _sElementName;
00067                         sExceptionMessage       +=      " variable must be positive";
00068         return sExceptionMessage;
00069 }

Here is the call graph for this function:

std::string SquareRootException::makeOrigin std::string  sOrigin  )  [virtual]
 

The origin message provides by the square root exception.

Implements ArithmeticException.

Definition at line 81 of file SquareRootException.cpp.

References Exception::getFileName(), Exception::getLineNumber(), and ltos().

00082 {
00083         std::string     sOriginMessage = getFileName();
00084                         sOriginMessage+= " (l:";
00085                         sOriginMessage+= ltos(getLineNumber());
00086                         sOriginMessage+= ") ";
00087                         sOriginMessage+= sOrigin;
00088                         
00089         return sOriginMessage;
00090 }

Here is the call graph for this function:

std::string SquareRootException::makeReason  )  [virtual]
 

The reason message provides by the square root exception.

Implements ArithmeticException.

Definition at line 72 of file SquareRootException.cpp.

References Exception::getType().

00073 {
00074         std::string     sReasonMessage = "DATA_OUT_OF_RANGE --> ";
00075                         sReasonMessage+= getType();
00076                         
00077         return sReasonMessage;
00078 }

Here is the call graph for this function:


Member Data Documentation

double SquareRootException::_dValue [private]
 

Definition at line 38 of file SquareRootException.h.

Referenced by makeDescription().

std::string SquareRootException::_sElementName [private]
 

Definition at line 36 of file SquareRootException.h.

Referenced by makeDescription().


The documentation for this class was generated from the following files:
Generated on Fri Jul 10 10:32:37 2009 for Utils Library by  doxygen 1.4.5