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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1649 - (show annotations)
Tue Jul 15 08:41:02 2008 UTC (10 years, 9 months ago) by phornby
File MIME type: text/plain
File size: 2749 byte(s)
Make operator=() on exception non-virtual. Should silence the Altix compiler.
However, if an exception is cast to another parent type, and
operator=() is called when the exception so cast is an l-value in the assignment,
an "incomplete" assignment will occur, copying only the parent class members of the 
l-value in the assignmnet.
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
23 namespace esysUtils {
24
25 /**
26 \brief
27 EsysAssertException exception class.
28
29 Description:
30 EsysAssertException exception class.
31 The class provides a public function returning the exception name.
32 */
33 class EsysAssertException : public EsysException
34 {
35
36 protected:
37
38 typedef EsysException Parent;
39
40 public:
41 /**
42 \brief
43 Default constructor for the exception.
44 */
45 ESYSUTILS_DLL_API
46 inline
47 EsysAssertException() : Parent() { updateMessage();}
48 /**
49 \brief
50 Constructor for the exception.
51 */
52 ESYSUTILS_DLL_API
53 inline
54 EsysAssertException(const char *cstr) : Parent(cstr) { updateMessage();}
55 /**
56 \brief
57 Constructor for the exception.
58 */
59 ESYSUTILS_DLL_API
60 inline
61 EsysAssertException(const std::string &str) :
62 Parent(str) { updateMessage();}
63 /**
64 \brief
65 Copy Constructor for the exception.
66 */
67 ESYSUTILS_DLL_API
68 inline
69 EsysAssertException(const EsysAssertException &other) : Parent(other)
70 {
71 updateMessage();
72 }
73
74 ESYSUTILS_DLL_API
75 inline
76 EsysAssertException &
77 operator=(const EsysAssertException &other) THROW_ANY
78 {
79 Parent::operator=(other);
80 updateMessage();
81 return *this;
82 }
83
84
85 /// Destructor
86 ESYSUTILS_DLL_API
87 virtual ~EsysAssertException() THROW_ANY {}
88
89 /**
90 \brief
91 Returns the name of the exception.
92 */
93 ESYSUTILS_DLL_API
94 virtual const std::string & exceptionName() const;
95
96 /**
97 \brief
98 Builds a formatted message and throws an EsysAssertException.
99 */
100 ESYSUTILS_DLL_API
101 static void assertFailure (const std::string& assertion,
102 const std::string& date,
103 const std::string& file,
104 int line, const std::string& errDesc);
105 private:
106
107 //
108 // the exception name is immutable and class-wide.
109 // Inheritor note; you need one of these too.
110 // and an overloaded exceptionName() in your .cpp implementation file.
111 static const std::string exceptionNameValue;
112 };
113
114 } // end of namespace
115
116 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26