ABY Framework  1.0
Arithmetic Bool Yao Framework
 All Classes Files Functions Variables Enumerations Enumerator Macros
Public Member Functions | List of all members
CBitVector Class Reference

#include <cbitvector.h>

Public Member Functions

 CBitVector ()
 
 CBitVector (uint32_t bits)
 
 CBitVector (uint32_t bits, crypto *crypt)
 
void Init ()
 
 ~CBitVector ()
 
void delCBitVector ()
 
void FillRand (uint32_t bits, crypto *crypt)
 
void Create (uint64_t bits)
 
void CreateBytes (uint64_t bytes)
 
void CreateZeros (uint64_t bits)
 
void Create (uint64_t bits, crypto *crypt)
 
void Create (uint64_t numelements, uint64_t elementlength)
 
void Create (uint64_t numelements, uint64_t elementlength, crypto *crypt)
 
void Create (uint64_t numelementsDimA, uint64_t numelementsDimB, uint64_t elementlength)
 
void Create (uint64_t numelementsDimA, uint64_t numelementsDimB, uint64_t elementlength, crypto *crypt)
 
void ResizeinBytes (int newSizeBytes)
 
void Reset ()
 
void ResetFromTo (int frombyte, int tobyte)
 
void SetToOne ()
 
int GetSize ()
 
BOOL IsEqual (CBitVector &vec)
 
BOOL IsEqual (CBitVector &vec, int from, int to)
 
void SetElementLength (int elelen)
 
uint64_t GetElementLength ()
 
void Copy (CBitVector &vec)
 
void Copy (CBitVector &vec, int pos, int len)
 
void Copy (BYTE *p, int pos, int len)
 
void XOR_no_mask (int p, int bitPos, int bitLen)
 
unsigned int GetInt (int bitPos, int bitLen)
 
void ORByte (int pos, BYTE p)
 
BYTE GetBit (int idx)
 
void SetBit (int idx, BYTE b)
 
void XORBit (int idx, BYTE b)
 
void ANDBit (int idx, BYTE b)
 
BYTE GetBitNoMask (int idx)
 
void SetBitNoMask (int idx, BYTE b)
 
void XORBitNoMask (int idx, BYTE b)
 
void ANDBitNoMask (int idx, BYTE b)
 
void SetByte (int idx, BYTE p)
 
BYTE GetByte (int idx)
 
void XORByte (int idx, BYTE b)
 
void ANDByte (int idx, BYTE b)
 
void GetBits (BYTE *p, int pos, int len)
 
void GetBytes (BYTE *p, int pos, int len)
 
template<class T >
void GetBytes (T *dst, T *src, T *lim)
 
template<class T >
Get (int pos, int len)
 
void SetBits (BYTE *p, uint64_t pos, uint64_t len)
 
void SetBits (BYTE *p, int pos, int len)
 
void SetBitsPosOffset (BYTE *p, int ppos, int pos, int len)
 
void SetBytes (BYTE *p, int pos, int len)
 
template<class T >
void SetBytes (T *dst, T *src, T *lim)
 
template<class T >
void Set (T val, int pos, int len)
 
void SetBitsToZero (int bitpos, int bitlen)
 
void XORBytes (BYTE *p, int pos, int len)
 
void XORBytes (BYTE *p, int len)
 
void XORVector (CBitVector &vec, int pos, int len)
 
template<class T >
void XOR (T val, int pos, int len)
 
void XORBits (BYTE *p, int pos, int len)
 
void XORBitsPosOffset (BYTE *p, int ppos, int pos, int len)
 
template<class T >
void XORBytes (T *dst, T *src, T *lim)
 
void XORRepeat (BYTE *p, int pos, int len, int num)
 
void XORBytesReverse (BYTE *p, int pos, int len)
 
void ANDBytes (BYTE *p, int pos, int len)
 
template<class T >
void ANDBytes (T *dst, T *src, T *lim)
 
void SetXOR (BYTE *p, BYTE *q, int pos, int len)
 
void SetAND (BYTE *p, BYTE *q, int pos, int len)
 
