NGSolve
5.3
|
00001 #ifndef FILE_EXCEPTION 00002 #define FILE_EXCEPTION 00003 00004 /**************************************************************************/ 00005 /* File: exception.hpp */ 00006 /* Author: Joachim Schoeberl */ 00007 /* Date: 16. Jan. 2002 */ 00008 /**************************************************************************/ 00009 00010 namespace ngstd 00011 { 00012 00013 #ifdef DEBUG 00014 #define CHECK_RANGE 00015 #endif 00016 00017 00018 00020 class NGS_DLL_HEADER Exception 00021 { 00023 string what; 00024 public: 00025 Exception (); 00027 Exception (const string & s); 00029 Exception (const char * s); 00031 virtual ~Exception (); 00032 00034 Exception & Append (const string & s); 00036 Exception & Append (const char * s); 00037 00039 const string & What() const { return what; } 00040 }; 00041 00042 template <typename T> 00043 inline Exception & operator<< (Exception & ex, T data) 00044 { 00045 ex.Append (data); 00046 return ex; 00047 } 00048 00050 class NGS_DLL_HEADER RangeException : public Exception 00051 { 00052 public: 00054 RangeException (const string & where, 00055 int ind, int imin, int imax); 00056 }; 00057 00058 } 00059 00060 #endif