#include <BitString.h>
Public Member Functions | |
| BitString (EmbValue arity=2) | |
| BitString (const BitString &bs) | |
| BitString (const unsigned long l) | |
| BitString (const std::vector< BYTE > &d) | |
| BitString (const std::string &d) | |
| void | setArity (EmbValue arity) |
| EmbValue | getArity (void) const |
| UWORD32 | getLength (void) const |
| UWORD32 | getNAryLength (void) const |
| BitString & | clear (void) |
| BitString & | append (const BIT v) |
| BitString & | append (const BYTE v, const unsigned short n=8) |
| BitString & | append (const UWORD16 v, const unsigned short n=16) |
| BitString & | append (const UWORD32 v, const unsigned short n=32) |
| BitString & | append (const std::string &v) |
| BitString & | append (const std::vector< BYTE > &v) |
| BitString & | append (const BitString &v) |
| BitString & | setBit (unsigned long i, BIT v) |
| BitString | getBits (const unsigned long s, const unsigned long l) const |
| BitString | cutBits (const unsigned long s, const unsigned long l) |
| UWORD32 | getValue (const unsigned long s, const unsigned short l) const |
| const std::vector< BYTE > & | getBytes (void) const |
| BitString & | truncate (const unsigned long s, const unsigned long e) |
| BitString & | pad (const unsigned long mult, const BIT v) |
| BitString & | padRandom (const unsigned long mult) |
| BYTE | getNAry (unsigned long p) const |
| void | appendNAry (BYTE v) |
| BIT | operator[] (const unsigned long i) const |
| BitString & | operator^= (const BitString &v) |
| bool | operator== (const BitString &v) const |
| bool | operator!= (const BitString &v) const |
| void | print (unsigned short spc=0) const |
Private Member Functions | |
| void | _append (BIT v) |
| void | clearUnused (void) |
Private Attributes | |
| UWORD32 | Length |
| the number of bits in Data | |
| EmbValue | Arity |
| the arity that will be used for getLength/getNAry/appendNAry | |
| unsigned short | ArityNBits |
| the number of Bits per n-ary digit (where n is Arity) | |
| std::vector< BYTE > | Data |
| the actual data | |
For data storage a vector of BYTEs is used with little endian bit encoding, i.e. the first bit is the least significant bit of the first byte and so on.
| BitString::BitString | ( | const BitString & | bs | ) |
copy constructor
| BitString::BitString | ( | const unsigned long | l | ) |
construct a BitString containing l bits with value zero
| BitString::BitString | ( | const std::vector< BYTE > & | d | ) |
construct a BitString containing the data in d
| BitString::BitString | ( | const std::string & | d | ) |
construct a BitString containing the characters in d as 8 bit unsigned chars
| void BitString::setArity | ( | EmbValue | arity | ) |
| EmbValue BitString::getArity | ( | void | ) | const [inline] |
| UWORD32 BitString::getNAryLength | ( | void | ) | const [inline] |
get the number of EmbValues in this BitString (using this BitString's arity)
| BitString & BitString::clear | ( | void | ) |
delete the contents of this Bitstring
append n lower order bits of v to this BitString
| v | the value to be appended | |
| n | the number of bits to be appended |
append n lower order bits of v to this BitString
| v | the value to be appended | |
| n | the number of bits to be appended |
append n lower order bits of v to this BitString
| v | the value to be appended | |
| n | the number of bits to be appended |
append the vector v byte-wise to this BitString
set the p-th bit to v
| i | the index (must be < getLength()) | |
| v | the value |
| BitString BitString::getBits | ( | const unsigned long | s, | |
| const unsigned long | l | |||
| ) | const |
| BitString BitString::cutBits | ( | const unsigned long | s, | |
| const unsigned long | l | |||
| ) |
| UWORD32 BitString::getValue | ( | const unsigned long | s, | |
| const unsigned short | l | |||
| ) | const |
return a value composed from bits in this BitString
| s | the index of the first bit to be used for the return value | |
| l | the total number of bits to be used for the return value (must be <= 32) |
| const std::vector< BYTE > & BitString::getBytes | ( | void | ) | const |
get the contents of this BitString as vector of bytes
| BitString & BitString::truncate | ( | const unsigned long | s, | |
| const unsigned long | e | |||
| ) |
| BitString & BitString::padRandom | ( | const unsigned long | mult | ) |
| BYTE BitString::getNAry | ( | unsigned long | p | ) | const |
| void BitString::appendNAry | ( | BYTE | v | ) |
append an n-ary digit to this BitString
| v | the n-ary value to be appended |
| BIT BitString::operator[] | ( | const unsigned long | i | ) | const |
get the value of the i-th bit
| bool BitString::operator== | ( | const BitString & | v | ) | const |
| bool BitString::operator!= | ( | const BitString & | v | ) | const |
| void BitString::print | ( | unsigned short | spc = 0 |
) | const |
| void BitString::_append | ( | BIT | v | ) | [private] |
| void BitString::clearUnused | ( | void | ) | [private] |
clear unused part of last byte (_append depends on this)
UWORD32 BitString::Length [private] |
EmbValue BitString::Arity [private] |
unsigned short BitString::ArityNBits [private] |
std::vector<BYTE> BitString::Data [private] |
1.5.1