00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef FILE_MULTIVAC_ERRORS_HXX
00021
00022
00023 #include <iostream>
00024 #include <string>
00025
00026
00027 namespace Multivac
00028 {
00029
00030
00032
00034
00036 class CError
00037 {
00038 protected:
00039 string function;
00040 string comment;
00041
00042 public:
00043 CError()
00044 {
00045 cout << "ERROR!" << endl;
00046 function = "";
00047 comment = "";
00048 }
00049 CError(string f)
00050 {
00051 cout << "ERROR!" << endl;
00052 function = f;
00053 comment = "";
00054 }
00055 CError(string f, string c)
00056 {
00057 cout << "ERROR!" << endl;
00058 function = f;
00059 comment = c;
00060 }
00061 virtual ~CError()
00062 {
00063 }
00064 virtual void What()
00065 {
00066 cout << "An undefined error occured";
00067 if (!function.empty())
00068 cout << " in " << function;
00069 cout << "." << endl;
00070 if (!comment.empty())
00071 cout << " " << comment << "." << endl;
00072 cout << endl;
00073 }
00074 };
00075
00076
00078
00080
00083 class CError_FileIO: public CError
00084 {
00085 public:
00086 CError_FileIO(string f): CError(f)
00087 {
00088 }
00089 CError_FileIO(string f, string c): CError(f, c)
00090 {
00091 }
00092 virtual ~CError_FileIO()
00093 {
00094 }
00095 virtual void What()
00096 {
00097 cout << "Error while performing an I/O operation (with files)";
00098 if (!this->function.empty())
00099 cout << " in " << this->function;
00100 cout << "." << endl;
00101 if (!this->comment.empty())
00102 cout << " " << this->comment << "." << endl;
00103 cout << endl;
00104 }
00105 };
00106
00107
00109
00111
00113 class CError_OutOfDomain: public CError
00114 {
00115 public:
00116 CError_OutOfDomain(string f): CError(f)
00117 {
00118 }
00119 CError_OutOfDomain(string f, string c): CError(f, c)
00120 {
00121 }
00122 virtual ~CError_OutOfDomain()
00123 {
00124 }
00125 virtual void What()
00126 {
00127 cout << "Computation outside the domain";
00128 if (!this->function.empty())
00129 cout << " in " << this->function;
00130 cout << "." << endl;
00131 if (!this->comment.empty())
00132 cout << " " << this->comment << "." << endl;
00133 cout << endl;
00134 }
00135 };
00136
00137
00139
00141
00143 class CError_Instability: public CError
00144 {
00145 public:
00146 CError_Instability(string f): CError(f)
00147 {
00148 }
00149 CError_Instability(string f, string c): CError(f, c)
00150 {
00151 }
00152 virtual ~CError_Instability()
00153 {
00154 }
00155 virtual void What()
00156 {
00157 cout << "Computations stopped because of an instability";
00158 if (!this->function.empty())
00159 cout << " in " << this->function;
00160 cout << "." << endl;
00161 if (!this->comment.empty())
00162 cout << " " << this->comment << "." << endl;
00163 cout << endl;
00164 }
00165 };
00166
00167
00169
00171
00174 class CError_Incompatibility: public CError
00175 {
00176 public:
00177 CError_Incompatibility(string f): CError(f)
00178 {
00179 }
00180 CError_Incompatibility(string f, string c): CError(f, c)
00181 {
00182 }
00183 virtual ~CError_Incompatibility()
00184 {
00185 }
00186 virtual void What()
00187 {
00188 cout << "An incompatibility has been detected in your choices";
00189 if (!this->function.empty())
00190 cout << " in " << this->function;
00191 cout << "." << endl;
00192 if (!this->comment.empty())
00193 cout << " " << this->comment << "." << endl;
00194 cout << endl;
00195 }
00196 };
00197
00198
00200
00202
00204 class CError_Undefined: public CError
00205 {
00206 public:
00207 CError_Undefined(string f): CError(f)
00208 {
00209 }
00210 CError_Undefined(string f, string c): CError(f, c)
00211 {
00212 }
00213 virtual ~CError_Undefined()
00214 {
00215 }
00216 virtual void What()
00217 {
00218 cout << "Function ";
00219 if (!this->function.empty())
00220 cout << this->function;
00221 cout << " is not defined." << endl;
00222 if (!this->comment.empty())
00223 cout << " " << this->comment << "." << endl;
00224 cout << endl;
00225 }
00226 };
00227
00228
00229 }
00230
00231
00232 #define FILE_MULTIVAC_ERROR_HXX
00233 #endif