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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1022 - (show annotations)
Tue Mar 13 02:25:53 2007 UTC (12 years, 6 months ago) by phornby
File MIME type: text/plain
File size: 2377 byte(s)
Now define the destructors for all the Exceptions (sorry guys & gals).


1 // $Id$
2 /*
3 ************************************************************
4 * Copyright 2006 by ACcESS MNRF *
5 * *
6 * http://www.access.edu.au *
7 * Primary Business: Queensland, Australia *
8 * Licensed under the Open Software License version 3.0 *
9 * http://www.opensource.org/licenses/osl-3.0.php *
10 * *
11 ************************************************************
12 */
13
14 #if !defined escript_EsysAssertException_20040330_H
15 #define escript_EsysAssertException_20040330_H
16 #include "system_dep.h"
17
18 #include "EsysException.h"
19
20 #include <string>
21 #include <sstream>
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 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() throw() {}
57
58 /**
59 \brief
60 Returns the name of the exception.
61 */
62 virtual std::string exceptionName() const {return "EsysAssertException";}
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, const std::string& file,
70 int line, const std::string& errDesc)
71 {
72 std::stringstream message;
73
74 message << std::endl
75 << "EsysAssert(" << assertion << ") failed with message - " << std::endl
76 << "\"" << errDesc << "\"" << std::endl
77 << "Assertion is located in File : " << file
78 << " at Line: " << line << std::endl
79 << "File Compilation Date: " << date << std::endl;
80
81 throw EsysAssertException(message.str());
82 }
83
84 };
85
86 } // end of namespace
87
88 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26