LargeInteger.h

00001 /*
00002 * Neural Networks Tearm Project
00003 * Martin Johne
00004 * 04.10.2006
00005 */
00006 #pragma once
00007 
00009 class CLargeInteger
00010 {
00011 public:
00012         // construktors
00013         CLargeInteger(unsigned short sizeInBytes);
00014         CLargeInteger(unsigned long initialValue, unsigned short sizeInBytes);
00015          // copie constructor
00016         CLargeInteger(const CLargeInteger &copy);
00017 
00018         // destrucktor
00019         ~CLargeInteger(void);
00020 
00021         // different methods
00022         const char* toString();
00023         const char* toHexString();
00024         const char* toBinString();
00025         // intern division function
00026         // devides the number and returns the modulo
00027         unsigned short divideAndGiveCarry(unsigned short divisor);
00028         CLargeInteger pow(CLargeInteger &base, unsigned long exponent);
00029         void pow(unsigned long exponent);
00030         void setZero();
00031         void shiftLeftMax16(unsigned shift);
00032         void shiftRightMax16(unsigned shift);
00033 
00034 
00035 
00036 public:
00037         // overloaded operators */
00038         //bool operator == (const CLargeInteger &number);
00039         bool operator == (const unsigned short number);
00040         //bool operator == (const unsigned long number);
00041         bool operator > (const CLargeInteger &compareLarger);
00042         bool operator < (const CLargeInteger &compareSmaller);
00043         
00044         CLargeInteger& operator = (const CLargeInteger &assign);
00045         CLargeInteger& operator = (const unsigned long assign);
00046 
00047         CLargeInteger  operator +  (const CLargeInteger &add);
00048         CLargeInteger  operator +  (const unsigned long add);
00049         CLargeInteger& operator += (const CLargeInteger &add);
00050         CLargeInteger& operator += (const unsigned long add);
00051         CLargeInteger& operator ++ (void);
00052 
00053 
00054 
00055         
00056 //      template<class T> T operator++(T x, int) {return x++;}
00057         
00058         CLargeInteger  operator * (const CLargeInteger &mul);
00059         //CLargeInteger  operator * (unsigned long mul);
00060         CLargeInteger& operator *= (const CLargeInteger &mul);
00061         //CLargeInteger& operator *= (unsigned long mul);
00062         
00063         CLargeInteger  operator / (const CLargeInteger &div);
00064         //CLargeInteger  operator / (unsigned long div);
00065         //CLargeInteger& operator /= (const CLargeInteger &div);
00066         //CLargeInteger& operator /= (unsigned long div);
00067 
00068         CLargeInteger  operator ^  (long exponent);
00069         CLargeInteger& operator ^= (long exponent);
00070         
00071 
00072 
00073 
00074 private:
00075         char negative;
00076         unsigned short *pNumber;
00077         unsigned short sizeShorts; // number of shorts the Number uses
00078         char *pOutString; // takes the Number as String when requested
00079 };

Generated on Mon Jan 22 02:40:27 2007 for muele by  doxygen 1.4.7