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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26