BYTE * GetArr ()
 
void AttachBuf (BYTE *p, int size=-1)
 
void AttachBuf (BYTE *p, uint64_t size=-1)
 
void DetachBuf ()
 
void Print (int fromBit, int toBit)
 
void PrintHex ()
 
void PrintHex (int fromByte, int toByte)
 
void PrintBinary ()
 
void PrintContent ()
 
void PrintBinaryMasked (int from, int to)
 
template<class T >
Get (int i)
 
template<class T >
void Set (T val, int i)
 
template<class T >
Get2D (int i, int j)
 
template<class T >
void Set2D (T val, int i, int j)
 
void EklundhBitTranspose (int rows, int columns)
 
void SimpleTranspose (int rows, int columns)
 

Detailed Description

Class which defines the functionality of storing C-based Bits in vector type format.

Constructor & Destructor Documentation

CBitVector::CBitVector ( )
inline

Constructor which initializes the member variables bit pointer and size to NULL and zero respectively.

CBitVector::CBitVector ( uint32_t  bits)
inline

Overloaded constructor of class CBitVector which calls internally Create(uint64_t bits)

Parameters
bits- It is the number of bits which will be used to allocate the CBitVector with. For more info on how these bits are allocated refer to Create(uint64_t bits)
CBitVector::CBitVector ( uint32_t  bits,
crypto crypt 
)
inline

Overloaded constructor of class CBitVector which calls internally Create(uint64_t bits,crypto* crypt)

Parameters
bits- It is the number of bits which will be used to allocate the CBitVector with. For more info on how these bits are allocated refer to Create(uint64_t bits,crypto* crypt)
crypt- This object from crypto class is used to generate pseudo random values for the cbitvector.
CBitVector::~CBitVector ( )
inline

Destructor which internally calls the delCBitVector for deallocating the space. This method internally calls delCBitVector().

Member Function Documentation

void CBitVector::ANDBit ( int  idx,
BYTE  b 
)
inline

This method ANDs the bit in the provided index by using the maskbits and the provided bit. The maskbits brings the concept of endianness in the vector. In this method C_MASK_BIT is used to extract and set the bits which are assumed to be organized in Little Endian form.

Parameters
idx- Bit Index which needs to be ANDed to in the CBitVector.
b- The bit which being ANDed in the provided index.
void CBitVector::ANDBitNoMask ( int  idx,
BYTE  b 
)
inline

This method ANDs the bit in the provided index without using the maskbits. The maskbits brings the concept of endianness in the vector. In this method mask bits are not used so the vector is treated in Big Endian form.

Parameters
idx- Bit Index which needs to be ANDed to in the CBitVector.
b- The bit which being ANDed in the provided index.
void CBitVector::ANDByte ( int  idx,
BYTE  b 
)
inline

This method performs AND operation at the given index in the CBitVector with a provided Byte.

Parameters
idx- Index of the byte which needs to be ANDed inside the CBitVector.
b- Byte to be ANDed with the CBitVector.
void CBitVector::ANDBytes ( BYTE *  p,
int  pos,
int  len 
)

This method performs AND operation from a given position in the CBitVector with a provided Byte Array with a length. This method internally calls ANDBytes(T* dst, T* src, T* lim).

Parameters
p- Byte Array to be ANDed with the CBitVector range.
pos- Positional offset for ANDing into current CBitVector.
len- Length or amount of values to be ANDed to the current vector from provided byte location.
template<class T >
void CBitVector::ANDBytes ( T *  dst,
T *  src,
T *  lim 
)

Generic method which is used to AND byte wise the CBitVector. This method is called from ANDBytes(BYTE* p, int pos, int len).

void CBitVector::AttachBuf ( BYTE *  p,
int  size = -1 
)
inline

This method is used to attach a new buffer into the CBitVector provided as arguments to this method.

Parameters
p- Pointer to the byte location to be attached to the CBitVector.
size- Number of bytes attached from the provided buffer.
void CBitVector::AttachBuf ( BYTE *  p,
uint64_t  size = -1 
)
inline

