00001
#if !defined (__EXCEPTION_HPP)
00002
#define __EXCEPTION_HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
#if !defined IN_COMMON_HPP
00025
#error except.hpp is included by common.hpp only.
00026
#endif
00027
00028
#include <string>
00029
00030
00031
00032
00033
00034
namespace corelinux
00035 {
00036
00037
00038 DECLARE_CLASS( Exception );
00039
00040
00041
00042 DECLARE_TYPE( Dword, LineNum );
00043
00044
00051 class Exception
00052 {
00053
00054
public:
00055
00056
00058
00059 enum Severity
00060 {
00061 CONTINUABLE = 1,
00062
THREADFATAL,
00063
PROCESSFATAL,
00064
THREADTERMINATE,
00065
PROCESSTERMINATE
00066 };
00067
00068
00078
Exception
00079 (
00080 CharCptr why,
00081 CharCptr file,
00082 LineNum line,
00083 Severity severity = Exception::CONTINUABLE,
00084
bool outOfMemory =
false
00085 );
00086
00092
Exception(
ExceptionCref crOther );
00093
00095
00096
virtual ~Exception(
void);
00097
00098
00099
00100
00101
00108
ExceptionRef operator = (
ExceptionCref otherRef );
00109
00116
bool operator==(
ExceptionCref otherRef );
00117
00118
00119
00120
00121
00128
const std::string &
getFile(
void ) const;
00129
00136 LineNumCref getLine(
void ) const;
00137
00143 const std::string & getWhy(
void ) const;
00144
00150 const Severity & getSeverity(
void ) const;
00151
00157 const std::string & getUnwind(
void ) const;
00158
00164 bool isOutOfMemory(
void )
const
00165
{
return theOutOfMemoryFlag;}
00166
00167
00168
00169
00170
00177
void addUnwindInfo( CharCptr unwindInfo );
00178
00180
00181
void setThreadFatalSeverity(
void );
00182
00184
00185
void setProcessFatalSeverity(
void );
00186
00193
void setThreadTerminateSeverity(
void );
00194
00200
void setProcessTerminateSeverity(
void );
00201
00202
protected:
00203
00209
Exception(
void );
00210
00215
Exception
00216 (
00217 CharCptr file,
00218 LineNum line,
00219 Severity severity = Exception::CONTINUABLE,
00220
bool outOfMemory =
false
00221 );
00222
00224
00225
void setWhy(
const std::string & );
00226
00228
00229
void setWhy( CharCptr );
00230
00231
private:
00232
00233
00234
private:
00235
00236
00237
00238 std::string theReason;
00239
00240
00241
00242 std::string theFile;
00243
00244
00245
00246 Severity theSeverity;
00247
00248
00249
00250
00251 std::string theUnwindInfo;
00252
00253
00254
00255 LineNum theLine;
00256
00257
00258
00259
bool theOutOfMemoryFlag;
00260 };
00261
00262 }
00263
00264
00265
#endif // !defined __EXCEPTION_HPP
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275