/[escript]/trunk/esys2/esysUtils/src/EsysException.cpp
ViewVC logotype

Contents of /trunk/esys2/esysUtils/src/EsysException.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (show annotations)
Tue Oct 26 06:53:54 2004 UTC (14 years, 10 months ago) by jgs
File size: 2345 byte(s)
Initial revision

1 /*
2 ******************************************************************************
3 * *
4 * COPYRIGHT ACcESS 2004 - All Rights Reserved *
5 * *
6 * This software is the property of ACcESS. No part of this code *
7 * may be copied in any form or by any means without the expressed written *
8 * consent of ACcESS. Copying, use or modification of this software *
9 * by any unauthorised person is illegal unless that person has a software *
10 * license agreement with ACcESS. *
11 * *
12 ******************************************************************************
13 */
14
15 #include <algorithm>
16 #include "esysUtils/EsysException.h"
17
18 using namespace std;
19 using namespace esysUtils;
20
21 ostream &operator<<(ostream &output, EsysException &inException){
22 output << inException.toString();
23 return output;
24 }
25
26 EsysException::EsysException():
27 exception()
28 {
29 }
30
31 EsysException::EsysException(const string &exceptionReason):
32 exception()
33 {
34 reason() << exceptionReason;
35 }
36
37 // Copy Constructor.
38 EsysException::EsysException(const EsysException &inException):
39 exception(inException)
40 {
41 *this=inException;
42 }
43
44 EsysException::EsysException( const char *cStr ):
45 exception()
46 {
47 reason() << cStr;
48 }
49
50 EsysException::~EsysException() throw()
51 {}
52
53 string EsysException::exceptionName() const
54 {
55 return "GeneralEsysException";
56 }
57 ostringstream& EsysException::reason()
58 {
59 return m_reason;
60 }
61 //
62 // Overloaded assignment operator.
63 EsysException& EsysException::operator=(const EsysException &inException) {
64 if (this != &inException) {
65 //
66 // call the base class operator=
67 this->exception::operator=(dynamic_cast<const exception&>(inException));
68 //
69 // copy the message buffer into this EsysException
70 m_reason << inException.m_reason.str();
71 }
72 return *this;
73 }
74
75 // return the message as a string
76 string EsysException::toString() const {
77 return exceptionName() + ": " + m_reason.str();
78 }
79
80 const char* EsysException::what() const throw() {
81 //
82 m_exceptionMessage=toString();
83 return m_exceptionMessage.c_str();
84 }
85
86
87
88
89
90

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26