Changeset 895 in Sophya for trunk/SophyaLib/BaseTools/pexceptions.h
- Timestamp:
- Apr 12, 2000, 7:49:54 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/pexceptions.h
r773 r895 14 14 namespace SOPHYA { 15 15 16 // Utiliatire pour accoler un nom de fichier et numero de ligne aumessage16 //! Utility function for appending a file name and line number to a message 17 17 string BuildLongExceptionMessage(const char * s, const char *file, int line); 18 18 19 // Ancestor for PError and PException 20 // It has a message, and an id to give more 21 // information on the exception. 19 //! Base exception class in Sophya. 20 /*! Ancestor for PError and PException 21 It has a message, and an id to give more 22 information on the exception. 23 */ 22 24 class PThrowable { 23 25 public: 26 //! Constructor with the message and error-id (optional) specification 24 27 explicit PThrowable(const string& m, int ident=0) 25 28 : msg(m), id(ident) {} 26 29 virtual ~PThrowable() { } 30 //! Returns the associated message string 27 31 virtual string const& Msg() const {return msg;} 32 //! Returns the associated error-id 33 virtual int Id() const {return id; } 28 34 private: 29 35 string msg; 30 36 int id; 31 37 }; 32 33 // A PError is a serious logic error. Usually not caught... 38 39 // PThrowable 40 // PError 41 // PException 42 43 //! A PError is a serious logic error. Usually not caught... 34 44 class PError : public PThrowable { 35 45 public: … … 37 47 }; 38 48 39 //A PException is not as serious... Can be caught.49 //! A PException is not as serious... Can be caught. 40 50 class PException : public PThrowable { 41 51 public: … … 43 53 }; 44 54 45 // Errors 46 // Memory allocation failure 55 // ---- Errors ---- 56 // PError 57 // AllocationError 58 // NullPtrError 59 // ForbiddenError 60 // AssertionFailedError 61 62 //! Memory allocation failure 47 63 class AllocationError : public PError { 48 64 public: … … 50 66 }; 51 67 52 //Null pointer error68 //! Null pointer error 53 69 class NullPtrError : public PError { 54 70 public: … … 56 72 }; 57 73 58 // Size mismatch between objects 59 class SzMismatchError : public PError { 60 public: 61 explicit SzMismatchError(const string& m, int id=0) : PError(m,id) {} 62 }; 63 64 // Out of bounds for array, matrix, etc. 65 class RangeCheckError : public PError { 66 public: 67 explicit RangeCheckError(const string& m, int id=0) : PError(m,id) {} 68 }; 69 70 // Invalid parameter to method/constructor... 71 class ParmError : public PError { 72 public: 73 explicit ParmError(const string& m, int id=0) : PError(m,id) {} 74 }; 75 76 // Calling a forbidden method, trying a forbidden operation 74 75 //! Calling a forbidden method, trying a forbidden operation 77 76 class ForbiddenError : public PError { 78 77 public: … … 80 79 }; 81 80 82 // Calling a non available / not implemented method 83 class NotAvailableOperation : public PException { 84 public: 85 explicit NotAvailableOperation(const string& m, int id=0) : PException(m,id) {} 86 }; 87 88 // ASSERT macro failure. The message is the assertion... 81 82 //! ASSERT macro failure. The message is the assertion... 89 83 class AssertionFailedError : public PError { 90 84 public: … … 97 91 // IOExc 98 92 // FileFormatExc 93 // SzMismatchError 94 // RangeCheckError 95 // ParmError 99 96 // TypeMismatchExc 97 // MathExc 98 // SingMatxExc 100 99 // DuplicateIdExc 101 100 // NotFoundExc 102 // MathExc 103 // SingMatxExc 104 105 // generic IO Exception 101 // CaughtSignalExc 102 103 //! Generic IO Exception. 106 104 class IOExc : public PException { 107 105 public: … … 109 107 }; 110 108 111 // Bad type -> keep ? 109 //! Bad file format. 110 class FileFormatExc : public IOExc { 111 public: 112 explicit FileFormatExc(const string& m, int id=0) : IOExc(m,id) {} 113 }; 114 115 //! Size mismatch between objects. 116 class SzMismatchError : public PException { 117 public: 118 explicit SzMismatchError(const string& m, int id=0) : PException(m,id) {} 119 }; 120 121 //! Out of bounds for array, matrix, etc. 122 class RangeCheckError : public PException { 123 public: 124 explicit RangeCheckError(const string& m, int id=0) : PException(m,id) {} 125 }; 126 127 //! Invalid parameter to method/constructor... 128 class ParmError : public PException { 129 public: 130 explicit ParmError(const string& m, int id=0) : PException(m,id) {} 131 }; 132 133 //! Calling a non available / not implemented method 134 class NotAvailableOperation : public PException { 135 public: 136 explicit NotAvailableOperation(const string& m, int id=0) : PException(m,id) {} 137 }; 138 139 //! Bad data type -> keep ? 112 140 class TypeMismatchExc : public PException { 113 141 public: 114 142 explicit TypeMismatchExc(const string& m, int id=0) : PException(m,id) {} 115 143 }; 116 144 145 //! Math operation exception 117 146 class MathExc : public PException { 118 147 public: … … 120 149 }; 121 150 151 //! Singular matrix 152 class SingMatrixExc : public MathExc { 153 public: 154 explicit SingMatrixExc(const string& m, int id=0) : MathExc(m,id) {} 155 }; 156 157 //! Duplicate identifier during registration 122 158 class DuplicateIdExc : public PException { 123 159 public: … … 125 161 }; 126 162 163 //! Not found identifier 127 164 class NotFoundExc : public PException { 128 165 public: … … 130 167 }; 131 168 169 //! Generated exception when processing a signal 132 170 class CaughtSignalExc : public PException { 133 171 public: 134 172 explicit CaughtSignalExc(const string& m, int id=0) : PException(m,id) {} 135 173 }; 136 137 // Bad file format 138 class FileFormatExc : public IOExc { 139 public: 140 explicit FileFormatExc(const string& m, int id=0) : IOExc(m,id) {} 141 }; 142 143 class SingMatrixExc : public MathExc { 144 public: 145 explicit SingMatrixExc(const string& m, int id=0) : MathExc(m,id) {} 146 }; 147 148 149 } 174 175 } // namespace SOPHYA 150 176 151 177
Note:
See TracChangeset
for help on using the changeset viewer.