SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
Exceptions::Exception Class Reference

Global exception object for all non-standard exceptions thrown by the code. More...

#include <Exception.hh>

Inheritance diagram for Exceptions::Exception:

Public Member Functions

 Exception () throw ()
 Default constructor, initilizes everything to 0. More...
 
 Exception (exceptionLevel level, std::string errorMessage, std::string location) throw ()
 Normal constructor with error level, error message and location. More...
 
 ~Exception () throw ()
 Destructor. More...
 
const char * what () const throw ()
 Return char buffer of message+" at "+location, memory remains owned by Exception. More...
 
void Print ()
 Print the error message and location. More...
 
exceptionLevel GetErrorLevel () const
 Get the severity of the exception. More...
 
std::string GetMessage () const
 Get the error message (as defined by constructor) More...
 
void SetMessage (std::string new_message)
 Set the error message. More...
 
std::string GetLocation () const
 Get the location (as defined by Exception constructor) of the error. More...
 
std::string GetStackTrace () const
 Return the stack trace if it was stored. More...
 

Static Public Member Functions

static std::string MakeStackTrace (size_t skipTrace)
 Gcc-specific code to recover the stack trace as a string. More...
 
static void SetWillDoStackTrace (bool willDoStackTrace)
 Set that it makes a stack trace on exception. More...
 
static bool GetWillDoStackTrace ()
 Return whether makes a stack trace on exception. More...
 

Private Member Functions

void SetWhat (std::string what_str)
 Sets the reason for the exception. More...
 

Private Attributes

std::string _message
 Message to be thrown. More...
 
std::string _location
 Name of the function that threw. More...
 
std::string _stacktrace
 Stack trace as an std::string. More...
 
std::vector< char > _what
 Reason for throwing. More...
 
exceptionLevel _level
 Severity of the exception. More...
 

Static Private Attributes

static const size_t _maxStackSize = 100
 Maximum memory size of the stack. More...
 
static bool _willDoStackTrace = true
 Returns the stack trace if true. More...
 

Detailed Description

Global exception object for all non-standard exceptions thrown by the code.

Exception has a severity (exceptionLevel), an error message and a location. Also a function to return the stack trace (gcc only).

If not using gcc, define NO_STACKTRACE at compile time

Note that the throw() directives are there to explicitly declare that exceptions cannot be thrown in the constructors and destructors

Constructor & Destructor Documentation

Exceptions::Exception::Exception ( )
throw (
)

Default constructor, initilizes everything to 0.

Exceptions::Exception::Exception ( exceptionLevel  level,
std::string  errorMessage,
std::string  location 
)
throw (
)

Normal constructor with error level, error message and location.

Parameters
levelSeverity of the exeption
errorMessageError message to throw
locationLocation of the exception in the code
Exceptions::Exception::~Exception ( )
throw (
)
inline

Destructor.

Member Function Documentation

exceptionLevel Exceptions::Exception::GetErrorLevel ( ) const
inline

Get the severity of the exception.

std::string Exceptions::Exception::GetLocation ( ) const
inline

Get the location (as defined by Exception constructor) of the error.

std::string Exceptions::Exception::GetMessage ( ) const
inline

Get the error message (as defined by constructor)

std::string Exceptions::Exception::GetStackTrace ( ) const
inline

Return the stack trace if it was stored.

bool Exceptions::Exception::GetWillDoStackTrace ( )
static

Return whether makes a stack trace on exception.

std::string Exceptions::Exception::MakeStackTrace ( size_t  skipTrace)
static

Gcc-specific code to recover the stack trace as a string.

Will skip traces below skipTrace (so, for example, if we want to know where the Exception was thrown we might set skipTrace to 2, to skip MakeStackTrace and Exception constructor).

void Exceptions::Exception::Print ( )

Print the error message and location.

Prints to error message to Pitch::mout(Pitch::error) and Location to Pitch::mout(Pitch::debug)

void Exceptions::Exception::SetMessage ( std::string  new_message)
inline

Set the error message.

void Exceptions::Exception::SetWhat ( std::string  what_str)
inlineprivate

Sets the reason for the exception.

void Exceptions::Exception::SetWillDoStackTrace ( bool  willDoStackTrace)
static

Set that it makes a stack trace on exception.

const char* Exceptions::Exception::what ( ) const
throw (
)
inline

Return char buffer of message+" at "+location, memory remains owned by Exception.

Field Documentation

exceptionLevel Exceptions::Exception::_level
private

Severity of the exception.

std::string Exceptions::Exception::_location
private

Name of the function that threw.

const size_t Exceptions::Exception::_maxStackSize = 100
staticprivate

Maximum memory size of the stack.

std::string Exceptions::Exception::_message
private

Message to be thrown.

std::string Exceptions::Exception::_stacktrace
private

Stack trace as an std::string.

std::vector<char> Exceptions::Exception::_what
private

Reason for throwing.

bool Exceptions::Exception::_willDoStackTrace = true
staticprivate

Returns the stack trace if true.


The documentation for this class was generated from the following files: