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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 155 - (show annotations)
Wed Nov 9 02:02:19 2005 UTC (13 years, 9 months ago) by jgs
File MIME type: text/plain
File size: 2612 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

1 // $Id$
2 /*
3 *****************************************************************************
4 * *
5 * COPYRIGHT ACcESS - All Rights Reserved *
6 * *
7 * This software is the property of ACcESS. No part of this code *
8 * may be copied in any form or by any means without the expressed written *
9 * consent of ACcESS. Copying, use or modification of this software *
10 * by any unauthorised person is illegal unless that person has a software *
11 * license agreement with ACcESS. *
12 * *
13 *****************************************************************************
14 */
15
16 #if !defined escript_EsysAssertException_20040330_H
17 #define escript_EsysAssertException_20040330_H
18
19 #include "esysUtils/EsysException.h"
20
21 #include <string>
22 #include <sstream>
23
24 namespace esysUtils {
25
26 /**
27 \brief
28 EsysAssertException exception class.
29
30 Description:
31 EsysAssertException exception class.
32 The class provides a public function returning the exception name.
33 */
34 class EsysAssertException:public EsysException {
35
36 public:
37
38 /**
39 \brief
40 Default constructor for the exception.
41 */
42 EsysAssertException() : EsysException() {}
43
44 /**
45 \brief
46 Constructor for the exception.
47 */
48 EsysAssertException(const char *cstr) : EsysException(cstr) {}
49
50 /**
51 \brief
52 Constructor for the exception.
53 */
54 EsysAssertException(const std::string &str) : EsysException(str) {}
55
56 /**
57 \brief
58 Returns the name of the exception.
59 */
60 virtual std::string exceptionName() const {return "EsysAssertException";}
61
62 /**
63 \brief
64 Builds a formatted message and throws an EsysAssertException.
65 */
66 static void assertFailure (const std::string& assertion,
67 const std::string& date, const std::string& file,
68 int line, const std::string& errDesc)
69 {
70 std::stringstream message;
71
72 message << std::endl
73 << "EsysAssert(" << assertion << ") failed with message - " << std::endl
74 << "\"" << errDesc << "\"" << std::endl
75 << "Assertion is located in File : " << file
76 << " at Line: " << line << std::endl
77 << "File Compilation Date: " << date << std::endl;
78
79 throw EsysAssertException(message.str());
80 }
81
82
83 };
84
85 } // end of namespace
86 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26