Common/vtkLargeInteger.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00033 #ifndef __vtkLargeInteger_h
00034 #define __vtkLargeInteger_h
00035
00036 #include "vtkObject.h"
00037
00038 class VTK_COMMON_EXPORT vtkLargeInteger
00039 {
00040 public:
00041 vtkLargeInteger(void);
00042 vtkLargeInteger(long n);
00043 vtkLargeInteger(unsigned long n);
00044 vtkLargeInteger(int n);
00045 vtkLargeInteger(unsigned int n);
00046 vtkLargeInteger(const vtkLargeInteger& n);
00047 ~vtkLargeInteger(void);
00048
00049 char CastToChar(void) const;
00050 short CastToShort(void) const;
00051 int CastToInt(void) const;
00052 long CastToLong(void) const;
00053 unsigned long CastToUnsignedLong(void) const;
00054
00055 int IsEven(void) const;
00056 int IsOdd(void) const;
00057 int GetLength(void) const;
00058 int GetBit(unsigned int p) const;
00059 int IsZero() const;
00060 int GetSign(void) const;
00061
00062 void Truncate(unsigned int n);
00063 void Complement(void);
00064
00065 int operator==(const vtkLargeInteger& n) const;
00066 int operator!=(const vtkLargeInteger& n) const;
00067 int operator<(const vtkLargeInteger& n) const;
00068 int operator<=(const vtkLargeInteger& n) const;
00069 int operator>(const vtkLargeInteger& n) const;
00070 int operator>=(const vtkLargeInteger& n) const;
00071
00072 vtkLargeInteger& operator=(const vtkLargeInteger& n);
00073 vtkLargeInteger& operator+=(const vtkLargeInteger& n);
00074 vtkLargeInteger& operator-=(const vtkLargeInteger& n);
00075 vtkLargeInteger& operator<<=(int n);
00076 vtkLargeInteger& operator>>=(int n);
00077 vtkLargeInteger& operator++(void);
00078 vtkLargeInteger& operator--(void);
00079 vtkLargeInteger operator++(int);
00080 vtkLargeInteger operator--(int);
00081 vtkLargeInteger& operator*=(const vtkLargeInteger& n);
00082 vtkLargeInteger& operator/=(const vtkLargeInteger& n);
00083 vtkLargeInteger& operator%=(const vtkLargeInteger& n);
00084
00085 vtkLargeInteger& operator&=(const vtkLargeInteger& n);
00086 vtkLargeInteger& operator|=(const vtkLargeInteger& n);
00087 vtkLargeInteger& operator^=(const vtkLargeInteger& n);
00088
00089 vtkLargeInteger operator+(const vtkLargeInteger& n) const;
00090 vtkLargeInteger operator-(const vtkLargeInteger& n) const;
00091 vtkLargeInteger operator*(const vtkLargeInteger& n) const;
00092 vtkLargeInteger operator/(const vtkLargeInteger& n) const;
00093 vtkLargeInteger operator%(const vtkLargeInteger& n) const;
00094
00095 vtkLargeInteger operator&(const vtkLargeInteger& n) const;
00096 vtkLargeInteger operator|(const vtkLargeInteger& n) const;
00097 vtkLargeInteger operator^(const vtkLargeInteger& n) const;
00098 vtkLargeInteger operator<<(int n) const;
00099 vtkLargeInteger operator>>(int n) const;
00100
00101 friend ostream& operator<<(ostream& s, const vtkLargeInteger& n);
00102 friend istream& operator>>(istream& s, vtkLargeInteger& n);
00103
00104 private:
00105 char* Number;
00106 int Negative;
00107 unsigned int Sig;
00108 unsigned int Max;
00109
00110
00111 int IsSmaller(const vtkLargeInteger& n) const;
00112 int IsGreater(const vtkLargeInteger& n) const;
00113 void Expand(unsigned int n);
00114 void Contract();
00115 void Plus(const vtkLargeInteger& n);
00116 void Minus(const vtkLargeInteger& n);
00117 };
00118
00119 #endif
00120
00121