// file: $isip/class/math/scalar/Long/Long.h // version: $Id: Long.h,v 1.2 1999/05/18 01:49:50 duncan Exp $ // // make sure definitions are only made once // #ifndef ISIP_LONG #define ISIP_LONG // isip include files // #ifndef ISIP_STRING #include #endif // forward class definitions // class Boolean; class Byte; class Ushort; class Ulong; class Ullong; class Short; class Long; class Llong; class Float; class Double; // Long: default integer type // class Long { //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: long value_d; //--------------------------------------------------------------------------- // // public methods // //--------------------------------------------------------------------------- public: // required static methods: // static String& name(); static boolean diagnose(long debug_level); // required methods: // boolean debug(unichar* message); long size(); // initialization and release methods. init() is called at the // beginning of the constructor, release() in the destructor. these // methods allow for external methods to effectively construct or // delete objects, useful for inheritance and block memory // management. // boolean init(); boolean release(); // destructor/constructor(s) // ~Long(); Long(); Long(Long& arg); Long(long arg); // i/o methods // boolean get(Sof& sof, String& name, long tag); boolean get(Sof& sof, long tag); boolean put(Sof& sof, String& name, long tag); boolean put(Sof& sof, long tag); boolean read(Sof& sof, String& pname, long size = SofParser::FULL_OBJECT); boolean read(Sof& sof, long size = SofParser::FULL_OBJECT); boolean write(Sof& sof, String& pname); boolean write(Sof& sof); // inline methods // inline operator long() { return value_d; } inline Long& operator= (long arg) { value_d = arg; return *this; } // get methods // boolean get(Byte& arg); boolean get(byte& arg); boolean get(Ushort& arg); boolean get(ushort& arg); boolean get(Ulong& arg); boolean get(ulong& arg); boolean get(Ullong& arg); boolean get(ullong& arg); boolean get(Short& arg); boolean get(short& arg); boolean get(Long& arg); boolean get(long& arg); boolean get(Llong& arg); boolean get(llong& arg); boolean get(Float& arg); boolean get(float& arg); boolean get(Double& arg); boolean get(double& arg); boolean get(String& arg); // assignment methods // boolean assign(boolean arg); boolean assign(byte arg); boolean assign(ushort arg); boolean assign(ulong arg); boolean assign(ullong arg); boolean assign(short arg); boolean assign(long arg); boolean assign(llong arg); boolean assign(float arg); boolean assign(double arg); boolean assign(String& arg); // accumulative operators // Long& operator+= (long arg); Long& operator-= (long arg); Long& operator*= (long arg); Long& operator/= (long arg); Long& operator%= (long arg); // mathematical functions // long log(); long log(long arg); long log2(); long log2(long arg); long log10(); long log10(long arg); long exp(); long exp(long arg); long exp2(); long exp2(long arg); long exp10(); long exp10(long arg); long min(long arg); long min(long arg_1, long arg_2); long max(long arg); long max(long arg_1, long arg_2); long abs(); long abs(long arg); long sign(); long sign(long arg); long factorial(); long factorial(long arg); // useful for DSP // long limit(long min, long max); long limit(long min, long max, long val); long limitHard(long thresh, long new_val); long limitHard(long thresh, long new_val, long arg); long centerClip(long min, long max); long centerClip(long min, long max, long arg); // random number generation // boolean randSeed(long seedval = Integral::RANDSEED); long rand(long min, long max); long rand(long max); long grand(long mean, long stddev); //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: //--------------------------------------------------------------------------- // // public constants // //--------------------------------------------------------------------------- public: // define the class name // static const unichar CLASS_NAME[] = L"Long"; //---------------------------------------- // // io related variables // //---------------------------------------- static const unichar DEF_PARAM[] = L"value"; //---------------------------------------- // // default values and arguments // //---------------------------------------- // default arguments to methods // static const long NEGATIVE = (long)-1; static const long POSITIVE = (long)1; // define the default value(s) of the class data // static const long DEF_VALUE = (long)0; static const long DEF_RAND_MIN = (long)0; //---------------------------------------- // // error codes // //---------------------------------------- static const long ERR = (long)20600; }; // end of include file // #endif