/[escript]/trunk/esysUtils/src/EsysAssertException.h
ViewVC logotype

Contents of /trunk/esysUtils/src/EsysAssertException.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2019 - (show annotations)
Mon Nov 10 13:49:00 2008 UTC (10 years, 8 months ago) by phornby
File MIME type: text/plain
File size: 2722 byte(s)
Yet another concerted effort to handle missing macro arguments
in a portable way.


1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2008 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14
15 #if !defined escript_EsysAssertException_20040330_H
16 #define escript_EsysAssertException_20040330_H
17 #include "system_dep.h"
18
19 #include "EsysException.h"
20
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 protected:
36
37 typedef EsysException Parent;
38
39 public:
40 /**
41 \brief
42 Default constructor for the exception.
43 */
44 ESYSUTILS_DLL_API
45 inline
46 EsysAssertException() : Parent() { updateMessage();}
47 /**
48 \brief
49 Constructor for the exception.
50 */
51 ESYSUTILS_DLL_API
52 inline
53 EsysAssertException(const char *cstr) : Parent(cstr) { updateMessage();}
54 /**
55 \brief
56 Constructor for the exception.
57 */
58 ESYSUTILS_DLL_API
59 inline
60 EsysAssertException(const std::string &str) :
61 Parent(str) { updateMessage();}
62 /**
63 \brief
64 Copy Constructor for the exception.
65 */
66 ESYSUTILS_DLL_API
67 inline
68 EsysAssertException(const EsysAssertException &other) : Parent(other)
69 {
70 updateMessage();
71 }
72
73 ESYSUTILS_DLL_API
74 inline
75 EsysAssertException &
76 operator=(const EsysAssertException &other) THROW(NO_ARG)
77 {
78 Parent::operator=(other);
79 updateMessage();
80 return *this;
81 }
82
83
84 /// Destructor
85 ESYSUTILS_DLL_API
86 virtual ~EsysAssertException() THROW(NO_ARG) {}
87
88 /**
89 \brief
90 Returns the name of the exception.
91 */
92 ESYSUTILS_DLL_API
93 virtual const std::string & exceptionName() const;
94
95 /**
96 \brief
97 Builds a formatted message and throws an EsysAssertException.
98 */
99 ESYSUTILS_DLL_API
100 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
106 //
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
113 } // end of namespace
114
115 #endif

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26