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