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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2019 - (hide annotations)
Mon Nov 10 13:49:00 2008 UTC (11 years, 10 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 ksteube 1312
2     /*******************************************************
3 ksteube 1811 *
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 ksteube 1312
14 ksteube 1811
15 jgs 102 #if !defined escript_EsysAssertException_20040330_H
16 jgs 82 #define escript_EsysAssertException_20040330_H
17 woo409 757 #include "system_dep.h"
18 jgs 82
19 jgs 468 #include "EsysException.h"
20 jgs 82
21 gross 1562
22 jgs 82 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 1628 ESYSUTILS_DLL_API
45     inline
46 phornby 1455 EsysAssertException() : Parent() { updateMessage();}
47     /**
48     \brief
49     Constructor for the exception.
50     */
51 phornby 1628 ESYSUTILS_DLL_API
52     inline
53 phornby 1455 EsysAssertException(const char *cstr) : Parent(cstr) { updateMessage();}
54     /**
55     \brief
56     Constructor for the exception.
57     */
58 phornby 1628 ESYSUTILS_DLL_API
59     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 1628 ESYSUTILS_DLL_API
67     inline
68 phornby 1455 EsysAssertException(const EsysAssertException &other) : Parent(other)
69     {
70     updateMessage();
71     }
72 jgs 102
73 phornby 1628 ESYSUTILS_DLL_API
74 phornby 1649 inline
75 phornby 1628 EsysAssertException &
76 phornby 2019 operator=(const EsysAssertException &other) THROW(NO_ARG)
77 phornby 1628 {
78     Parent::operator=(other);
79     updateMessage();
80     return *this;
81     }
82 jgs 102
83 phornby 1628
84 phornby 1455 /// Destructor
85 phornby 1628 ESYSUTILS_DLL_API
86 phornby 2019 virtual ~EsysAssertException() THROW(NO_ARG) {}
87 phornby 1020
88 phornby 1455 /**
89     \brief
90     Returns the name of the exception.
91     */
92 phornby 1628 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 phornby 1628 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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26