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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1388 - (show annotations)
Fri Jan 11 07:45:58 2008 UTC (13 years, 8 months ago) by trankine
File MIME type: text/plain
File size: 2168 byte(s)
And get the *(&(*&(* name right
1
2 /* $Id$ */
3
4 /*******************************************************
5 *
6 * Copyright 2003-2007 by ACceSS MNRF
7 * Copyright 2007 by University of Queensland
8 *
9 * http://esscc.uq.edu.au
10 * Primary Business: Queensland, Australia
11 * Licensed under the Open Software License version 3.0
12 * http://www.opensource.org/licenses/osl-3.0.php
13 *
14 *******************************************************/
15
16 #if !defined escript_EsysAssertException_20040330_H
17 #define escript_EsysAssertException_20040330_H
18 #include "system_dep.h"
19
20 #include "EsysException.h"
21
22 #include <string>
23 #include <sstream>
24
25 namespace esysUtils {
26
27 /**
28 \brief
29 EsysAssertException exception class.
30
31 Description:
32 EsysAssertException exception class.
33 The class provides a public function returning the exception name.
34 */
35 class EsysAssertException:public EsysException {
36
37 public:
38
39 /**
40 \brief
41 Default constructor for the exception.
42 */
43 EsysAssertException() : EsysException() {}
44
45 /**
46 \brief
47 Constructor for the exception.
48 */
49 EsysAssertException(const char *cstr) : EsysException(cstr) {}
50
51 /**
52 \brief
53 Constructor for the exception.
54 */
55 EsysAssertException(const std::string &str) : EsysException(str) {}
56
57 /// Destructor
58 virtual ~EsysAssertException() throw() {}
59
60 /**
61 \brief
62 Returns the name of the exception.
63 */
64 virtual std::string exceptionName() const {return "EsysAssertException";}
65
66 /**
67 \brief
68 Builds a formatted message and throws an EsysAssertException.
69 */
70 static void assertFailure (const std::string& assertion,
71 const std::string& date, const std::string& file,
72 int line, const std::string& errDesc)
73 {
74 std::stringstream message;
75
76 message << std::endl
77 << "EsysAssert(" << assertion << ") failed with message - " << std::endl
78 << "\"" << errDesc << "\"" << std::endl
79 << "Assertion is located in File : " << file
80 << " at Line: " << line << std::endl
81 << "File Compilation Date: " << date << std::endl;
82
83 throw EsysAssertException(message.str());
84 }
85
86 };
87
88 } // end of namespace
89
90 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26