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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 757 - (show 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 // $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 /**
56 \brief
57 Returns the name of the exception.
58 */
59 virtual std::string exceptionName() const {return "EsysAssertException";}
60
61 /**
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 {
69 std::stringstream message;
70
71 message << std::endl
72 << "EsysAssert(" << assertion << ") failed with message - " << std::endl
73 << "\"" << errDesc << "\"" << std::endl
74 << "Assertion is located in File : " << file
75 << " at Line: " << line << std::endl
76 << "File Compilation Date: " << date << std::endl;
77
78 throw EsysAssertException(message.str());
79 }
80
81 };
82
83 } // end of namespace
84
85 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26