Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

AxPipe::Stock::TBits< iBits > Class Template Reference

A template class for hashes of various kinds. More...

#include <TBits.h>

List of all members.

Public Member Functions

 TBits ()
 Construct zero-initialized.

 TBits (unsigned char *bpInit, int cb)
 Byte-string initialized.

void * GetLeft (const int n)
 Get the n left-most bits (most significant).

void * GetRight (const int n)
 Get the n right-most bits (least significant).

TBitsoperator+= (const TBits &rhs)
 Do long addition of two bit blocks.

TBitsoperator^= (const TBits &rhs)
 Do long xor of two bit blocks.

TBitsoperator= (const TBits &rhs)
 Assign one to another.


Private Attributes

unsigned char m_Bits [iBits/8]
 The bits. Yes, I know a char needn't be 8 bits.


Detailed Description

template<int iBits>
class AxPipe::Stock::TBits< iBits >

A template class for hashes of various kinds.

Encapsulate common properities of hashes, mostly just for notational convenience.

Definition at line 42 of file TBits.h.


Constructor & Destructor Documentation

template<int iBits>
AxPipe::Stock::TBits< iBits >::TBits  ) 
 

Construct zero-initialized.

Zero-initialize the Bit buffer

Definition at line 48 of file TBits.cpp.

template<int iBits>
AxPipe::Stock::TBits< iBits >::TBits unsigned char *  bpInit,
int  cb
 

Byte-string initialized.

If shorter, pad on the right, i.e. with the Least Signifcant Bytes (sic!)

Parameters:
bpInit Pointer to a sequence of bytes to initalize with
cb Number of bytes in the init sequence (to use)

Definition at line 56 of file TBits.cpp.


Member Function Documentation

template<int iBits>
void * AxPipe::Stock::TBits< iBits >::GetLeft const int  n  ) 
 

Get the n left-most bits (most significant).

Get the left-most n bits. This is actually sort of a dummy function, as we return a pointer, and the left-most always start at the beginning of the byte buffer where the bits are.

Parameters:
n The number of bits to get.
Returns:
A pointer to the left-most n bits of the buffer.

Definition at line 67 of file TBits.cpp.

References AxPipe::Stock::TBits< iBits >::m_Bits.

template<int iBits>
void * AxPipe::Stock::TBits< iBits >::GetRight const int  n  ) 
 

Get the n right-most bits (least significant).

Get the right-most n bits. Assume that this is a multiple by 8 value, otherwise the function fails silently.

Returns:
A pointer to the right-most n bits of the buffer.

Definition at line 75 of file TBits.cpp.

References AxPipe::Stock::TBits< iBits >::m_Bits.

template<int iBits>
TBits< iBits > & AxPipe::Stock::TBits< iBits >::operator+= const TBits< iBits > &  rhs  ) 
 

Do long addition of two bit blocks.

Arbitrary precision add, endian independent, inefficient... Note that the byte arrays is presumed to be stored big-endian!

Parameters:
rhs A TBits
Returns:
A reference to the destination result, as it should.

Definition at line 84 of file TBits.cpp.

References AxPipe::Stock::TBits< iBits >::m_Bits.

template<int iBits>
TBits< iBits > & AxPipe::Stock::TBits< iBits >::operator= const TBits< iBits > &  rhs  ) 
 

Assign one to another.

Copy-Assign

Parameters:
rhs A TBits
Returns:
A reference to the destination result, as it should.

Definition at line 110 of file TBits.cpp.

References AxPipe::Stock::TBits< iBits >::m_Bits.

template<int iBits>
TBits< iBits > & AxPipe::Stock::TBits< iBits >::operator^= const TBits< iBits > &  rhs  ) 
 

Do long xor of two bit blocks.

Arbitrary precision XOR, inefficient. Don't use if you're in a hurry.

Parameters:
rhs A TBits
Returns:
A reference to the destination result, as it should.

Definition at line 96 of file TBits.cpp.

References AxPipe::Stock::TBits< iBits >::m_Bits.


The documentation for this class was generated from the following files:
Generated on Mon Feb 2 13:19:30 2004 for AxPipe by doxygen 1.3.5