1 |
|
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 |
#if !defined escript_EsysAssertException_20040330_H |
17 |
#define escript_EsysAssertException_20040330_H |
18 |
#include "system_dep.h" |
19 |
|
20 |
#include "EsysException.h" |
21 |
|
22 |
namespace esysUtils { |
23 |
|
24 |
/** |
25 |
\brief |
26 |
EsysAssertException exception class. |
27 |
|
28 |
Description: |
29 |
EsysAssertException exception class. |
30 |
The class provides a public function returning the exception name. |
31 |
*/ |
32 |
class EsysAssertException : public EsysException |
33 |
{ |
34 |
|
35 |
public: |
36 |
|
37 |
/** |
38 |
\brief |
39 |
Default constructor for the exception. |
40 |
*/ |
41 |
EsysAssertException() : EsysException() {} |
42 |
|
43 |
/** |
44 |
\brief |
45 |
Constructor for the exception. |
46 |
*/ |
47 |
EsysAssertException(const char *cstr) : EsysException(cstr) {} |
48 |
|
49 |
/** |
50 |
\brief |
51 |
Constructor for the exception. |
52 |
*/ |
53 |
EsysAssertException(const std::string &str) : EsysException(str) {} |
54 |
|
55 |
/// Destructor |
56 |
virtual ~EsysAssertException() {} |
57 |
|
58 |
/** |
59 |
\brief |
60 |
Returns the name of the exception. |
61 |
*/ |
62 |
virtual const std::string & exceptionName() const; |
63 |
|
64 |
/** |
65 |
\brief |
66 |
Builds a formatted message and throws an EsysAssertException. |
67 |
*/ |
68 |
static void assertFailure (const std::string& assertion, |
69 |
const std::string& date, |
70 |
const std::string& file, |
71 |
int line, const std::string& errDesc); |
72 |
private: |
73 |
|
74 |
// |
75 |
// the exception name is immutable and class-wide. |
76 |
// Inheritor note; you need one of these too. |
77 |
// and an overloaded exceptionName() in your .cpp implementation file. |
78 |
static const std::string exceptionNameValue; |
79 |
}; |
80 |
|
81 |
} // end of namespace |
82 |
|
83 |
#endif |