This method is used to attach a new buffer into the CBitVector provided as arguments to this method.

Parameters
p- Pointer to the byte location to be attached to the CBitVector.
size- Number of bytes attached from the provided buffer.
void CBitVector::Copy ( CBitVector vec)
inline

This method is used to copy the provided CBitVector to itself. It internally calls Copy(BYTE* p, int pos, int len) for copying bytewise.

Parameters
vec- The vector from which the copying needs to be performed.
void CBitVector::Copy ( CBitVector vec,
int  pos,
int  len 
)
inline

This method is used to copy the provided CBitVector to itself for a given range. It internally calls Copy(BYTE* p, int pos, int len) for copying bytewise. Copying is done in a slightly different way. Here the range is pos and len. The offset is defined for the base vector and not for the copying vector. So if the method is called as B.Copy(A,5,10) then, values of vector A will be copied from first index location for length 10 to the vector B from position 5 for length 10. Unlike copying values from 5 position in vector A to vector B for length 10.

Parameters
vec- The vector from which the copying needs to be performed.
pos- The positional offset for copying into current vector.
len- Length or amount of values to be copied to the current vector from provided vector.
void CBitVector::Copy ( BYTE *  p,
int  pos,
int  len 
)

This method is used to copy the current CBitVector with some ByteLocation with positional shift and length. This method is the base method for methods Copy(CBitVector& vec, int pos, int len) and Copy(CBitVector& vec).

Parameters
p- Pointer to the byte location to be copied to the CBitVector.
pos- Positional offset for copying into current CBitVector.
len- Length or amount of values to be copied to the current vector from provided byte location.
void CBitVector::Create ( uint64_t  bits)

This method is used to create the CBitVector with the provided bits. The method creates a bit vector with a size close to AES Bitsize. For example, if bit size provided is 110. After this method is called it will be 128 bits. It will perform a ceil of provided_bit_size to AES bit size and multiply that ceiled value with AES bits size. (For reference, AES Bit size is taken as 128 bits)

Parameters
bits- It is the number of bits which will be used to allocate the CBitVector with.
void CBitVector::Create ( uint64_t  bits,
crypto crypt 
)

This method is used to create the CBitVector with the provided bits and set them to some random values. The method creates a bit vector with a size close to AES Bitsize. And performs an assignment of random values to each bit being allocated. Internally, this method calls Create(uint64_t bits) and FillRand(uint32_t bits, crypto* crypt). Therefore, for further info please refer to the internal method provided.

Parameters
bits- It is the number of bits which will be used to allocate and assign random values of the CBitVector with.
crypt- It is the crypto class object which is used to generate random values for the bit size.
void CBitVector::Create ( uint64_t  numelements,
uint64_t  elementlength 
)

This method is used create the CBitVector with the provided number of elements and element length. This method basically creates a 1-dimensional array/vector with the provided element size and number of elements. This method internally calls Create(uint64_t bits) with arguments as elementlength*numelements.

Parameters
numelements- The number of elements in the 1-dimensional array/vector which gets created.
elementlength- The size of element in the provided cbitvector.
void CBitVector::Create ( uint64_t  numelements,
uint64_t  elementlength,
crypto crypt 
)

This method is used create the CBitVector with the provided number of elements and element length and then assign random values to them. This method basically creates a 1-dimensional array/vector with the provided element size and number of elements and assign some random values based on crypt object provided. This method internally calls Create(uint64_t bits, crypto* crypt) for creation of 1-d vector.

Parameters
numelements- The number of elements in the 1-dimensional array/vector which gets created.
elementlength- The size of element in the provided cbitvector.
crypt- It is the crypto class object which is used to generate random values for the provided bit size.
void CBitVector::Create ( uint64_t  numelementsDimA,
uint64_t  numelementsDimB,
uint64_t  elementlength 
)

This method is used create the CBitVector with the provided number of elements of 2 dimensions and element length. This method basically creates a 2-dimensional array/vector with the provided element size and number of elements in two dimensions. This method internally calls Create(uint64_t bits) with arguments as elementlength*numelementsDimA*numelementsDimB.

