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
00026 #ifndef _MPCL_INVARIANT_EXCEPTIONS__
00027 #define _MPCL_INVARIANT_EXCEPTIONS__
00028
00029 #include <iostream>
00030 #include "../error_exception.hh"
00031 #include "../exception.hh"
00032
00033
00035 namespace mpcl
00036 {
00037
00039 namespace invariant
00040 {
00041
00042 using std::basic_ostream;
00043
00045 class TException : public virtual mpcl::TException {};
00046
00048 class TViolationException :
00049 public virtual mpcl::TException ,
00050 public TErrorException ,
00051 public TException
00052 {
00053
00054 private:
00055
00057 static const char* _pkcSynopsis;
00058
00060 const int iViolatedConformanceLevel;
00061
00062
00063 protected:
00064
00065
00066
00067
00068
00069 void write (basic_ostream<char>& rtTARGET_OSTREAM) const
00070 {
00071 if ( !fileName().empty() )
00072 {
00073 rtTARGET_OSTREAM << fileName() << ":" << lineNumber() << ":";
00074 }
00075 rtTARGET_OSTREAM << generalDescription() << iViolatedConformanceLevel << "; ";
00076 if ( !specificDescription().empty() )
00077 {
00078 rtTARGET_OSTREAM << specificDescription();
00079 }
00080 rtTARGET_OSTREAM << std::endl;
00081 }
00082
00083
00084 public:
00085
00086
00087
00088
00089
00098 TViolationException ( int iVIOLATED_CONFORMANCE_LEVEL ,
00099 const string& rkyRATIONALE = string() ,
00100 const string& rkyFILE_NAME = string() ,
00101 const int kiLINE_NUMBER = 0 ) :
00102 mpcl::TException (_pkcSynopsis, rkyRATIONALE, rkyFILE_NAME, kiLINE_NUMBER) ,
00103 TErrorException () ,
00104 TException () ,
00105 iViolatedConformanceLevel (iVIOLATED_CONFORMANCE_LEVEL) {}
00106
00107
00108 public:
00109
00110
00111
00112
00113
00114 int violatedConformanceLevel (void) const
00115 {
00116 return iViolatedConformanceLevel;
00117 }
00118
00119 };
00120
00121 }
00122
00123 }
00124
00125
00126 #endif // not _MPCL_INVARIANT_EXCEPTIONS__