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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1022 - (hide 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 jgs 102 // $Id$
2 jgs 82 /*
3 elspeth 644 ************************************************************
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 jgs 82 */
13    
14 jgs 102 #if !defined escript_EsysAssertException_20040330_H
15 jgs 82 #define escript_EsysAssertException_20040330_H
16 woo409 757 #include "system_dep.h"
17 jgs 82
18 jgs 468 #include "EsysException.h"
19 jgs 82
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 jgs 102 The class provides a public function returning the exception name.
32 jgs 82 */
33     class EsysAssertException:public EsysException {
34    
35     public:
36 jgs 102
37 jgs 82 /**
38     \brief
39     Default constructor for the exception.
40     */
41     EsysAssertException() : EsysException() {}
42 jgs 102
43 jgs 82 /**
44     \brief
45     Constructor for the exception.
46     */
47     EsysAssertException(const char *cstr) : EsysException(cstr) {}
48 jgs 102
49 jgs 82 /**
50     \brief
51     Constructor for the exception.
52     */
53     EsysAssertException(const std::string &str) : EsysException(str) {}
54 jgs 102
55 phornby 1020 /// Destructor
56 phornby 1022 virtual ~EsysAssertException() throw() {}
57 phornby 1020
58 jgs 82 /**
59     \brief
60     Returns the name of the exception.
61     */
62     virtual std::string exceptionName() const {return "EsysAssertException";}
63 jgs 102
64 jgs 82 /**
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 jgs 102 {
72 jgs 82 std::stringstream message;
73    
74     message << std::endl
75 jgs 102 << "EsysAssert(" << assertion << ") failed with message - " << std::endl
76 jgs 82 << "\"" << errDesc << "\"" << std::endl
77     << "Assertion is located in File : " << file
78     << " at Line: " << line << std::endl
79 jgs 102 << "File Compilation Date: " << date << std::endl;
80 jgs 82
81     throw EsysAssertException(message.str());
82 jgs 102 }
83 jgs 82
84     };
85    
86     } // end of namespace
87 jgs 468
88 jgs 82 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26