00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef UAPException_hpp
00026 #define UAPException_hpp 1
00027
00028 #include <iostream>
00029 #include <sstream>
00030 #include <string>
00031 #include <exception>
00032
00033 class UAPNode;
00034
00041 class UAPException : public std::exception {
00042
00043 public:
00044
00048 UAPException(const std::string& _message = "Unspecified exception");
00049
00054 UAPException(const std::string& _message, const UAPException& _cause);
00055
00057 virtual ~UAPException() throw();
00058
00062 std::string getMessage() const;
00063
00068 UAPException* getCause() const;
00069
00074 void printStackTrace(std::ostream& _file = std::cerr);
00075
00081 virtual std::string toString() const;
00082
00086 friend std::ostream& operator << (std::ostream& os, const UAPException& except);
00087 friend std::ostream& operator << (std::ostream& os, const UAPException* except);
00088
00089 private:
00090
00092 std::string message;
00093
00095 UAPException* cause;
00096
00097 };
00098
00104 class UAPIOException : public UAPException {
00105
00106 public:
00107
00114 UAPIOException(const std::string& _message = "Unspecified exception",
00115 const std::string& _file = "Unspecified file name",
00116 int _line = 0);
00117
00125 UAPIOException(const std::string& _message,
00126 const std::string& _file,
00127 int _line, const UAPException& _cause);
00128
00130 ~UAPIOException() throw();
00131
00135 std::string getFile() const;
00136
00140 int getLineNumber() const;
00141
00145 std::string toString() const;
00146
00147 private:
00148
00150 std::string file;
00151
00153 int line;
00154 };
00155
00159 class UAPNodeException : public UAPException {
00160
00161 public:
00162
00169 UAPNodeException(const std::string& _message = "Unspecified exception", UAPNode* _node = NULL);
00170
00178 UAPNodeException(const std::string& _message, UAPNode* _node, const UAPException& _cause);
00179
00181 ~UAPNodeException() throw();
00182
00187 UAPNode* getNode();
00188
00192 std::string toString() const;
00193
00194 private:
00195
00197 UAPNode* node;
00198
00199 };
00200
00204 class UAPParserException : public UAPException {
00205
00206 public:
00207
00209 UAPParserException(const std::string& _message = "Unspecified exception");
00210
00212 UAPParserException(const std::string& _message, const UAPException& _cause);
00213
00215 ~UAPParserException() throw();
00216
00217 };
00218
00224 class UAPNotRecognizedException : public UAPParserException {
00225
00226 public:
00227
00229 UAPNotRecognizedException(const std::string& _message = "Unspecified exception");
00230
00232 UAPNotRecognizedException(const std::string& _message, const UAPException& _cause);
00233
00235 ~UAPNotRecognizedException() throw();
00236
00237 };
00238
00243 class UAPBeamlineExpansionFailedException : public UAPException {
00244
00245 public:
00246
00248 UAPBeamlineExpansionFailedException(const std::string& _message = "Unspecified exception");
00249
00251 UAPBeamlineExpansionFailedException(const std::string& _message, const UAPException& _cause);
00252
00254 ~UAPBeamlineExpansionFailedException() throw();
00255
00256 };
00257
00264 class UAPInvalidExpressionException : public UAPParserException {
00265
00266 public:
00267
00269 UAPInvalidExpressionException(const std::string& _message = "Unspecified exception");
00270
00272 UAPInvalidExpressionException(const std::string& _message, const UAPException& _cause);
00273
00275 ~UAPInvalidExpressionException() throw();
00276
00277 };
00278
00282 class UAPParameterNotFoundException : public UAPException {
00283
00284 public:
00285
00287 UAPParameterNotFoundException(const std::string& _message = "Unspecified exception");
00288
00290 UAPParameterNotFoundException(const std::string& _message, const UAPException& _cause);
00291
00293 ~UAPParameterNotFoundException() throw();
00294
00295 };
00296
00300 class UAPNotSupportedException: public UAPException {
00301
00302 public:
00303
00305 UAPNotSupportedException(const std::string& _message = "Unspecified exception");
00306
00308 UAPNotSupportedException(const std::string& _message, const UAPException& _cause);
00309
00311 ~UAPNotSupportedException() throw();
00312
00313 };
00314
00318 class UAPFileCouldNotBeOpened: public UAPIOException {
00319
00320 public:
00321
00323 UAPFileCouldNotBeOpened(const std::string& _message = "Unspecified exception",
00324 const std::string& _file = "Unspecified file name",
00325 int _line = 0);
00326
00328 UAPFileCouldNotBeOpened(const std::string& _message,
00329 const std::string& _file, int _line, const UAPException& _cause);
00330
00332 ~UAPFileCouldNotBeOpened() throw();
00333
00334 };
00335
00339 class UAPAttributeNotFound: public UAPNodeException {
00340
00341 public:
00342
00344 UAPAttributeNotFound(const std::string& _message = "Unspecified exception", UAPNode* _node = NULL);
00345
00347 UAPAttributeNotFound(const std::string& _message, UAPNode* _node, const UAPException& _cause);
00348
00350 ~UAPAttributeNotFound() throw();
00351
00352 };
00353
00357 class UAPAttributeConfusion: public UAPNodeException {
00358
00359 public:
00360
00362 UAPAttributeConfusion(const std::string& _message = "Unspecified exception", UAPNode* _node = NULL);
00363
00365 UAPAttributeConfusion(const std::string& _message, UAPNode* _node, const UAPException& _cause);
00366
00368 ~UAPAttributeConfusion() throw();
00369
00370 };
00371
00375 class UAPBadAttributeValue: public UAPNodeException {
00376
00377 public:
00378
00380 UAPBadAttributeValue(const std::string& _message = "Unspecified exception", UAPNode* _node = NULL);
00381
00383 UAPBadAttributeValue(const std::string& _message, UAPNode* _node, const UAPException& _cause);
00384
00386 ~UAPBadAttributeValue() throw();
00387
00388 };
00389
00393 class UAPNodeNotFound: public UAPNodeException {
00394
00395 public:
00396
00398 UAPNodeNotFound(const std::string& _message = "Unspecified exception", UAPNode* _node = NULL);
00399
00401 UAPNodeNotFound(const std::string& _message, UAPNode* _node, const UAPException& _cause);
00402
00404 ~UAPNodeNotFound() throw();
00405
00406 };
00407
00408
00410 #endif