torc::generic::Error Class Reference

The Error object thrown by different methods of EdifOM. More...

#include <Error.hpp>

List of all members.

Public Types

typedef std::map< std::string,
boost::any > 
Context

Public Member Functions

 Error (MessageId inId, const Context &inContext, const std::string &inFunction, const std::string &inFile, uint32_t inLine)
 Error (MessageId inId, const std::string &inFunction, const std::string &inFile, uint32_t inLine)
 Error (const Error &source) throw ()
Erroroperator= (const Error &source) throw ()
const std::vector
< StackFrameInfo > & 
getStackTrace () const throw ()
void setCurrentLocation (const std::string &inFunction, const std::string &inFile, uint32_t inLine) throw ()
const Context getContextData () const throw ()
void saveContextData (const std::string &inName, const boost::any &inSource) throw ()
const MessageId getErrorMessageId () const throw ()

Private Attributes

std::vector< StackFrameInfomStackTrace
Context mContextData
MessageId mErrorMessageId

Classes

struct  StackFrameInfo


Detailed Description

The Error object thrown by different methods of EdifOM.

The Error class is used to convey exception information to the user. The error object is constructed by the throwing method and propagated upwards by the calling functions.

Note:
This class does not inherit from std::exception by design. Clients should keep that in mind while using this class.

Definition at line 40 of file Error.hpp.


Member Typedef Documentation

typedef std::map< std::string, boost::any > torc::generic::Error::Context

Context sensitive data for the error object. The Context map stores a boost::any inSource corresponding to a name. As the Error bubbles up, this data may be augmented by catching contexts.

Definition at line 46 of file Error.hpp.


Constructor & Destructor Documentation

torc::generic::Error::Error ( MessageId  inId,
const Context inContext,
const std::string &  inFunction,
const std::string &  inFile,
uint32_t  inLine 
)

Constructor.

Parameters:
[in] inId Error message identifier that can be used to look up the message in MessageTable.
[in] inContext Context data that will be saved inside this error object.
[in] inFunction Function name from where this exception is being thrown. This will typically be set to __FUNCTION__.
[in] inFile File name from where this exception is being thrown. This will typically be set to __FILE__.
[in] inLine Line No. in the file from where this exception is being thrown. This will typically be set to __LINE__.

Definition at line 56 of file Error.cpp.

torc::generic::Error::Error ( MessageId  inId,
const std::string &  inFunction,
const std::string &  inFile,
uint32_t  inLine 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 70 of file Error.cpp.


Member Function Documentation

const std::vector< Error::StackFrameInfo > & torc::generic::Error::getStackTrace (  )  const throw () [inline]

Get the complete stack trace.

Returns:
vector containing the StackFrameInfo objects.

Definition at line 182 of file Error.hpp.

void torc::generic::Error::setCurrentLocation ( const std::string &  inFunction,
const std::string &  inFile,
uint32_t  inLine 
) throw ()

Set the current location. This method should be used by catching contexts to push location data into the error object.

Parameters:
[in] inFunction Function name from where this exception is being thrown. This will typically be set to __FUNCTION__.
[in] inFile File name from where this exception is being thrown. This will typically be set to __FILE__.
[in] inLine Line No. in the file from where this exception is being thrown. This will typically be set to __LINE__.

Definition at line 100 of file Error.cpp.

const Error::Context torc::generic::Error::getContextData (  )  const throw () [inline]

Get the map of context data for this exception. This can be looked up by interested parties for context sensitive information. Note that the value_type for this map is boost::any and therefore an appropriate boost::any_cast is required to get the actual data.

Returns:
const reference to a Context object.

Definition at line 192 of file Error.hpp.

void torc::generic::Error::saveContextData ( const std::string &  inName,
const boost::any &  inSource 
) throw ()

Save a context sensitive data with a meaningful name, that can be retreived by interested catching contexts.

Parameters:
[in] inName Name of the data.
[in] inSource Any type of data. The only restrictions are that the type of data should be copy constructible and assignable.

Definition at line 107 of file Error.cpp.

const MessageId torc::generic::Error::getErrorMessageId (  )  const throw () [inline]

Get the error message Id for this error.

Returns:
MessageId corresponding to this error

Definition at line 202 of file Error.hpp.


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

Generated on Thu Oct 13 16:50:42 2011 for TORC by  doxygen 1.5.6