Parameters
numelementsDimA- The number of elements in the 1st-dimension of the 2d array/vector which gets created.
numelementsDimB- The number of elements in the 2nd-dimension of the 2d array/vector which gets created.
elementlength- The size of element in the provided cbitvector.
void CBitVector::Create ( uint64_t  numelementsDimA,
uint64_t  numelementsDimB,
uint64_t  elementlength,
crypto crypt 
)

This method is used create the CBitVector with the provided number of elements of 2 dimensions and element length, and then assign random values to them. This method basically creates a 2-dimensional array/vector with the provided element size and number of elements in two dimensions and assign some random values based on crypt object provided. This method internally calls Create(uint64_t bits, crypto* crypt).

Parameters
numelementsDimA- The number of elements in the 1st-dimension of the 2d array/vector which gets created.
numelementsDimB- The number of elements in the 2nd-dimension of the 2d array/vector which gets created.
elementlength- The size of element in the provided cbitvector.
crypt- It is the crypto class object which is used to generate random values for the provided bit size.
void CBitVector::CreateBytes ( uint64_t  bytes)
inline

This method is used to create the CBitVector with the provided byte size. The method creates a bit vector with a size close to AES Bytesize. For example, if byte size provided is 9. After this method is called it will be 16 bytes. It will perform a ceil of provided_byte_size to AES byte size and multiply that ceiled value with AES byte size. (For reference, AES Byte size is taken as 16 bytes). Internally, this method calls Create(uint64_t bits). Therefore, for further info please refer to the internal method provided.

Parameters
bits- It is the number of bits which will be used to allocate the CBitVector with.
void CBitVector::CreateZeros ( uint64_t  bits)
inline

This method is used to create the CBitVector with the provided bits and set them to value zero. The method creates a bit vector with a size close to AES Bitsize. And performs an assignment of zero to each bit being allocated. Internally, this method calls Create(uint64_t bits). Therefore, for further info please refer to the internal method provided.

Parameters
bits- It is the number of bits which will be used to allocate and assign zero values of the CBitVector with.
void CBitVector::delCBitVector ( )
inline

This method is used to deallocate the bit pointer and size explicitly. This method needs to be called by the programmer explicitly.

void CBitVector::DetachBuf ( )
inline

This method is used to detach the buffer from the CBitVector.

void CBitVector::FillRand ( uint32_t  bits,
crypto crypt 
)

This method generates random values and assigns it to the bitvector using crypto object. If the bits provided in the params are greater than the bit size of the bitvector, then the bit vector is recreated with new bit size and filled in with random values.

Parameters
bits- It is the number of bits which will be used to allocate and assign random values of the CBitVector with. For more info on how these bits are allocated refer to Create(uint64_t bits)
crypt- It is the crypto class object which is used to generate random values for the bit size.
template<class T >
T CBitVector::Get ( int  pos,
int  len 
)
inline

Generic method which performs the operation of getting values from a CBitVector for a given bit position and length. This method internally calls GetBits(BYTE* p, int pos, int len).

Parameters
pos- The positional offset in the CBitVector from which the data needs to obtained.
len- The range limit of obtaining the data from the CBitVector.
Returns
returns the value/values for the provided range.
template<class T >
T CBitVector::Get ( int  i)
inline

Generic method which provides more abstraction for getting elements in the CBitVector. It is mainly used for getting values which are 1-dimensional in nature. This method internally calls Get(int pos, int len).

Parameters
i- Index from which data needs to be fetched.
template<class T >
T CBitVector::Get2D ( int  i,
int  j 
)
inline

Generic method which provides more abstraction for getting elements in the CBitVector. It is mainly used for getting values which are 2-dimensional in nature. This method internally calls Get(int pos, int len).

Parameters
i- Row index from which the data needs to be read.
j- Column index from which the data needs to be read.
BYTE* CBitVector::GetArr ( )
inline

This method returns CBitVector in byte array format. This is very widely used method.

BYTE CBitVector::GetBit ( int  idx)
inline

