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

Annotation of /trunk/esysUtils/src/EsysException.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 757 - (hide annotations)
Mon Jun 26 13:12:56 2006 UTC (16 years, 8 months ago) by woo409
File size: 2504 byte(s)
+ Merge of intelc_win32 branch (revision 741:755) with trunk. Tested on iVEC altix (run_tests and py_tests all pass)

1 jgs 82 /*
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 jgs 468 #include "EsysException.h"
16 jgs 82
17     using namespace std;
18     using namespace esysUtils;
19    
20     ostream &operator<<(ostream &output, EsysException &inException){
21     output << inException.toString();
22     return output;
23     }
24    
25     EsysException::EsysException():
26     exception()
27     {
28     }
29    
30     EsysException::EsysException(const string &exceptionReason):
31     exception()
32     {
33     reason() << exceptionReason;
34     }
35    
36     // Copy Constructor.
37     EsysException::EsysException(const EsysException &inException):
38     exception(inException)
39     {
40     *this=inException;
41     }
42    
43     EsysException::EsysException( const char *cStr ):
44     exception()
45     {
46     reason() << cStr;
47     }
48    
49     EsysException::~EsysException() throw()
50     {}
51    
52     string EsysException::exceptionName() const
53     {
54     return "GeneralEsysException";
55     }
56     ostringstream& EsysException::reason()
57     {
58     return m_reason;
59     }
60     //
61     // Overloaded assignment operator.
62     EsysException& EsysException::operator=(const EsysException &inException) {
63     if (this != &inException) {
64 woo409 757 //
65     // call the base class operator=
66     // win32 refactor: parent class operator= shares pointer the result is
67     // all classes try to free the same pointer, dies on windows badly.
68     // this->exception::operator=(dynamic_cast<const exception&>(inException));
69     //
70     // copy the message buffer into this EsysException
71     m_reason << inException.m_reason.str(); // copy the message buffer into this EsysException
72 jgs 82 }
73     return *this;
74     }
75    
76     // return the message as a string
77     string EsysException::toString() const {
78     return exceptionName() + ": " + m_reason.str();
79     }
80    
81     const char* EsysException::what() const throw() {
82     //
83     m_exceptionMessage=toString();
84     return m_exceptionMessage.c_str();
85     }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26