00001 // 00002 // CSL_Exceptions.h -- the CSL Exception classes (specifications + implementations) 00003 // 00004 // See the copyright notice and acknowledgment of authors in the file COPYRIGHT 00005 // 00006 00007 #ifndef CSL_EXCEPTIONS_H 00008 #define CSL_EXCEPTIONS_H 00009 00010 #include <exception> // Standard C++ exception library 00011 #include <string> 00012 00013 namespace csl { 00014 00015 using namespace std; 00016 00017 #ifndef CSL_ENUMS 00018 class exception { }; // needed for SWIG 00019 #endif 00020 00024 00025 class CException : public std::exception { 00026 public: 00027 string mMessage; 00028 CException(const string & msg) throw() : mMessage(msg) { }; 00029 ~CException() throw() { }; 00030 }; 00031 00035 00036 class MemoryError : public CException { 00037 public: 00038 MemoryError(const string & msg) : CException(msg) { }; 00039 }; 00040 00044 00045 class ValueError : public CException { 00046 public: 00047 ValueError(const string & msg) : CException(msg) { }; 00048 }; 00049 00053 00054 class TimingError : public CException { 00055 public: 00056 TimingError(const string & msg) : CException(msg) { }; 00057 }; 00058 00062 00063 class RunTimeError : public CException { 00064 public: 00065 RunTimeError(const string & msg) : CException(msg) { }; 00066 }; 00067 00071 00072 class LogicError : public CException { 00073 public: 00074 LogicError(const string & msg) : CException(msg) { }; 00075 }; 00076 00080 00081 class DomainError : public ValueError { 00082 public: 00083 DomainError(const string & msg) : ValueError(msg) { }; 00084 }; 00085 00089 00090 class OutOfRangeError : public ValueError { 00091 public: 00092 OutOfRangeError(const string & msg) : ValueError(msg) { }; 00093 }; 00094 00098 00099 class IOError : public ValueError { 00100 public: 00101 IOError(const string & msg) : ValueError(msg) { }; 00102 }; 00103 00104 } 00105 00106 #endif
1.5.8