PIP 5.5.3
Platform-Independent Primitives
Public Member Functions | List of all members
PIBitArray Class Reference

The PIBitArray class provides an space-efficient array of bits. More...

#include <pibitarray.h>

Public Member Functions

 PIBitArray (const int &size=0)
 Constructs bit array with "size" size.
 
 PIBitArray (uchar val)
 Constructs bit array with size 8 and values from "val".
 
 PIBitArray (ushort val)
 Constructs bit array with size 16 and values from "val".
 
 PIBitArray (uint val)
 Constructs bit array with size 32 and values from "val".
 
 PIBitArray (ullong val)
 Constructs bit array with size 64 and values from "val".
 
 PIBitArray (const uchar *data, uint bytes)
 Constructs bit array with size "bytes * 8" and values from "data".
 
uint bitSize () const
 Returns a size in bits.
 
uint byteSize () const
 Returns a size in bytes.
 
PIBitArrayresize (const uint &size)
 Resize this array to "size" bits.
 
PIBitArrayclearBit (const uint &index)
 Set bit with index "index" to 0.
 
PIBitArraysetBit (const uint &index)
 Set bit with index "index" to 1.
 
PIBitArraywriteBit (const uint &index, const bool &value)
 Set bit with index "index" to "value".
 
PIBitArraywriteBit (const uint &index, const uchar &value)
 Set bit with index "index" to "value".
 
PIBitArraypush_back (const bool &value)
 Add bit with value "value" to the end of array.
 
PIBitArraypush_back (const uchar &value)
 Add bit with value "value" to the end of array.
 
PIBitArrayinsert (const uint &index, const bool &value)
 Insert bit with value "value" after "index" position.
 
PIBitArrayinsert (const uint &index, const uchar &value)
 Insert bit with value "value" after "index" position.
 
PIBitArraypush_front (const bool &value)
 Add bit with value "value" to the beginning of array.
 
PIBitArraypush_front (const uchar &value)
 Add bit with value "value" to the beginning of array.
 
PIBitArraypop_back ()
 Remove one bit from the end of array.
 
PIBitArraypop_front ()
 Remove one bit from the beginning of array.
 
PIBitArrayappend (const PIBitArray &ba)
 Add bits "ba" to the end of array.
 
uchar * data ()
 Returns pointer to bytes data of array.
 
uchar toUChar ()
 Returns data of array as uchar.
 
ushort toUShort ()
 Returns data of array as ushort.
 
uint toUInt ()
 Returns data of array as uint.
 
ullong toULLong ()
 Returns data of array as ullong.
 
bool at (const uint &index) const
 Returns bit value at index "index".
 
bool operator[] (const uint &index) const
 Returns bit value at index "index".
 
void operator+= (const PIBitArray &ba)
 Similar to append().
 
bool operator== (const PIBitArray &ba) const
 Returns if two bit arrays are similar.
 
bool operator!= (const PIBitArray &ba) const
 Returns if two bit arrays are not similar.
 
void operator= (const uchar &val)
 Resize and set values from "val".
 
void operator= (const ushort &val)
 Resize and set values from "val".
 
void operator= (const uint &val)
 Resize and set values from "val".
 
void operator= (const ullong &val)
 Resize and set values from "val".
 

Detailed Description

The PIBitArray class provides an space-efficient array of bits.