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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 757 - (hide annotations)
Mon Jun 26 13:12:56 2006 UTC (13 years, 3 months ago) by woo409
File MIME type: text/plain
File size: 2315 byte(s)
+ Merge of intelc_win32 branch (revision 741:755) with trunk. Tested on iVEC altix (run_tests and py_tests all pass)

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 jgs 82 /**
56     \brief
57     Returns the name of the exception.
58     */
59     virtual std::string exceptionName() const {return "EsysAssertException";}
60 jgs 102
61 jgs 82 /**
62     \brief
63     Builds a formatted message and throws an EsysAssertException.
64     */
65     static void assertFailure (const std::string& assertion,
66     const std::string& date, const std::string& file,
67     int line, const std::string& errDesc)
68 jgs 102 {
69 jgs 82 std::stringstream message;
70    
71     message << std::endl
72 jgs 102 << "EsysAssert(" << assertion << ") failed with message - " << std::endl
73 jgs 82 << "\"" << errDesc << "\"" << std::endl
74     << "Assertion is located in File : " << file
75     << " at Line: " << line << std::endl
76 jgs 102 << "File Compilation Date: " << date << std::endl;
77 jgs 82
78     throw EsysAssertException(message.str());
79 jgs 102 }
80 jgs 82
81     };
82    
83     } // end of namespace
84 jgs 468
85 jgs 82 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26