This method gets the bit in the provided index by using the maskbits. The maskbits brings the concept of endianness in the vector. In this method MASK_BIT is used to extract the bits which are assumed to be organized in Little Endian form.

Parameters
idx- Bit Index which needs to be fetched from the CBitVector.
Returns
The byte which has got just the bit in it.
BYTE CBitVector::GetBitNoMask ( int  idx)
inline

This method gets the bit in the provided index without using the maskbits. The maskbits brings the concept of endianness in the vector. In this method mask bits are not used so the vector is treated in Big Endian form.

Parameters
idx- Bit Index which needs to be fetched from the CBitVector.
Returns
The byte which has got just the bit in it.
void CBitVector::GetBits ( BYTE *  p,
int  pos,
int  len 
)

This method gets elements from the CBitVector bitwise from a given offset for a given length. And stores the result in the provided byte pointer. This method is used by the generic method Get(int pos, int len)

Parameters
p- The resulting bits for the given range in the CBitVector is stored in the byte pointer p.
pos- The positional offset in the CBitVector from which the data needs to obtained.
len- The range limit of obtaining the data from the CBitVector.
BYTE CBitVector::GetByte ( int  idx)
inline

This method returns the byte at the given index in the CBitVector. Here the index is w.r.t bytes.

Parameters
idx- Index of the byte which needs to be returned from the CBitVector.
Returns
Byte is returned from CBitVector at the given index.
void CBitVector::GetBytes ( BYTE *  p,
int  pos,
int  len 
)

This method gets elements from the CBitVector bytewise from a given offset for a given length. And stores the result in the provided byte pointer.

Parameters
p- The resulting bits for the given range in the CBitVector is stored in the byte pointer p.
pos- The positional offset in the CBitVector from which the data needs to obtained.
len- The range limit of obtaining the data from the CBitVector.
template<class T >
void CBitVector::GetBytes ( T *  dst,
T *  src,
T *  lim 
)

Generic method which performs the operation of getting bytes from source for the given limit.

uint64_t CBitVector::GetElementLength ( )
inline

This method gets the element length of the CBitVector.

Returns
element length of the elements in CBitVector.
unsigned int CBitVector::GetInt ( int  bitPos,
int  bitLen 
)

Deprecated

int CBitVector::GetSize ( )
inline

This is a getter method which returns the size of the CBitVector in bytes.

Returns
the byte size of CBitVector.
void CBitVector::Init ( )
inline

Function which gets called initially when the cbitvector object is created. This method is mostly called from constructor of CBitVector class. The method sets bit pointer and size to NULL and zero respectively.

BOOL CBitVector::IsEqual ( CBitVector vec)

This method checks if two CBitVectors are equal or not.

Parameters
vec- Vector to be checked with current one for the case of equality.
Returns
boolean value which says whether it is equal or not.
BOOL CBitVector::IsEqual ( CBitVector vec,
int  from,
int  to 
)

This method checks if two CBitVectors are equal or not for a given range of bit positions.

Parameters
vec- Vector to be checked with current one for the case of equality.
from- Bit Position from which the vectors need to be checked for equality.
to- Bit Position until which the vectors need to be checked for equality.
Returns
boolean value which says whether the vectors are equal or not in the provided range of bits.
void CBitVector::ORByte ( int  pos,
BYTE  p 
)

This method performs OR operation bytewise with the current CBitVector at the provided byte position with another Byte object.

Parameters
pos- Byte position in the CBitVector which is used to perform OR operation with.
p- Byte with which the OR operation is performed to get the result.
void CBitVector::Print ( int  fromBit,
int  toBit 
)

This method prints the CBitVector bitwise for provided bit range. This method internally calls GetBitNoMask(int idx). This method is called from PrintBinary().

Parameters
fromBit- The bit from which the printing starts in a CBitVector.
toBit- The bit until which the printing in a CBitVector is done.
void CBitVector::PrintBinary ( )
inline

This method prints the CBitVector in Binary format. This method internally calls Print(int fromBit, int toBit).

void CBitVector::PrintBinaryMasked ( int  from,
int  to 
)

This method prints the CBitVector bitwise for provided bit range with mask. This method internally calls GetBit(int idx).

