BitField Class Reference
<class description="" goes="" here=""> <short description=""> More...
#include <BitField.hpp>
Public Member Functions | |
BitField (char *data, u32 size) | |
BitField (u32 size, bool initValue) | |
void | setBit (u32 pos) |
sets the bit at position | |
void | clearBit (u32 pos) |
sets the bit at position | |
bool | getBit (u32 pos) const |
gets the bit at position | |
void | invert () |
inverts all 1 to 0 and all 0 to 1 | |
u32 | getBitRange (u32 startPos, int *nrBits, bool littleEndian=true) |
returns | |
bool | writeBitRange (u32 startPos, int nrBits, u32 value, u32 startBit, bool littleEndian=true) |
bool | isAllSet () const |
returns true if the bitfield consists completely of 1s | |
bool | isAllCleared () const |
returns true if the bitfield consists completely of 0s | |
float | getPercentageSetBits () const |
returns the percentage of 1s inthe bitfield. | |
BitField * | createWithNewSize (u32 size, bool initValueForMissing) |
creates a new BitField with new size | |
u32 | getSize () const |
const char * | toBinaryString (u32 *sizeInU32) const |
simply returns a pointer to the internal bitfield. | |
char * | toAsciiString () const |
converts the bitfield into a human viewer friendly 01 ASCII presentation. | |
char * | toHexString () const |
converts the bitfield into a hex representation of the form size_0123456789ABCDEF... | |
Static Public Member Functions | |
BitField * | fromAsciiString (const char *str) |
creates a Bitfield from a string of chars '0' and '1'. | |
BitField * | fromBinaryString (const char *bin, u32 numBits) |
creates a Bitfield from a binary data pointer. | |
BitField * | fromBinaryString (char *bin, u32 numBits) |
same as above but faster because only a shallow-copy is performed | |
BitField * | fromHexString (const char *bin) |
creates a bitfield from its hex presentation | |
void | doTest () |
automatic testing of BitField functionality, throws assertion at any error found |
Detailed Description
<class description="" goes="" here=""> <short description="">
- Author:
- Michael Kropfberger and Peter Schojer
- Version:
- Id
- BitField.hpp,v 1.4 2004/05/19 22:19:01 mkropfbe Exp
Definition at line 62 of file BitField.hpp.
Member Function Documentation
|
sets the bit at position
Referenced by createWithNewSize(), fromAsciiString(), fromHexString(), and invert().
|
|
creates a new BitField with new size
References bits, clearBit(), getBit(), and setBit(). Referenced by ESInfo::setVOPTimeIncrement().
|
|
creates a Bitfield from a string of chars '0' and '1'. Time expensive but endian save! Definition at line 224 of file BitField.cpp. References clearBit(). Referenced by doTest().
|
|
creates a Bitfield from a binary data pointer. fast but not endian save Definition at line 243 of file BitField.cpp. References bits.
|
|
gets the bit at position
Referenced by createWithNewSize(), doTest(), getBitRange(), FilteredIO::getFrame(), getPercentageSetBits(), invert(), isAllCleared(), isAllSet(), toAsciiString(), toHexString(), and FilteredIO::writeFrame().
|
|
returns
References getBit(). Referenced by doTest().
|
|
returns the percentage of 1s inthe bitfield. Expensive!!! Definition at line 209 of file BitField.cpp. References getBit(). Referenced by doTest(), and ProxySession::tearDown().
|
|
sets the bit at position
Referenced by createWithNewSize(), doTest(), invert(), RawStreamIO::writeFrame(), MPGStreamIO::writeFrame(), and BufferedIO::writeFrame().
|
|
converts the bitfield into a human viewer friendly 01 ASCII presentation. Time expensive but endian save! Definition at line 160 of file BitField.cpp. References getBit(). Referenced by doTest().
|
|
simply returns a pointer to the internal bitfield. returns the size which is multiple of sizeof(u32) Definition at line 152 of file BitField.cpp.
|
|
converts the bitfield into a hex representation of the form size_0123456789ABCDEF... Example: A Bitfield with the size 9, data:(bit 0) 000111110 (bit 8) is in hex: 00000009_8F0Definition at line 261 of file BitField.cpp. References getBit(). Referenced by doTest(), and FilteredIO::setBitField().
|
The documentation for this class was generated from the following files: