00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef HAVE_CONFIG_H
00017 #include "torc/generic/config.h"
00018 #endif
00019
00020
00021 #include "torc/generic/util/Error.hpp"
00022
00023 namespace torc {
00024
00025 namespace generic {
00026
00027 Error::StackFrameInfo::StackFrameInfo(
00028 const std::string &inFunction,
00029 const std::string &inFile, uint32_t inLine)
00030 :mFunction( inFunction ),
00031 mFile( inFile ),
00032 mLine( inLine ) {
00033 }
00034
00035 Error::StackFrameInfo::~StackFrameInfo() throw() {
00036 }
00037
00038 Error::StackFrameInfo::StackFrameInfo(
00039 const Error::StackFrameInfo & source)
00040 :mFunction( source.mFunction ),
00041 mFile( source.mFile ),
00042 mLine( source.mLine ) {
00043 }
00044
00045 Error::StackFrameInfo &
00046 Error::StackFrameInfo::operator=(
00047 const Error::StackFrameInfo & source) throw() {
00048 if( this != &source ) {
00049 mFunction = source.mFunction;
00050 mFile = source.mFile;
00051 mLine = source.mLine;
00052 }
00053 return *this;
00054 }
00055
00056 Error::Error(MessageId inId,
00057 const Context &inContext,
00058 const std::string &inFunction,
00059 const std::string &inFile, uint32_t inLine)
00060 :mStackTrace(),
00061 mContextData( inContext ),
00062 mErrorMessageId( inId ) {
00063 StackFrameInfo info( inFunction, inFile, inLine );
00064 mStackTrace.push_back( info );
00065 }
00066
00067
00068
00069
00070 Error::Error(MessageId inId,
00071 const std::string &inFunction,
00072 const std::string &inFile, uint32_t inLine)
00073 :mStackTrace(),
00074 mContextData(),
00075 mErrorMessageId( inId ) {
00076 StackFrameInfo info( inFunction, inFile, inLine );
00077 mStackTrace.push_back( info );
00078 }
00079
00080 Error::~Error() throw() {
00081 }
00082
00083 Error::Error(const Error & source) throw()
00084 :mStackTrace( source.mStackTrace ),
00085 mContextData( source.mContextData ),
00086 mErrorMessageId( source.mErrorMessageId ) {
00087 }
00088
00089 Error &
00090 Error::operator=(const Error & source) throw() {
00091 if( this != &source ) {
00092 mStackTrace = source.mStackTrace;
00093 mContextData = source.mContextData;
00094 mErrorMessageId = source.mErrorMessageId;
00095 }
00096 return *this;
00097 }
00098
00099 void
00100 Error::setCurrentLocation( const std::string &inFunction,
00101 const std::string &inFile, uint32_t inLine) throw() {
00102 StackFrameInfo info( inFunction, inFile, inLine );
00103 mStackTrace.push_back( info );
00104 }
00105
00106 void
00107 Error::saveContextData(const std::string &inName,
00108 const boost::any &inSource) throw() {
00109 mContextData[ inName ] = inSource;
00110 }
00111
00112
00113 }
00114
00115 }