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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 644 - (hide annotations)
Fri Mar 24 01:05:42 2006 UTC (13 years, 5 months ago) by elspeth
File MIME type: text/plain
File size: 2291 byte(s)
More copyright.

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    
17 jgs 468 #include "EsysException.h"
18 jgs 82
19     #include <string>
20     #include <sstream>
21    
22     namespace esysUtils {
23    
24     /**
25     \brief
26     EsysAssertException exception class.
27    
28     Description:
29     EsysAssertException exception class.
30 jgs 102 The class provides a public function returning the exception name.
31 jgs 82 */
32     class EsysAssertException:public EsysException {
33    
34     public:
35 jgs 102
36 jgs 82 /**
37     \brief
38     Default constructor for the exception.
39     */
40     EsysAssertException() : EsysException() {}
41 jgs 102
42 jgs 82 /**
43     \brief
44     Constructor for the exception.
45     */
46     EsysAssertException(const char *cstr) : EsysException(cstr) {}
47 jgs 102
48 jgs 82 /**
49     \brief
50     Constructor for the exception.
51     */
52     EsysAssertException(const std::string &str) : EsysException(str) {}
53 jgs 102
54 jgs 82 /**
55     \brief
56     Returns the name of the exception.
57     */
58     virtual std::string exceptionName() const {return "EsysAssertException";}
59 jgs 102
60 jgs 82 /**
61     \brief
62     Builds a formatted message and throws an EsysAssertException.
63     */
64     static void assertFailure (const std::string& assertion,
65     const std::string& date, const std::string& file,
66     int line, const std::string& errDesc)
67 jgs 102 {
68 jgs 82 std::stringstream message;
69    
70     message << std::endl
71 jgs 102 << "EsysAssert(" << assertion << ") failed with message - " << std::endl
72 jgs 82 << "\"" << errDesc << "\"" << std::endl
73     << "Assertion is located in File : " << file
74     << " at Line: " << line << std::endl
75 jgs 102 << "File Compilation Date: " << date << std::endl;
76 jgs 82
77     throw EsysAssertException(message.str());
78 jgs 102 }
79 jgs 82
80     };
81    
82     } // end of namespace
83 jgs 468
84 jgs 82 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26