// file: $isip/class/math/scalar/Ullong/Ullong.h
// version: $Id: Ullong.h 10636 2007-01-26 22:18:09Z tm334 $
//

// make sure definitions are only made once
//
#ifndef ISIP_ULLONG
#define ISIP_ULLONG

// isip include files
//
#ifndef ISIP_SCALAR
#include <MScalar.h>
#endif

// Ullong: a class manages the a 64-bit unsigned integer. this class mainly
// inherits the MScalar template functionality. we only need to add Sof file
// support and memory management
//
class Ullong : public MScalar<ullong, uint64> {

  //---------------------------------------------------------------------------
  //
  // public constants
  //
  //---------------------------------------------------------------------------
public:

  // define the class name
  //
  static const String CLASS_NAME;

  //----------------------------------------
  //
  // other important constants
  //
  //----------------------------------------
  
  //----------------------------------------
  //
  // default arguments and values
  //
  //----------------------------------------  

  // define the default value(s) of the class data
  //
  
  // default arguments to methods
  //
  
  //----------------------------------------
  //
  // error codes
  //
  //----------------------------------------  

  static const long ERR = 20600;

  //---------------------------------------------------------------------------
  //
  // 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
  //
  ~Ullong() {}

  // method: default constructor
  //
  Ullong(ullong arg = DEF_VALUE) {
    value_d = arg;
  }

  // method: copy constructor
  //
  Ullong(const Ullong& arg) {
    assign(arg.value_d);
  }

  // assign methods:
  //  these methods are inherited from the MScalar template class
  //

  // method: operator=
  //
  Ullong& operator= (const Ullong& arg) {
    assign(arg);
    return *this;
  }
    
  // i/o methods:
  //  the 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 MScalar<ullong, uint64>::read(sof, tag, name);
  }

  // method: write
  //
  boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const {
    return MScalar<ullong, uint64>::write(sof, tag, name);
  }  

  // equality methods:
  //  the equality methods are 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:
  //  these methods are inherited from the MScalar template class
  //
  
  //---------------------------------------------------------------------------
  //
  // class-specific public methods
  //
  //---------------------------------------------------------------------------
public:
  
  // method: operator=
  //
  Ullong& operator= (ullong arg) {
    value_d = arg;
    return *this;
  }

  // method: operator %
  //
  ullong operator% (ullong arg) const {
    return value_d % arg;
  }

  // method: operator %=
  //
  Ullong& operator%= (ullong arg) {
    value_d %= arg;
    return *this;
  }

  // method: mod
  //
  ullong mod(ullong arg2) {
    return mod(value_d, arg2);
  }

  // method: mod
  //
  ullong mod(ullong arg1, ullong arg2) {
    return (value_d = arg1 % arg2);
  }

  // method: band
  //
  ullong band(ullong arg) {
    return band(value_d, arg);
  }

  // method: band
  //
  ullong band(ullong arg1, ullong arg2) {
    return (value_d = (arg1 & arg2));
  }

  // method: bor
  //
  ullong bor(ullong arg) {
    return bor(value_d, arg);
  }

  // method: bor
  //
  ullong bor(ullong arg1, ullong arg2) {
    return (value_d = (arg1 | arg2));
  }

  // method: bxor
  //
  ullong bxor(ullong arg) {
    return bxor(value_d, arg);
  }

  // method: bxor
  //
  ullong bxor(ullong arg1, ullong arg2) {
     return (value_d = (arg1 ^ arg2));
  }

  // method: brs
  //
  ullong brs(ullong incr) {
    return brs(value_d, incr);
  }

  // method: brs
  //
  ullong brs(ullong arg, ullong incr) {
    return (value_d = (arg >> incr));
  }

  // method: bls
  //
  ullong bls(ullong incr) {
    return bls(value_d, incr);
  }

  // method: bls
  //
  ullong bls(ullong arg, ullong incr) {
    return (value_d = (arg << incr));
  }

  // method: bcmpl
  //
  ullong bcmpl() {
    return bcmpl(value_d);
  }

  // method: bcmpl
  //
  ullong bcmpl(ullong arg) {
    return (value_d = (~arg));
  }

  ullong acos(ullong arg) {
    return (ullong) 0;
  }
  ullong acosh(ullong arg) {
    return (ullong) 0;
  }
  ullong asin(ullong arg) {
    return (ullong) 0;
  }
  ullong asinh(ullong arg) {
    return (ullong) 0;
  }
  ullong atan(ullong arg) {
    return (ullong) 0;
  }
  ullong atanh(ullong arg) {
    return (ullong) 0;
  }
  ullong cos(ullong arg) {
    return (ullong) 0;
  }
  ullong cosh(ullong arg) {
    return (ullong) 0;
  }
  ullong sin(ullong arg) {
    return (ullong) 0;
  }
  ullong sinh(ullong arg) {
    return (ullong) 0;
  }
  ullong tan(ullong arg) {
    return (ullong) 0;
  }
  ullong tanh(ullong arg) {
    return (ullong) 0;
  }
  ullong abs(ullong arg) {
    return (ullong) 0;
  }
  ullong neg(ullong arg) {
    return (ullong) 0;
  }
  ullong sign(ullong arg) {
    return (ullong) 0;
  }
  ullong ceil(ullong arg) {
    return (ullong) 0;
  }
  ullong rceil(ullong arg) {
    return (ullong) 0;
  }
  ullong rfloor(ullong arg) {
    return (ullong) 0;
  }
  ullong round(ullong arg) {
    return (ullong) 0;
  }
  ullong floor(ullong arg) {
    return (ullong) 0;
  }

  //---------------------------------------------------------------------------
  //
  // private methods
  //
  //---------------------------------------------------------------------------
private:

/*   //declare trigonometric methods as private because they cannot be */
/*   //defined for Ullong operations */
/*   // */
/*   ullong acos(ullong); */
/*   ullong acosh(ullong); */
/*   ullong asin(ullong); */
/*   ullong asinh(ullong); */
/*   ullong atan(ullong); */
/*   ullong atanh(ullong); */
/*   ullong cos(ullong); */
/*   ullong cosh(ullong); */
/*   ullong sin(ullong); */
/*   ullong sinh(ullong); */
/*   ullong tan(ullong); */
/*   ullong tanh(ullong); */
  
/*   //declare those methods as private which cannot be defined for */
/*   //unsigned numbers */
/*   // */
/*   ullong abs(ullong); */
/*   ullong neg(ullong); */
/*   ullong sign(ullong); */

/*   //declare those methods as private which cannot be defined for */
/*   //integer numbers */
/*   //   */
/*   ullong ceil(ullong); */
/*   ullong rceil(ullong); */
/*   ullong rfloor(ullong); */
/*   ullong round(ullong); */
/*   ullong floor(ullong); */

};

// end of include file
//
#endif
