00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __CODEX_EXCEPTIONS_BIGNUMEXCEPTIONS_H__
00022 #define __CODEX_EXCEPTIONS_BIGNUMEXCEPTIONS_H__
00023
00024 #include "ExceptionBase.h"
00025
00026 namespace CODEX_Exceptions
00027 {
00031 class BignumException : public ExceptionBase
00032 {
00033 public :
00035 BignumException( const string& fname, int line ) :
00036 ExceptionBase( fname, line )
00037 {}
00038
00040 virtual ~BignumException() {}
00041
00042 void report() const;
00043
00044 protected :
00049 virtual void derivedMsg() const = 0;
00050 };
00051
00055 class BignumNullException : public BignumException
00056 {
00057 public :
00059 BignumNullException( const string& fname, int line ) :
00060 BignumException( fname, line )
00061 {}
00062
00064 virtual ~BignumNullException() {}
00065
00066 protected :
00067 void derivedMsg() const;
00068 };
00069
00076 class BignumMathException : public BignumException
00077 {
00078 public :
00080 BignumMathException( const string& fname, int line );
00081
00083 virtual ~BignumMathException() {}
00084
00086 unsigned long error() const { return m_error; }
00087
00088 protected :
00090 unsigned long m_error;
00091 };
00092
00094 class BignumModException : public BignumMathException
00095 {
00096 public :
00098 BignumModException( const string& fname, int line ) :
00099 BignumMathException( fname, line )
00100 {}
00101
00103 virtual ~BignumModException() {}
00104
00105 protected :
00106 void derivedMsg() const;
00107 };
00108
00110 class BignumMulException : public BignumMathException
00111 {
00112 public :
00114 BignumMulException( const string& fname, int line ) :
00115 BignumMathException( fname, line )
00116 {}
00117
00119 virtual ~BignumMulException() {}
00120
00121 protected :
00122 void derivedMsg() const;
00123 };
00124
00126 class BignumModMulException : public BignumMathException
00127 {
00128 public :
00130 BignumModMulException( const string& fname, int line ) :
00131 BignumMathException( fname, line )
00132 {}
00133
00135 virtual ~BignumModMulException() {}
00136
00137 protected :
00138 void derivedMsg() const;
00139 };
00140
00142 class BignumModExpException : public BignumMathException
00143 {
00144 public :
00146 BignumModExpException( const string& fname, int line ) :
00147 BignumMathException( fname, line )
00148 {}
00149
00151 virtual ~BignumModExpException() {}
00152
00153 protected :
00154 void derivedMsg() const;
00155 };
00156
00158 class BignumModInverseException : public BignumMathException
00159 {
00160 public :
00162 BignumModInverseException( const string& fname, int line ) :
00163 BignumMathException( fname, line )
00164 {}
00165
00167 virtual ~BignumModInverseException() {}
00168
00169 protected :
00170 void derivedMsg() const;
00171 };
00172
00174 class BignumAddException : public BignumMathException
00175 {
00176 public :
00178 BignumAddException( const string& fname, int line ) :
00179 BignumMathException( fname, line )
00180 {}
00181
00183 virtual ~BignumAddException() {}
00184
00185 protected :
00186 void derivedMsg() const;
00187 };
00188
00190 class BignumSubException : public BignumMathException
00191 {
00192 public :
00194 BignumSubException( const string& fname, int line ) :
00195 BignumMathException( fname, line )
00196 {}
00197
00199 virtual ~BignumSubException() {}
00200
00201 protected :
00202 void derivedMsg() const;
00203 };
00204
00206 class BignumRshiftException : public BignumMathException
00207 {
00208 public :
00210 BignumRshiftException( const string& fname, int line ) :
00211 BignumMathException( fname, line )
00212 {}
00213
00215 virtual ~BignumRshiftException() {}
00216
00217 protected :
00218 void derivedMsg() const;
00219 };
00220
00222 class BignumLshiftException : public BignumMathException
00223 {
00224 public :
00226 BignumLshiftException( const string& fname, int line ) :
00227 BignumMathException( fname, line )
00228 {}
00229
00231 virtual ~BignumLshiftException() {}
00232
00233 protected :
00234 void derivedMsg() const;
00235 };
00236
00238 class BignumRandRangeException : public BignumMathException
00239 {
00240 public :
00242 BignumRandRangeException( const string& fname, int line ) :
00243 BignumMathException( fname, line )
00244 {}
00245
00247 virtual ~BignumRandRangeException() {}
00248
00249 protected :
00250 void derivedMsg() const;
00251 };
00252
00254 class BignumGCDException : public BignumMathException
00255 {
00256 public :
00258 BignumGCDException( const string& fname, int line ) :
00259 BignumMathException( fname, line )
00260 {}
00261
00263 virtual ~BignumGCDException() {}
00264
00265 protected :
00266 void derivedMsg() const;
00267 };
00268
00270 class BignumGeneratePrimeException : public BignumMathException
00271 {
00272 public :
00274 BignumGeneratePrimeException( const string& fname, int line ) :
00275 BignumMathException( fname, line )
00276 {}
00277
00279 virtual ~BignumGeneratePrimeException() {}
00280
00281 protected :
00282 void derivedMsg() const;
00283 };
00284
00288 class BignumContextException : public BignumException
00289 {
00290 public :
00292 BignumContextException( const string& fname, int line ) :
00293 BignumException( fname, line )
00294 {}
00295
00297 virtual ~BignumContextException() {}
00298
00299 protected :
00300 void derivedMsg() const;
00301 };
00302
00306 class BignumBin2BNException : public BignumException
00307 {
00308 public :
00310 BignumBin2BNException( const string& fname, int line ) :
00311 BignumException( fname, line )
00312 {}
00313
00315 virtual ~BignumBin2BNException() {}
00316
00317 protected :
00318 void derivedMsg() const;
00319 };
00320
00324 class BignumSetWordException : public BignumException
00325 {
00326 public :
00328 BignumSetWordException( const string& fname, int line ) :
00329 BignumException( fname, line )
00330 {}
00331
00333 virtual ~BignumSetWordException() {}
00334
00335 protected :
00336 void derivedMsg() const;
00337 };
00338 }
00339
00340 #endif