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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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
17 #include "EsysException.h"
18
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 The class provides a public function returning the exception name.
31 */
32 class EsysAssertException:public EsysException {
33
34 public:
35
36 /**
37 \brief
38 Default constructor for the exception.
39 */
40 EsysAssertException() : EsysException() {}
41
42 /**
43 \brief
44 Constructor for the exception.
45 */
46 EsysAssertException(const char *cstr) : EsysException(cstr) {}
47
48 /**
49 \brief
50 Constructor for the exception.
51 */
52 EsysAssertException(const std::string &str) : EsysException(str) {}
53
54 /**
55 \brief
56 Returns the name of the exception.
57 */
58 virtual std::string exceptionName() const {return "EsysAssertException";}
59
60 /**
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 {
68 std::stringstream message;
69
70 message << std::endl
71 << "EsysAssert(" << assertion << ") failed with message - " << std::endl
72 << "\"" << errDesc << "\"" << std::endl
73 << "Assertion is located in File : " << file
74 << " at Line: " << line << std::endl
75 << "File Compilation Date: " << date << std::endl;
76
77 throw EsysAssertException(message.str());
78 }
79
80 };
81
82 } // end of namespace
83
84 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26