Parameters
fromBit- The bit from which the printing starts in a CBitVector.
toBit- The bit until which the printing in a CBitVector is done.
void CBitVector::PrintContent ( )

This method is a more abstract printing method which is used to print the CBitVector even if the vector is a simple 1 bit based vector or 1-d array/vector or even a 2-d vector/array. This method internally calls methods Get(int i) and Get2D(int i, int j).

void CBitVector::PrintHex ( )

This method prints the CBitVector in Hexadecimal format.

void CBitVector::PrintHex ( int  fromByte,
int  toByte 
)

This method prints the CBitVector in Hexadecimal format for the provided byte range.

Parameters
fromByte- The byte from which the printing of CBitVector begins.
toByte- The byte until which the printing of CBitVector is done.
void CBitVector::Reset ( )
inline

This method is used to reset the values in the given CBitVector. This method sets all bit values to zeros. This is a slight variant of the method CreateZeros(uint64_t bits). The create method mentioned above allocates and sets value to zero. Whereas the provided method only sets the value to zero.

void CBitVector::ResetFromTo ( int  frombyte,
int  tobyte 
)
inline

This method is used to reset the values in the given CBitVector for specific byte range.

Parameters
frombyte- The source byte position from which the values needs to be reset.
tobyte- The destination byte position until which the values needs to be reset to.
void CBitVector::ResizeinBytes ( int  newSizeBytes)

This method is used to resize the bytes allocated to CBitVector with newly provided size. And also accommodate the data from previous allocation to new one.

Parameters
newSizeBytes- This variable provides the new size to which the cbitvector needs to be modified to user's needs.
template<class T >
void CBitVector::Set ( val,
int  pos,
int  len 
)
inline

Generic method which performs the operation of setting values to a CBitVector for a given bit position and length. This method internally calls SetBits(BYTE* p, uint64_t pos, uint64_t len).

Parameters
pos- The positional offset in the CBitVector from which the data needs to obtained.
len- The range limit of obtaining the data from the CBitVector.
template<class T >
void CBitVector::Set ( val,
int  i 
)
inline

Generic method which provides more abstraction for setting elements in the CBitVector. It is mainly used for getting values which are 1-dimensional in nature. This method internally calls Set(int pos, int len).

Parameters
val- Value which needs to be written to the given location.
i- Index to which data needs to be written to.
template<class T >
void CBitVector::Set2D ( val,
int  i,
int  j 
)
inline

Generic method which provides more abstraction for setting elements in the CBitVector. It is mainly used for getting values which are 2-dimensional in nature. This method internally calls Set(int pos, int len).

Parameters
val- Value which needs to be written to the given location.
i- Row index from which the data needs to be written.
j- Column index from which the data needs to be written.
void CBitVector::SetAND ( BYTE *  p,
BYTE *  q,
int  pos,
int  len 
)

This method is used to set and AND a CBitVector with a byte array and then AND it with another byte array for a given range. This method internally calls Copy(BYTE* p, int pos, int len) and ANDBytes(BYTE* p, int pos, int len).

Parameters
p- Pointer to the byte location to be copied to the CBitVector.
q- Pointer to the byte location with which the CBitVector is ANDed with.
pos- Positional offset for copying and ANDing into current CBitVector.
len- Length or amount of values to be copied and ANDed to the current vector from provided byte location.
void CBitVector::SetBit ( int  idx,
BYTE  b 
)
inline

This method sets the bit in the provided index by using the maskbits and the provided bit. The maskbits brings the concept of endianness in the vector. In this method C_MASK_BIT is used to figure out the bits which are assumed to be organized in Little Endian form.

Parameters
idx- Bit Index which needs to be written to in the CBitVector.
b- The bit which being written in the provided index.
void CBitVector::SetBitNoMask ( int  idx,
BYTE  b 
)
inline

This method sets the bit in the provided index without using the maskbits. The maskbits brings the concept of endianness in the vector. In this method mask bits are not used so the vector is treated in Big Endian form.

