/[escript]/branches/windows_from_1431_trunk/esysUtils/src/EsysAssertException.h
ViewVC logotype

Contents of /branches/windows_from_1431_trunk/esysUtils/src/EsysAssertException.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1451 - (show annotations)
Thu Feb 28 14:14:12 2008 UTC (13 years, 1 month ago) by phornby
File MIME type: text/plain
File size: 2316 byte(s)
Compiles and passes run_tests on debian.

The Exception scheme has been reworked somewhat. All classes
manage their own internal copies of strings using strin manipulations only.
Class name strings are kept as class static consts, and virtual function
pick up the right class name string and concatinate with the reason string to form the
message string.

Only the copy constructor is implemented, so there can be no funny business with
class name strings. operator=() is gone, and good riddance to it.


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 protected:
36
37 typedef EsysException Parent;
38
39 public:
40 /**
41 \brief
42 Default constructor for the exception.
43 */
44 EsysAssertException() : Parent() { updateMessage();}
45 /**
46 \brief
47 Constructor for the exception.
48 */
49 EsysAssertException(const char *cstr) : Parent(cstr) { updateMessage();}
50 /**
51 \brief
52 Constructor for the exception.
53 */
54 EsysAssertException(const std::string &str) :
55 Parent(str) { updateMessage();}
56 /**
57 \brief
58 Copy Constructor for the exception.
59 */
60 EsysAssertException(const EsysAssertException &other) : Parent(other)
61 {
62 updateMessage();
63 }
64
65
66 /// Destructor
67 virtual ~EsysAssertException() THROW() {}
68
69 /**
70 \brief
71 Returns the name of the exception.
72 */
73 virtual const std::string & exceptionName() const;
74
75 /**
76 \brief
77 Builds a formatted message and throws an EsysAssertException.
78 */
79 static void assertFailure (const std::string& assertion,
80 const std::string& date,
81 const std::string& file,
82 int line, const std::string& errDesc);
83 private:
84
85 //
86 // the exception name is immutable and class-wide.
87 // Inheritor note; you need one of these too.
88 // and an overloaded exceptionName() in your .cpp implementation file.
89 static const std::string exceptionNameValue;
90 };
91
92 } // end of namespace
93
94 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26