|
|
// Integer - ColdStore interface to 32 bit integer type // Copyright (C) 1998,1999 Colin McCormack, // see LICENSE (MD5 f5220f8f599e5e926f37cf32efe3ab68) for terms // $Id: Integer_hh.html,v 1.1.1.1 2000/04/09 01:07:51 skeptopotamus Exp $ #ifndef INTEGER_HH #define INTEGER_HH class iPool; // opaque type for cells of pools struct PoolCell; // opaque type for cells of pools /** Pool allocated 32 bit signed integers */ class Integer : public Data { protected: /** the 32 bit signed integer value of this Integer */ long _value; /** set of all iPool */ static iPool **_pool; friend class iPool; /** _home - in which PoolCell were we allocated? */ PoolCell *_home; public: Integer(long value = 0, PoolCell *home = NULL); Integer(const Slot &init); virtual ~Integer(); static Integer *getInteger(long value = 0); /** C++ object Pool deletion @arg ptr a pointer returned by @see operator new() @arg extra extra allocation in bytes @arg where neighborhood into which to allocate @returns storage allocated as requested */ void operator delete(void* ptr); long operator = (long value); long value(); // structural virtual Data *clone(void * = 0) const; virtual void check(int=0) const; // check an instance of Data // object virtual bool truth() const; // the object's truth value virtual Slot toconstruct() const; // constructor args to recreate object virtual ostream &dump(ostream& out) const; // dump the object static Slot construct(Slot &arg); // construct from constructor args virtual int order(const Slot &arg) const; // 1,0,-1 depending on order virtual bool equal(const Slot &arg) const; // equality predicate // arithmetic virtual Slot positive(); // monadic `+', absolute value virtual Slot negative(); // monadic `-', negative absolute value virtual Slot add(const Slot &arg); // dyadic `+', add virtual Slot subtract(const Slot &arg); // dyadic `-', subtract virtual Slot multiply(const Slot &arg); // dyadic `*', multiply virtual Slot divide(const Slot &arg); // dyadic '/', divide virtual Slot modulo(const Slot &arg); // dyadic '%', modulo // bitwise virtual Slot invert(); // unary '~', invert virtual Slot and(const Slot &arg); // dyadic '&', bitwise and virtual Slot xor(const Slot &arg); // dyadic '^', bitwise xor virtual Slot or(const Slot &arg); // dyadic '|', bitwise or virtual Slot lshift(const Slot &arg); // dyadic '<<', left shift virtual Slot rshift(const Slot &arg); // dyadic '>>', right shift // misc Integer transforms to implement Builtins static Integer *abs(Integer*); // abs() static Integer *random(); // rand() }; #endif // Local Variables *** // c-default-style:gnu ***
Generated by: colin@sharedtech.dhis.org on Sat Nov 6 11:59:24 199. |