Parameters
idx- Bit Index which needs to be written to in the CBitVector.
b- The bit which being written in the provided index.
void CBitVector::SetBits ( BYTE *  p,
uint64_t  pos,
uint64_t  len 
)

The method for setting CBitVector for a given bit range with offset and length in unsigned 64bit integer format. This method is called from SetBits(BYTE* p, int pos, int len) and Set(T val, int pos, int len).

Parameters
p- Byte array passed to be set to the current CBitVector.
pos- Positional offset in the CBitVector, where data will be set from the provided byte array.
len- The range limit of obtaining the data from the CBitVector.
void CBitVector::SetBits ( BYTE *  p,
int  pos,
int  len 
)
inline

The method for setting CBitVector for a given bit range with offset and length in simple integer format. This method internally calls SetBits(BYTE* p, uint64_t pos, uint64_t len).

Parameters
p- Byte array passed to be set to the current CBitVector.
pos- Positional offset in the CBitVector, where data will be set from the provided byte array.
len- The range limit of obtaining the data from the CBitVector.
void CBitVector::SetBitsPosOffset ( BYTE *  p,
int  ppos,
int  pos,
int  len 
)

The method for setting CBitVector for a given bit range with offsets and length with another Byte Array.

Parameters
p- Byte array passed to be set with the current CBitVector.
ppos- Positional offset in the Byte Array.
pos- Positional offset in the CBitVector, where data will be set from the provided byte array.
len- The range limit of obtaining the data from the CBitVector.
void CBitVector::SetBitsToZero ( int  bitpos,
int  bitlen 
)

This method sets the values in a given bit range to Zero in the current CBitVector.

Parameters
bitpos- Bit Positional offset in the CBitVector.
bitlen- Bit Length in the CBitVector until which the value needs to be set to zero.
void CBitVector::SetByte ( int  idx,
BYTE  p 
)
inline

This method sets a byte in a given index of the CBitVector with the provided Byte.

Parameters
idx- Index where the byte needs to be set.
p- Byte which needs to be copied to.
void CBitVector::SetBytes ( BYTE *  p,
int  pos,
int  len 
)

The method for setting CBitVector for a given byte range with offset and length. This method internally calls the method SetBytes(T* dst, T* src, T* lim).

Parameters
p- Byte array passed to be set to the current CBitVector.
pos- Positional offset in the CBitVector, where data will be set from the provided byte array.
len- The range limit of obtaining the data from the CBitVector.
template<class T >
void CBitVector::SetBytes ( T *  dst,
T *  src,
T *  lim 
)

Generic method which performs the operation of setting bytes from source for the given limit. This method is called from SetBytes(BYTE* p, int pos, int len).

void CBitVector::SetElementLength ( int  elelen)
inline

This method sets the element length of the CBitVector. It can be used to modify the object size in a CBitVector when around with the multi dimensional arrays/vectors.

Parameters
elelen- New element length which can be used to set the object size in a CBitVector.
void CBitVector::SetToOne ( )
inline

This method sets all bit position values in a CBitVector to One.

void CBitVector::SetXOR ( BYTE *  p,
BYTE *  q,
int  pos,
int  len 
)

This method is used to set and XOR a CBitVector with a byte array and then XOR it with another byte array for a given range. This method internally calls Copy(BYTE* p, int pos, int len) and XORBytes(BYTE* p, int pos, int len).

Parameters
p- Pointer to the byte location to be copied to the CBitVector.
q- Pointer to the byte location with which the CBitVector is XORed with.
pos- Positional offset for copying and XORing into current CBitVector.
len- Length or amount of values to be copied and XORed to the current vector from provided byte location.
template<class T >
void CBitVector::XOR ( val,
int  pos,
int  len 
)
inline

Generic method which is used to XOR bit wise the CBitVector. This method internally calls XORBits(BYTE* p, int pos, int len).

void CBitVector::XOR_no_mask ( int  p,
int  bitPos,
int  bitLen 
)

Deprecated

void CBitVector::XORBit ( int  idx,
BYTE  b 
)
inline

