📄 complexlong.h
字号:
// file: $isip/class/math/scalar/ComplexLong/ComplexLong.h// version: $Id: ComplexLong.h,v 1.6 2002/03/15 23:30:17 zheng Exp $//// make sure definitions are only made once//#ifndef ISIP_COMPLEX_LONG#define ISIP_COMPLEX_LONG// isip include files//#ifndef ISIP_MCOMPLEX_SCALAR#include <MComplexScalar.h>#endif// ComplexLong: a class that manages a complex number for which// each component is a 32-bit integer number. this class largely// inherits the MScalar template functionality.//class ComplexLong : public MComplexScalar<long, int32> { //--------------------------------------------------------------------------- // // public constants // //---------------------------------------------------------------------------public: // define the class name // static const String CLASS_NAME; //---------------------------------------- // // other important constants // //---------------------------------------- //---------------------------------------- // // default values and arguments // //---------------------------------------- // define the default value(s) of the class data // // default arguments to methods // //---------------------------------------- // // error codes // //---------------------------------------- static const long ERR = 21300; //--------------------------------------------------------------------------- // // protected data // //---------------------------------------------------------------------------protected: // static memory manager // static MemoryManager mgr_d; //--------------------------------------------------------------------------- // // required public methods // //---------------------------------------------------------------------------public: // method: name // static const String& name() { return CLASS_NAME; } // other static methods // static boolean diagnose(Integral::DEBUG debug_level); // debug methods: // the setDebug method is inherited from the MScalar template class // boolean debug(const unichar* message) const; // method: destructor // ~ComplexLong() {} // method: default constructor // ComplexLong(complexlong arg = DEF_VALUE) { value_d = arg; } // method: copy constructor // ComplexLong(const ComplexLong& arg) { assign(arg.value_d); } // assign methods: // these methods are inherited from the MComplexScalar template class // // method: operator= // ComplexLong& operator= (const ComplexLong& arg) { assign(arg); return *this; } // i/o methods: // sofSize, readData and writeData are inherited from the MScalar // template class // // method: read // boolean read(Sof& sof, long tag, const String& name = CLASS_NAME) { return MComplexScalar<long, int32>::read(sof, tag, name); } // method: write // boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const { return MComplexScalar<long, int32>::write(sof, tag, name); } // equality methods: // the eq method is inherited from the MScalar template class // // method: new // static void* operator new(size_t size) { return mgr_d.get(); } // method: new[] // static void* operator new[](size_t size) { return mgr_d.getBlock(size); } // method: delete // static void operator delete(void* ptr) { mgr_d.release(ptr); } // method: delete[] // static void operator delete[](void* ptr) { mgr_d.releaseBlock(ptr); } // method: setGrowSize // static boolean setGrowSize(long grow_size) { return mgr_d.setGrow(grow_size); } // other memory management methods: // these methods are inherited from the MScalar template class // //----------------------------------------------------------------------- // // class-specific public methods // //----------------------------------------------------------------------- // method: constructor // ComplexLong(long real, long imag = 0) { assign(complexlong(real, imag)); } // method: constructor // ComplexLong(unichar* arg) { assign(String(arg)); } // method: operator complexdouble() // operator complexdouble() const { return (complexdouble)value_d; } // method: operator complexfloat() // operator complexfloat() const { return (complexfloat)value_d; } //--------------------------------------------------------------------------- // // private methods // //---------------------------------------------------------------------------private: // declare bitwise methods as private member functions because they // are not defined for complex type operations // using MScalar<complexlong, int32>::bor; using MScalar<complexlong, int32>::band; using MScalar<complexlong, int32>::bxor; using MScalar<complexlong, int32>::brs; using MScalar<complexlong, int32>::bls; using MScalar<complexlong, int32>::bcmpl; // declare modulus methods as private member functions because they // are not defined for complex type operations // using MScalar<complexlong, int32>::operator%=; using MScalar<complexlong, int32>::mod;};// end of include file//#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -