1 |
ksteube |
1312 |
|
2 |
|
|
/* $Id$ */ |
3 |
|
|
|
4 |
|
|
/******************************************************* |
5 |
|
|
* |
6 |
|
|
* Copyright 2003-2007 by ACceSS MNRF |
7 |
|
|
* Copyright 2007 by University of Queensland |
8 |
|
|
* |
9 |
|
|
* http://esscc.uq.edu.au |
10 |
|
|
* Primary Business: Queensland, Australia |
11 |
|
|
* Licensed under the Open Software License version 3.0 |
12 |
|
|
* http://www.opensource.org/licenses/osl-3.0.php |
13 |
|
|
* |
14 |
|
|
*******************************************************/ |
15 |
|
|
|
16 |
jgs |
102 |
#if !defined escript_EsysAssertException_20040330_H |
17 |
jgs |
82 |
#define escript_EsysAssertException_20040330_H |
18 |
woo409 |
757 |
#include "system_dep.h" |
19 |
jgs |
82 |
|
20 |
jgs |
468 |
#include "EsysException.h" |
21 |
jgs |
82 |
|
22 |
|
|
namespace esysUtils { |
23 |
|
|
|
24 |
phornby |
1455 |
/** |
25 |
|
|
\brief |
26 |
|
|
EsysAssertException exception class. |
27 |
jgs |
82 |
|
28 |
phornby |
1455 |
Description: |
29 |
|
|
EsysAssertException exception class. |
30 |
|
|
The class provides a public function returning the exception name. |
31 |
|
|
*/ |
32 |
|
|
class EsysAssertException : public EsysException |
33 |
|
|
{ |
34 |
jgs |
82 |
|
35 |
phornby |
1455 |
protected: |
36 |
jgs |
102 |
|
37 |
phornby |
1455 |
typedef EsysException Parent; |
38 |
jgs |
102 |
|
39 |
phornby |
1455 |
public: |
40 |
|
|
/** |
41 |
|
|
\brief |
42 |
|
|
Default constructor for the exception. |
43 |
|
|
*/ |
44 |
phornby |
1533 |
ESYSUTILS_DLL_API |
45 |
trankine |
1509 |
inline |
46 |
phornby |
1455 |
EsysAssertException() : Parent() { updateMessage();} |
47 |
|
|
/** |
48 |
|
|
\brief |
49 |
|
|
Constructor for the exception. |
50 |
|
|
*/ |
51 |
phornby |
1533 |
ESYSUTILS_DLL_API |
52 |
trankine |
1509 |
inline |
53 |
phornby |
1455 |
EsysAssertException(const char *cstr) : Parent(cstr) { updateMessage();} |
54 |
|
|
/** |
55 |
|
|
\brief |
56 |
|
|
Constructor for the exception. |
57 |
|
|
*/ |
58 |
phornby |
1533 |
ESYSUTILS_DLL_API |
59 |
trankine |
1509 |
inline |
60 |
phornby |
1455 |
EsysAssertException(const std::string &str) : |
61 |
|
|
Parent(str) { updateMessage();} |
62 |
|
|
/** |
63 |
|
|
\brief |
64 |
|
|
Copy Constructor for the exception. |
65 |
|
|
*/ |
66 |
phornby |
1533 |
ESYSUTILS_DLL_API |
67 |
trankine |
1509 |
inline |
68 |
phornby |
1455 |
EsysAssertException(const EsysAssertException &other) : Parent(other) |
69 |
|
|
{ |
70 |
|
|
updateMessage(); |
71 |
|
|
} |
72 |
jgs |
102 |
|
73 |
phornby |
1533 |
ESYSUTILS_DLL_API |
74 |
|
|
inline virtual |
75 |
|
|
EsysAssertException & |
76 |
|
|
operator=(const EsysAssertException &other) THROW_ANY |
77 |
phornby |
1530 |
{ |
78 |
|
|
Parent::operator=(other); |
79 |
|
|
updateMessage(); |
80 |
|
|
return *this; |
81 |
|
|
} |
82 |
jgs |
102 |
|
83 |
phornby |
1530 |
|
84 |
phornby |
1455 |
/// Destructor |
85 |
trankine |
1509 |
ESYSUTILS_DLL_API |
86 |
trankine |
1462 |
virtual ~EsysAssertException() THROW_ANY {} |
87 |
phornby |
1020 |
|
88 |
phornby |
1455 |
/** |
89 |
|
|
\brief |
90 |
|
|
Returns the name of the exception. |
91 |
|
|
*/ |
92 |
trankine |
1509 |
ESYSUTILS_DLL_API |
93 |
phornby |
1455 |
virtual const std::string & exceptionName() const; |
94 |
jgs |
102 |
|
95 |
phornby |
1455 |
/** |
96 |
|
|
\brief |
97 |
|
|
Builds a formatted message and throws an EsysAssertException. |
98 |
|
|
*/ |
99 |
trankine |
1509 |
ESYSUTILS_DLL_API |
100 |
phornby |
1455 |
static void assertFailure (const std::string& assertion, |
101 |
|
|
const std::string& date, |
102 |
|
|
const std::string& file, |
103 |
|
|
int line, const std::string& errDesc); |
104 |
|
|
private: |
105 |
jgs |
82 |
|
106 |
phornby |
1455 |
// |
107 |
|
|
// the exception name is immutable and class-wide. |
108 |
|
|
// Inheritor note; you need one of these too. |
109 |
|
|
// and an overloaded exceptionName() in your .cpp implementation file. |
110 |
|
|
static const std::string exceptionNameValue; |
111 |
|
|
}; |
112 |
jgs |
82 |
|
113 |
|
|
} // end of namespace |
114 |
jgs |
468 |
|
115 |
jgs |
82 |
#endif |