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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (hide annotations)
Tue Oct 26 06:53:54 2004 UTC (14 years, 10 months ago) by jgs
Original Path: trunk/esys2/esysUtils/src/EsysException.h
File MIME type: text/plain
File size: 3597 byte(s)
Initial revision

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     #ifndef ESYSEXCEPTION_H
16     #define ESYSEXCEPTION_H
17    
18     #include <string>
19     #include <sstream>
20     #include <exception>
21    
22     namespace esysUtils {
23     /**
24     @memo
25     A base class for exception classes used within Esys system.
26    
27     @version 1.0.0
28    
29     @doc
30    
31     Class Description:
32     A base class for exception classes used within Esys system.
33    
34     Class Limitations:
35     None
36    
37     Class Conditions of Use:
38     None
39    
40     Throws:
41     None
42    
43     */
44     class EsysException:public std::exception {
45     public:
46     /**
47     @memo
48     Default Constructor. Creates an exception with no message.
49     */
50     EsysException();
51     /**
52     @memo
53     Constructor which creates a EsysException with the given message
54    
55     @param exceptionReason Input - Exception message.
56     */
57     EsysException(const std::string &exceptionReason);
58     /**
59     @memo
60     Constructor which creates a EsysException with the given message
61     @param cStr - Exception message.
62     */
63     EsysException( const char *cStr );
64     /**
65     @memo
66     Copy constructor
67     @param inException Input - EsysException
68     */
69     EsysException(const EsysException &inException);
70     /// Destructor
71     virtual ~EsysException() throw();
72     /**
73     @memo
74     Assignment operator.
75     @param inException Input - Exception to be copied.
76     */
77     EsysException &operator=(const EsysException &inException);
78     /**
79     @memo
80     Return the exception message in the form
81     <Exception Name>: <Exception Message>
82     @return the exception message.
83     */
84     std::string toString() const;
85     /**
86     @memo
87     Return the name of the exception. This is expected to be overloaded
88     in derived classes with the derived class name.
89     @return the name of the exception.
90     */
91     virtual std::string exceptionName() const;
92     /**
93     @memo
94     Return the ostrstream that contains the exception message.
95     This is useful for entering or adding to the message as the stream
96     insertion operators can then be used.
97     @return the ostrstream for the exception reason.
98     */
99     std::ostringstream& reason();
100     /**
101     @memo
102     Return a description of the exception in the same format as the toString
103     method.
104     @return a description of the exception.
105     */
106     virtual const char* what() const throw();
107     private:
108     //
109     // the exception message
110     std::ostringstream m_reason;
111     //
112     // the full exception message kept in permenant storage
113     mutable std::string m_exceptionMessage;
114     };
115     /**
116     @memo
117     Stream insertion operator for EsysExceptions
118     @param output Input - Output stream.
119     @param inException Input - The exception to be inserted into the output
120     stream.
121     */
122     std::ostream &operator<<(std::ostream &output, EsysException &inException);
123    
124     }
125    
126     #endif
127    
128    
129    
130    
131    
132    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26