00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __CODEX_APSS_EXCEPTIONS_H__
00022 #define __CODEX_APSS_EXCEPTIONS_H__
00023
00024 #include <string>
00025
00026 #include "CODEX_Exceptions/ExceptionBase.h"
00027 #include "Types.h"
00028 #include "Message.h"
00029
00030 namespace CODEX_APSS
00031 {
00035 class ExceptionBase : public CODEX_Exceptions::ExceptionBase
00036 {
00037 public :
00043 ExceptionBase( const string& fname, int line ) :
00044 CODEX_Exceptions::ExceptionBase( fname, line )
00045 {}
00046
00048 virtual ~ExceptionBase() {}
00049
00053 void report() const;
00054
00055 protected :
00060 virtual void derivedMsg() const = 0;
00061
00062 };
00063
00065 class BadSecretNumberException : public ExceptionBase
00066 {
00067 public :
00069 BadSecretNumberException( const string& fname, int line ):
00070 ExceptionBase( fname, line )
00071 {}
00072
00074 virtual ~BadSecretNumberException() {}
00075
00076 protected :
00077 void derivedMsg() const;
00078 };
00079
00081 class MissingRangeException : public ExceptionBase
00082 {
00083 public :
00085 MissingRangeException( const string& fname, int line ):
00086 ExceptionBase( fname, line )
00087 {}
00088
00090 virtual ~MissingRangeException() {}
00091
00092 protected :
00093 void derivedMsg() const;
00094 };
00095
00097 class ConflictExceptionBase : public ExceptionBase
00098 {
00099 public :
00101 ConflictExceptionBase( const string& fname, int line, int offender ) :
00102 ExceptionBase( fname, line ),
00103 m_offender( offender )
00104 {}
00105
00107 ~ConflictExceptionBase() {}
00108
00110 int offender() const { return m_offender; }
00111
00112 protected :
00113 void derivedMsg() const;
00114
00119 virtual void errMsg() const = 0;
00120
00121 private :
00122 int m_offender;
00123 };
00124
00126 class InitMsgConflictException : public ConflictExceptionBase
00127 {
00128 public :
00130 InitMsgConflictException( const string& fname,
00131 int line,
00132 int offender,
00133 const LabelType& newLabel,
00134 const LabelType& oldLabel ) :
00135 ConflictExceptionBase( fname, line, offender ),
00136 m_newLabel( newLabel ),
00137 m_oldLabel( oldLabel )
00138 {}
00139
00141 ~InitMsgConflictException() {}
00142
00144 const LabelType& newLabel() const { return m_newLabel; }
00145
00147 const LabelType& oldLabel() const { return m_oldLabel; }
00148
00149 protected :
00150 void errMsg() const;
00151
00152 private :
00153 LabelType m_newLabel;
00154 LabelType m_oldLabel;
00155 };
00156
00158 class EstablishMsgConflictException : public ConflictExceptionBase
00159 {
00160 public :
00162 EstablishMsgConflictException(
00163 const string& fname,
00164 int line,
00165 int offender,
00166 const SublabelType& newSublabel,
00167 const SublabelType& oldSublabel ) :
00168 ConflictExceptionBase( fname, line, offender ),
00169 m_newSublabel( newSublabel ),
00170 m_oldSublabel( oldSublabel )
00171 {}
00172
00174 ~EstablishMsgConflictException() {}
00175
00177 const SublabelType& newSublabel() const
00178 {
00179 return m_newSublabel;
00180 }
00181
00183 const SublabelType& oldSublabel() const
00184 {
00185 return m_oldSublabel;
00186 }
00187
00188 protected :
00189 void errMsg() const;
00190
00191 private :
00192 SublabelType m_newSublabel;
00193 SublabelType m_oldSublabel;
00194 };
00195
00197 class ComputeMsgConflictException : public ConflictExceptionBase
00198 {
00199 public :
00201 ComputeMsgConflictException( const string& fname,
00202 int line,
00203 int offender,
00204 const ComputeMsg& newMsg,
00205 const ComputeMsg& oldMsg ) :
00206 ConflictExceptionBase( fname, line, offender ),
00207 m_newMsg( newMsg ),
00208 m_oldMsg( oldMsg )
00209 {}
00210
00212 ~ComputeMsgConflictException() {}
00213
00215 const ComputeMsg& newMsg() const { return m_newMsg; }
00216
00218 const ComputeMsg& oldMsg() const { return m_oldMsg; }
00219
00220 protected :
00221 void errMsg() const;
00222
00223 private :
00224 ComputeMsg m_newMsg;
00225 ComputeMsg m_oldMsg;
00226 };
00227
00228 }
00229
00230 #endif