YANE-Framework 1.1.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes

yane::Utils::Exception Class Reference

Base class for handling exceptions in the YANE framework. More...

Inherited by yane::MinProg::MinProgException, yane::Model::UndefinedException, yane::ModelQt2::InvalidLibraryException, yane::ModelQt2::InvalidModelException, yane::MPC::MPCException, yane::OdeSolve::OdeSolEx, yane::Utils::IndexException, yane::Utils::IOException, yane::Utils::MemoryException, yane::Utils::NotInitializedException, yane::Utils::ThreadException, and yane::Utils::ValueException.

List of all members.

Public Member Functions

const char * debugmessage () const throw ( )
 Function to return debug information.
 Exception (std::string mess="unknown exception", std::string debugmessage="no debuginfo", Exception *innerex=0) throw ( )
 Constructor.
bool isType (const std::string &type) const throw ( )
 Function to check if the invocation line of this instance is of the given type.
bool stackTraceContainsType (const std::string &type) const throw ( )
 Function to check if a certain type of exception is contained in the invocation line of this instance.
virtual const char * what () const throw ( )
 Function to display the error message.
virtual ~Exception () throw ( )
 Destructor.

Static Public Member Functions

static std::string concatDebugMessage (const char *functionname, int line, std::string message)
 Function to generate a debug error message using the name of the function in which the error occured, the corresponding line number and the error message.
static std::string concatMessage (const std::string &type, const std::string &message)
 Function to generate a formated error message from a string and an error message.
static void enableDebugMessage (bool enable=false)
 Function to globally set the output of debug information using the what() message.

Static Public Attributes

static const std::string TYPE = std::string("yane::Utils::Exception")
 Type string of the exception.

Protected Member Functions

void addType (std::string type)
 Function to add a type string.

Protected Attributes

std::string _debugmess
 Debug information, deprecated and to be remove in next release.
std::string _message
 Error message, deprecated and to be removed in next release.
int _number
 Length of the invocation line.
std::vector< std::string > _stacktypes
 Type strings of the exception stack.
std::vector< std::string > _types
 Type strings of all elements of the invocation line.

Static Protected Attributes

static bool _printdebug = false
 Decision variable whether debug information are to be displayed.

Detailed Description

Class to easen the processing of error and debug messages


Constructor & Destructor Documentation

LIB_EXPORT yane::Utils::Exception::Exception ( std::string  mess = "unknown exception",
std::string  debugmessage = "no debuginfo",
Exception innerex = 0 
) throw ( )

Generates an exception with a what() message and debug information. An exception which has caused this exception can bee added to it.

Parameters:
messMessage to be printed out using the what() function
debugmessageDebug information
innerexPointer of the exception which has caused this exception

Member Function Documentation

LIB_EXPORT void yane::Utils::Exception::addType ( std::string  type) [protected]

Function to add a type string

Parameters:
typeType string
LIB_EXPORT std::string yane::Utils::Exception::concatDebugMessage ( const char *  functionname,
int  line,
std::string  message 
) [static]

Function to generate a debug error message using the name of the function in which the error occured, the corresponding line number and the error message

Parameters:
functionnameName of the function in which the error occured
lineLine number in which the error occured
messageError message
Returns:
Formated output of the debug error message
LIB_EXPORT std::string yane::Utils::Exception::concatMessage ( const std::string &  type,
const std::string &  message 
) [static]

Function to generate a formated error message from a string and an error message

Parameters:
typeType string
messageError message
Returns:
Formated error message
LIB_EXPORT const char * yane::Utils::Exception::debugmessage ( ) const throw ( )

Function to return debug information

Returns:
Debug information
LIB_EXPORT void yane::Utils::Exception::enableDebugMessage ( bool  enable = false) [static]

Function to globally set the output of debug information using the what() message

Parameters:
enabletrue if debug information is to be displayed
LIB_EXPORT bool yane::Utils::Exception::isType ( const std::string &  type) const throw ( )

Function to check if the invocation line of this instance is of the given type

Parameters:
typeType string
Returns:
true if the type is contained within the invocation line of this instance
LIB_EXPORT bool yane::Utils::Exception::stackTraceContainsType ( const std::string &  type) const throw ( )

Function to check if a certain type of exception is contained in the invocation line of this instance

Parameters:
typeType string
Returns:
true if the type is contained within the invocation line of this instance
LIB_EXPORT const char * yane::Utils::Exception::what ( ) const throw ( ) [virtual]

Function to display the error message

Returns:
Error message