BCD
 All Classes Files Functions Variables Typedefs Macros
BCD Class Reference

Public Member Functions

 BCD (int n=0, int nMax=BLKSIZE)
 create a BCD object. More...
 
 BCD (const BCD &r)
 
 ~BCD ()
 
int getSize () const
 
int getMaxSize () const
 
void addDigit (T n)
 
int toInt ()
 
char * toString ()
 
int trailingZeros ()
 
BCDoperator= (const BCD &s)
 
bool isZero () const
 
int sumDigits () const
 
BCDrationalize ()
 
Toperator[] (int index)
 
T operator[] (int index) const
 

Protected Attributes

int nDigits
 
int nMaxDigits
 
int nValue
 
TpDigits
 
char * pCharRep
 

Detailed Description

BCD class implements a BCD number. This can be any number of digits in length. The maxdigits specifies how much room is currently available in the object but the object autogrows (it does not autoshrink)

Constructor & Destructor Documentation

BCD::BCD ( int  n = 0,
int  nMax = BLKSIZE 
)
inline

create a BCD object.

Parameters
0int n= the initial value of the object
BLKSIZEint nMax= the number of digits to allocate space for
BCD::BCD ( const BCD r)
inline
BCD::~BCD ( )
inline

Member Function Documentation

void BCD::addDigit ( T  n)
inline
int BCD::getMaxSize ( ) const
inline
int BCD::getSize ( ) const
inline
bool BCD::isZero ( ) const
inline
BCD& BCD::operator= ( const BCD s)
inline
T& BCD::operator[] ( int  index)
inline
T BCD::operator[] ( int  index) const
inline
BCD& BCD::rationalize ( )
inline
int BCD::sumDigits ( ) const
inline
int BCD::toInt ( )
inline
char* BCD::toString ( )
inline
int BCD::trailingZeros ( )
inline

Member Data Documentation

int BCD::nDigits
protected

The number of digits in the number.

int BCD::nMaxDigits
protected

The number of digits that this object has room for.

int BCD::nValue
protected

integer equivalent; only used when debugging.

char* BCD::pCharRep
protected

used to store the character representation created by toString().

T* BCD::pDigits
protected

A pointer to the BCD digits. Store LSD first.


The documentation for this class was generated from the following file: