00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __CODEX_EXCEPTIONS_BIGNUMEXCEPTIONS_H__
00019 #define __CODEX_EXCEPTIONS_BIGNUMEXCEPTIONS_H__
00020
00021 #include "ExceptionBase.h"
00022
00023 namespace CODEX_Exceptions
00024 {
00028 class BignumException : public ExceptionBase
00029 {
00030 public :
00032 BignumException( const string& fname, int line ) :
00033 ExceptionBase( fname, line )
00034 {}
00035
00037 virtual ~BignumException() {}
00038
00039 void report() const;
00040
00041 protected :
00046 virtual void derivedMsg() const = 0;
00047 };
00048
00052 class BignumNullException : public BignumException
00053 {
00054 public :
00056 BignumNullException( const string& fname, int line ) :
00057 BignumException( fname, line )
00058 {}
00059
00061 virtual ~BignumNullException() {}
00062
00063 protected :
00064 void derivedMsg() const;
00065 };
00066
00073 class BignumMathException : public BignumException
00074 {
00075 public :
00077 BignumMathException( const string& fname, int line );
00078
00080 virtual ~BignumMathException() {}
00081
00083 unsigned long error() const { return m_error; }
00084
00085 protected :
00087 unsigned long m_error;
00088 };
00089
00091 class BignumModException : public BignumMathException
00092 {
00093 public :
00095 BignumModException( const string& fname, int line ) :
00096 BignumMathException( fname, line )
00097 {}
00098
00100 virtual ~BignumModException() {}
00101
00102 protected :
00103 void derivedMsg() const;
00104 };
00105
00107 class BignumMulException : public BignumMathException
00108 {
00109 public :
00111 BignumMulException( const string& fname, int line ) :
00112 BignumMathException( fname, line )
00113 {}
00114
00116 virtual ~BignumMulException() {}
00117
00118 protected :
00119 void derivedMsg() const;
00120 };
00121
00123 class BignumModMulException : public BignumMathException
00124 {
00125 public :
00127 BignumModMulException( const string& fname, int line ) :
00128 BignumMathException( fname, line )
00129 {}
00130
00132 virtual ~BignumModMulException() {}
00133
00134 protected :
00135 void derivedMsg() const;
00136 };
00137
00139 class BignumModExpException : public BignumMathException
00140 {
00141 public :
00143 BignumModExpException( const string& fname, int line ) :
00144 BignumMathException( fname, line )
00145 {}
00146
00148 virtual ~BignumModExpException() {}
00149
00150 protected :
00151 void derivedMsg() const;
00152 };
00153
00155 class BignumModInverseException : public BignumMathException
00156 {
00157 public :
00159 BignumModInverseException( const string& fname, int line ) :
00160 BignumMathException( fname, line )
00161 {}
00162
00164 virtual ~BignumModInverseException() {}
00165
00166 protected :
00167 void derivedMsg() const;
00168 };
00169
00171 class BignumAddException : public BignumMathException
00172 {
00173 public :
00175 BignumAddException( const string& fname, int line ) :
00176 BignumMathException( fname, line )
00177 {}
00178
00180 virtual ~BignumAddException() {}
00181
00182 protected :
00183 void derivedMsg() const;
00184 };
00185
00187 class BignumSubException : public BignumMathException
00188 {
00189 public :
00191 BignumSubException( const string& fname, int line ) :
00192 BignumMathException( fname, line )
00193 {}
00194
00196 virtual ~BignumSubException() {}
00197
00198 protected :
00199 void derivedMsg() const;
00200 };
00201
00203 class BignumRshiftException : public BignumMathException
00204 {
00205 public :
00207 BignumRshiftException( const string& fname, int line ) :
00208 BignumMathException( fname, line )
00209 {}
00210
00212 virtual ~BignumRshiftException() {}
00213
00214 protected :
00215 void derivedMsg() const;
00216 };
00217
00219 class BignumLshiftException : public BignumMathException
00220 {
00221 public :
00223 BignumLshiftException( const string& fname, int line ) :
00224 BignumMathException( fname, line )
00225 {}
00226
00228 virtual ~BignumLshiftException() {}
00229
00230 protected :
00231 void derivedMsg() const;
00232 };
00233
00235 class BignumRandRangeException : public BignumMathException
00236 {
00237 public :
00239 BignumRandRangeException( const string& fname, int line ) :
00240 BignumMathException( fname, line )
00241 {}
00242
00244 virtual ~BignumRandRangeException() {}
00245
00246 protected :
00247 void derivedMsg() const;
00248 };
00249
00251 class BignumGCDException : public BignumMathException
00252 {
00253 public :
00255 BignumGCDException( const string& fname, int line ) :
00256 BignumMathException( fname, line )
00257 {}
00258
00260 virtual ~BignumGCDException() {}
00261
00262 protected :
00263 void derivedMsg() const;
00264 };
00265
00267 class BignumGeneratePrimeException : public BignumMathException
00268 {
00269 public :
00271 BignumGeneratePrimeException( const string& fname, int line ) :
00272 BignumMathException( fname, line )
00273 {}
00274
00276 virtual ~BignumGeneratePrimeException() {}
00277
00278 protected :
00279 void derivedMsg() const;
00280 };
00281
00285 class BignumContextException : public BignumException
00286 {
00287 public :
00289 BignumContextException( const string& fname, int line ) :
00290 BignumException( fname, line )
00291 {}
00292
00294 virtual ~BignumContextException() {}
00295
00296 protected :
00297 void derivedMsg() const;
00298 };
00299
00303 class BignumBin2BNException : public BignumException
00304 {
00305 public :
00307 BignumBin2BNException( const string& fname, int line ) :
00308 BignumException( fname, line )
00309 {}
00310
00312 virtual ~BignumBin2BNException() {}
00313
00314 protected :
00315 void derivedMsg() const;
00316 };
00317
00321 class BignumSetWordException : public BignumException
00322 {
00323 public :
00325 BignumSetWordException( const string& fname, int line ) :
00326 BignumException( fname, line )
00327 {}
00328
00330 virtual ~BignumSetWordException() {}
00331
00332 protected :
00333 void derivedMsg() const;
00334 };
00335 }
00336
00337 #endif