00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00032 #ifndef _CASNUMERIC_H
00033 #define _CASNUMERIC_H
00034
00035 #ifdef HAVE_CONFIG_H
00036 #include "config.h"
00037 #endif
00038
00039 #include "casobject.h"
00040 #include "castype.h"
00041
00057 enum signedness {Positive = 0, Negative = 1};
00058
00065 class CASNumeric : public CASObject {
00066 private:
00072 bool negative;
00078 unsigned long radix;
00079
00087 unsigned long div_depth;
00088
00089 public:
00096 inline CASNumeric() : negative ( false ), radix ( 10 ), div_depth ( 10 ) {
00097 meta.SetPureNumerical();
00098 meta.SetSingleValue();
00099 };
00109 inline CASNumeric ( bool n ) : negative ( n ), radix ( 10 ), div_depth ( 10 ) {
00110 meta.SetPureNumerical();
00111 meta.SetSingleValue();
00112 };
00123 inline CASNumeric ( bool n, unsigned long r ) : negative ( n ), radix ( r ), div_depth ( 10 ) {
00124 meta.SetPureNumerical();
00125 meta.SetSingleValue();
00126 };
00135 inline CASNumeric ( unsigned long r ) : negative ( false ), radix ( r ), div_depth ( 10 ) {
00136 meta.SetPureNumerical();
00137 meta.SetSingleValue();
00138 };
00147 inline bool IsNegative() const { return negative; }
00156 inline bool IsPositive() const { return !negative; }
00164 inline void SetNegative() { negative = true; }
00172 inline void SetPositive() { negative = false; }
00176 void SetSign ( signedness s );
00180 signedness GetSign() const;
00181
00191 inline void SetDivDepth ( unsigned long d ) { div_depth = d; }
00200 inline unsigned long GetDivDepth() const { return div_depth; }
00210 inline void SetRadix ( unsigned long r ) { radix = r; }
00219 inline unsigned long GetRadix() const { return radix; }
00220
00228 inline void AbsoluteIP() { negative = false; }
00236 inline void InvertIP() { negative = !negative; };
00237
00243 inline virtual ~CASNumeric() {};
00244
00245 };
00246
00251 #endif