OpenDaVINCI  4.16.0
odcore::exceptions::Exceptions Class Referenceabstract

#include <Exceptions.h>

Inheritance diagram for odcore::exceptions::Exceptions:
Inheritance graph

Public Member Functions

 Exceptions (const string &exceptionMessage, const string &fileName, const uint32_t &lineNumber)
 
 Exceptions (const Exceptions &obj)
 
virtual ~Exceptions () throw ()
 
Exceptionsoperator= (const Exceptions &obj)
 
const char * what () const throw ()
 
const string toString () const
 
virtual const string getExceptionName () const =0
 
const string getMessage () const
 
const string getFileName () const
 
uint32_t getLineNumber () const
 

Detailed Description

This is the base class for all exceptions. New exceptions are defined as follows:

OPENDAVINCI_CORE_DECLARE_EXCEPTION(IAMTHEREASONException);

Constructor & Destructor Documentation

odcore::exceptions::Exceptions::Exceptions ( const string &  exceptionMessage,
const string &  fileName,
const uint32_t &  lineNumber 
)

Constructor for the exception class.

The OPENDAVINCI_CORE_THROW_EXCEPTION macro uses this signature for adding file name and line number. Every exception derived from this class has to use the same signature:

class MyException : public exceptions::Exceptions {
public:
MyException(const string &exceptionMessage, const string &fileName, const uint32_t &lineNumber) :
Exceptions(exceptionMessage, fileName, lineNumber) {};
};
Parameters
exceptionMessageMessage for this exception.
fileNameFile name of the file where this exception occured.
lineNumberLine number.
odcore::exceptions::Exceptions::Exceptions ( const Exceptions obj)

Copy constructor.

Parameters
objAnother exception.
odcore::exceptions::Exceptions::~Exceptions ( )
throw (
)
virtual

Member Function Documentation

virtual const string odcore::exceptions::Exceptions::getExceptionName ( ) const
pure virtual

This method returns the name of the Exception.

Returns
name of the exception.

Referenced by toString().

const string odcore::exceptions::Exceptions::getFileName ( ) const

This method returns the file name.

Returns
file name.

Referenced by operator=(), and toString().

uint32_t odcore::exceptions::Exceptions::getLineNumber ( ) const

This method returns the line number.

Returns
line number.

Referenced by operator=(), and toString().

const string odcore::exceptions::Exceptions::getMessage ( ) const

This method returns this exception's message.

Returns
This exception's message.

Referenced by operator=(), and toString().

Exceptions & odcore::exceptions::Exceptions::operator= ( const Exceptions obj)

Assignment operator.

Parameters
objAnother exception.
Returns
Reference to this instance.

References getFileName(), getLineNumber(), getMessage(), and OPENDAVINCI_CORE_FREE_POINTER.

const string odcore::exceptions::Exceptions::toString ( ) const

This method returns a string representation.

Returns
String representation.

References getExceptionName(), getFileName(), getLineNumber(), and getMessage().

Referenced by odcontext::base::RuntimeControl::run(), and what().

const char * odcore::exceptions::Exceptions::what ( ) const
throw (
)

This method re-implements the same interface as the standard C++ exception for overriding the that method.

Returns
The exception's message.

References toString().