This method XORs the bit in the provided index by using the maskbits and the provided bit. The maskbits brings the concept of endianness in the vector. In this method MASK_SET_BIT is used to extract and set the bits which are assumed to be organized in Little Endian form.

Parameters
idx- Bit Index which needs to be XORed to in the CBitVector.
b- The bit which being XORed in the provided index.
void CBitVector::XORBitNoMask ( int  idx,
BYTE  b 
)
inline

This method XORs the bit in the provided index without using the maskbits. The maskbits brings the concept of endianness in the vector. In this method mask bits are not used so the vector is treated in Big Endian form.

Parameters
idx- Bit Index which needs to be XORed to in the CBitVector.
b- The bit which being XORed in the provided index.
void CBitVector::XORBits ( BYTE *  p,
int  pos,
int  len 
)

The method for XORing CBitVector for a given bit range with offset and length. This method is called from XOR(T val, int pos, int len).

Parameters
p- Byte array passed to be XORed with the current CBitVector.
pos- Positional offset in the CBitVector, where data will be XORed from the provided byte array.
len- The range limit of obtaining the data from the CBitVector.
void CBitVector::XORBitsPosOffset ( BYTE *  p,
int  ppos,
int  pos,
int  len 
)

The method for XORing CBitVector for a given bit range with offsets and length with another Byte Array.

Parameters
p- Byte array passed to be XORed with the current CBitVector.
ppos- Positional offset in the Byte Array.
pos- Positional offset in the CBitVector, where data will be XORed from the provided byte array.
len- The range limit of obtaining the data from the CBitVector.
void CBitVector::XORByte ( int  idx,
BYTE  b 
)
inline

Not Used Currently in Framework. This method performs XOR operation at the given index in the CBitVector with a provided Byte.

Parameters
idx- Index of the byte which needs to be XORed inside the CBitVector.
b- Byte to be XORed with the CBitVector.
void CBitVector::XORBytes ( BYTE *  p,
int  pos,
int  len 
)

This method performs XOR operation from a given position in the CBitVector with a provided Byte Array with a length. This method is called from XORBytes(BYTE* p, int len). This method internally calls XORBytes(T* dst, T* src, T* lim).

Parameters
p- Byte Array to be XORed with the CBitVector range.
pos- Positional offset for XORing into current CBitVector.
len- Length or amount of values to be XORed to the current vector from provided byte location.
void CBitVector::XORBytes ( BYTE *  p,
int  len 
)
inline

This method performs XOR operation for a given length in the CBitVector with a provided Byte Array. This method internally calls XORBytes(BYTE* p, int pos, int len).

Parameters
p- Byte Array to be XORed with the CBitVector range.
len- Length or amount of values to be XORed to the current vector from provided byte location.
template<class T >
void CBitVector::XORBytes ( T *  dst,
T *  src,
T *  lim 
)

Generic method which is used to XOR byte wise the CBitVector. This method is called from XORBytes(BYTE* p, int pos, int len).

void CBitVector::XORBytesReverse ( BYTE *  p,
int  pos,
int  len 
)

This method performs XOR operation from a given position in the CBitVector with a provided Byte Array with a length. The XORing is performed in a slightly different way. The byte array is reversed before it is XORed with the CBitVector. This method is called from XORBytes(BYTE* p, int len). This method internally calls XORBytes(T* dst, T* src, T* lim).

Parameters
p- Byte Array to be XORed with the CBitVector range.
pos- Positional offset for XORing into current CBitVector.
len- Length or amount of values to be XORed to the current vector from provided byte location.
void CBitVector::XORRepeat ( BYTE *  p,
int  pos,
int  len,
int  num 
)

Deprecated

void CBitVector::XORVector ( CBitVector vec,
int  pos,
int  len 
)
inline

Not Used in the Framework. This method performs XOR operation from a given position in the CBitVector with another CBitVector with a length. This method internally calls XORBytes(BYTE* p, int pos, int len).

Parameters
vec- Provided Array to be XORed with the CBitVector.
pos- Positional offset for XORing into current CBitVector.
len- Length or amount of values to be XORed to the current vector from provided byte location.

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