#include <BitCodedValue.h>
Public Member Functions | |
| TBitCodedValue () | |
| TBitCodedValue (const TBitCodedValue &rValue) | |
| TBitCodedValue (int iValue, Int iMaxSize=64) | |
| TBitCodedValue (unsigned int uiValue, Int iMaxSize=64) | |
| TBitCodedValue (Int8 cValue, Int iMaxSize=8) | |
| TBitCodedValue (Int16 sValue, Int iMaxSize=16) | |
| TBitCodedValue (Int32 lValue, Int iMaxSize=32) | |
| TBitCodedValue (Int64 ldValue, Int iMaxSize=64) | |
| TBitCodedValue (Uint8 ucValue, Int iMaxSize=8) | |
| TBitCodedValue (Uint16 usValue, Int iMaxSize=16) | |
| TBitCodedValue (Uint32 ulValue, Int iMaxSize=32) | |
| TBitCodedValue (Uint64 uldValue, Int iMaxSize=64) | |
| virtual | ~TBitCodedValue () |
| TString | toBinary (bool bTrimZeros=false, bool bAddPreamble=true) const |
| TString | toHex (bool bTrimZeros=false, bool bAddPreamble=true) const |
| Int8 | getInt8 () const |
| Int16 | getInt16 () const |
| Int32 | getInt32 () const |
| Int64 | getInt64 () const |
| Uint8 | getUint8 () const |
| Uint16 | getUint16 () const |
| Uint32 | getUint32 () const |
| Uint64 | getUint64 () const |
| bool | getBit (Int iIndex, bool *pError=NULL) const |
| Int | getFirstBitSet () const |
| Int | getFirstBitSet (Uint64 uldMask) const |
| Int | getLastBitSet () const |
| Int | getLastBitSet (Uint64 uldMask) const |
| void | invertAll () |
| bool | invertBit (Int iIndex) |
| bool | setBit (Int iIndex, bool bState) |
| bool | setBitRange (Int iFromIndex, Int iToIndex, Uint64 uldValue, bool bForce=false) |
| bool | setBitRange (Int iFromIndex, Int iToIndex, Int64 ldValue, bool bForce=false) |
| bool | setBitRange (Int iFromIndex, Int iToIndex, int iValue, bool bForce=false) |
| bool | setBitRange (Int iFromIndex, Int iToIndex, unsigned int uiValue, bool bForce=false) |
| bool | operator== (Int64 ldValue) const |
| bool | operator== (Uint64 uldValue) const |
| bool | operator== (const TBitCodedValue &rValue) const |
| bool | operator== (int iValue) const |
| bool | operator== (unsigned int uiValue) const |
| bool | operator!= (Int64 ldValue) const |
| bool | operator!= (Uint64 uldValue) const |
| bool | operator!= (const TBitCodedValue &rValue) const |
| bool | operator!= (int iValue) const |
| bool | operator!= (unsigned int uiValue) const |
| TBitCodedValue & | operator= (Int64 ldValue) |
| TBitCodedValue & | operator= (Uint64 uldValue) |
| TBitCodedValue & | operator= (const TBitCodedValue &rValue) |
| TBitCodedValue & | operator= (int iValue) |
| TBitCodedValue & | operator= (unsigned int uiValue) |
| bool | operator[] (Int iIndex) const |
Static Public Member Functions | |
| static TString | convertToBinary (const TBitCodedValue &rValue, bool bTrimZeros, bool bAddPreamble) |
| static TString | convertToBinary (Uint64 uldValue, Int iMaxSize, bool bTrimZeros, bool bAddPreamble) |
| static TString | convertToHex (const TBitCodedValue &rValue, bool bTrimZeros, bool bAddPreamble) |
| static TString | convertToHex (const IByteArray &rValue, bool bTrimZeros, bool bAddPreamble) |
| static TString | convertToHex (Uint64 uldValue, Int iMaxSize, bool bTrimZeros, bool bAddPreamble) |
| static Int64 | convertHexToInt64 (const TString &rString, bool &rError, Int64 ldPredef=0) |
| static Int64 | convertBinaryToInt64 (const TString &rString, bool &rError, Int64 ldPredef=0) |
| static void | convertDecimalToByteArray (const TString &rString, bool &rError, IByteArray &rValue) |
| static void | convertHexToByteArray (const TString &rString, bool &rError, IByteArray &rValue) |
Protected Attributes | |
| Uint64 | m_uldBitArray |
| Bit coded value. | |
| Int | m_iMaxSize |
| Max bit code size. | |
This class implements a bit coded value as a stack type. The bit coded value is used as helper class for setting bits or event bytes inside a 64 bit array.
| TBitCodedValue::TBitCodedValue | ( | ) |
Creates an empty bit coded value
| TBitCodedValue::TBitCodedValue | ( | const TBitCodedValue & | rValue ) |
Copy constructor of the bit coded value
| rValue | : Value to copy |
| TBitCodedValue::TBitCodedValue | ( | int | iValue, |
| Int | iMaxSize = 64 |
||
| ) |
Creates a bit coded value out of an int value
| iValue | : Value to copy |
| iMaxSize | : Max bit code value |
| TBitCodedValue::TBitCodedValue | ( | unsigned int | uiValue, |
| Int | iMaxSize = 64 |
||
| ) |
Creates a bit coded value out of an unsigned int value
| uiValue | : Value to copy |
| iMaxSize | : Max bit code value |
| TBitCodedValue::TBitCodedValue | ( | Int8 | cValue, |
| Int | iMaxSize = 8 |
||
| ) |
Creates a bit coded value out of an signed int8 value
| cValue | : Value to copy |
| iMaxSize | : Max bit code value |
| TBitCodedValue::TBitCodedValue | ( | Int16 | sValue, |
| Int | iMaxSize = 16 |
||
| ) |
Creates a bit coded value out of an signed int16 value
| sValue | : Value to copy |
| iMaxSize | : Max bit code value |
| TBitCodedValue::TBitCodedValue | ( | Int32 | lValue, |
| Int | iMaxSize = 32 |
||
| ) |
Creates a bit coded value out of an signed int32 value
| lValue | : Value to copy |
| iMaxSize | : Max bit code value |
| TBitCodedValue::TBitCodedValue | ( | Int64 | ldValue, |
| Int | iMaxSize = 64 |
||
| ) |
Creates a bit coded value out of an signed int64 value
| ldValue | : Value to copy |
| iMaxSize | : Max bit code value |
| TBitCodedValue::TBitCodedValue | ( | Uint8 | ucValue, |
| Int | iMaxSize = 8 |
||
| ) |
Creates a bit coded value out of an unsigned int8 value
| ucValue | : Value to copy |
| iMaxSize | : Max bit code value |
| TBitCodedValue::TBitCodedValue | ( | Uint16 | usValue, |
| Int | iMaxSize = 16 |
||
| ) |
Creates a bit coded value out of an unsigned int16 value
| usValue | : Value to copy |
| iMaxSize | : Max bit code value |
| TBitCodedValue::TBitCodedValue | ( | Uint32 | ulValue, |
| Int | iMaxSize = 32 |
||
| ) |
Creates a bit coded value out of an unsigned int32 value
| ulValue | : Value to copy |
| iMaxSize | : Max bit code value |
| TBitCodedValue::TBitCodedValue | ( | Uint64 | uldValue, |
| Int | iMaxSize = 64 |
||
| ) |
Creates a bit coded value out of an unsigned int64 value
| uldValue | : Value to copy |
| iMaxSize | : Max bit code value |
| TBitCodedValue::~TBitCodedValue | ( | ) | [virtual] |
Destroys the bit coded value
| Int64 TBitCodedValue::convertBinaryToInt64 | ( | const TString & | rString, |
| bool & | rError, | ||
| Int64 | ldPredef = 0 |
||
| ) | [static] |
converts a string in binary notation into a int64 value
| rString | : string to convert |
| rError | : return value. True = Convertion was successfully |
| ldPredef | : pre definition value to return if the string is not valid |
| void TBitCodedValue::convertDecimalToByteArray | ( | const TString & | rString, |
| bool & | rError, | ||
| IByteArray & | rValue | ||
| ) | [static] |
Converts a big decimal number stored in a string into a byte array (binary data).
| rString | : string containing the decimal number |
| rError | : returns error value. True = Convertion was successfully |
| rValue,: | generated binary data |
| void TBitCodedValue::convertHexToByteArray | ( | const TString & | rString, |
| bool & | rError, | ||
| IByteArray & | rValue | ||
| ) | [static] |
converts a string in hex notation into a byte array value
| rString | : string to convert |
| rError | : return error value. True = Convertion was successfully |
| rValue | : generated value |
| Int64 TBitCodedValue::convertHexToInt64 | ( | const TString & | rString, |
| bool & | rError, | ||
| Int64 | ldPredef = 0 |
||
| ) | [static] |
converts a string in hex notation into a int64 value
| rString | : string to convert |
| rError | : return value. True = Convertion was successfully |
| ldPredef | : pre definition value to return if the string is not valid |
| TString TBitCodedValue::convertToBinary | ( | Uint64 | uldValue, |
| Int | iMaxSize, | ||
| bool | bTrimZeros, | ||
| bool | bAddPreamble | ||
| ) | [static] |
converts a bit coded value into a binary output
| uldValue | : Value to convert |
| iMaxSize | : How many bits must be considered |
| bTrimZeros | : Trim leading zeros. |
| bAddPreamble | : add the preamble "0b". |
| TString zeus::TBitCodedValue::convertToBinary | ( | const TBitCodedValue & | rValue, |
| bool | bTrimZeros, | ||
| bool | bAddPreamble | ||
| ) | [inline, static] |
converts a bit coded value into a binary output
| TString TBitCodedValue::convertToHex | ( | const IByteArray & | rValue, |
| bool | bTrimZeros, | ||
| bool | bAddPreamble | ||
| ) | [static] |
Converts a byte array into a hex notation
| TString TBitCodedValue::convertToHex | ( | Uint64 | uldValue, |
| Int | iMaxSize, | ||
| bool | bTrimZeros, | ||
| bool | bAddPreamble | ||
| ) | [static] |
converts a bit coded value into a hex output
| uldValue | : Value to convert |
| iMaxSize | : How many bits must be considered |
| bTrimZeros | : Trim leading zeros. |
| bAddPreamble | : add the preamble "0x". |
| TString zeus::TBitCodedValue::convertToHex | ( | const TBitCodedValue & | rValue, |
| bool | bTrimZeros, | ||
| bool | bAddPreamble | ||
| ) | [inline, static] |
converts a bit coded value into a hexadecimal output
| bool TBitCodedValue::getBit | ( | Int | iIndex, |
| bool * | pError = NULL |
||
| ) | const |
returns the state of a bit
| iIndex | : Index of the bit (0 to 63) |
| pError | : Optional parameter to receive the error (wrong index) |
| true | : Bit is set |
| false,: | Bit is not set |
| Int TBitCodedValue::getFirstBitSet | ( | ) | const |
Returns the first bit index of a bit set to 1. This method implements the de Bruijn algorithm (see http://supertech.csail.mit.edu/papers/debruijn.pdf).
| >= | 0 : Index of bit set |
| INVALID_INDEX | : No bit is set |
| Int TBitCodedValue::getFirstBitSet | ( | Uint64 | uldMask ) | const |
Returns the first bit index of a bit set to 1. This method implements the de Bruijn algorithm (see http://supertech.csail.mit.edu/papers/debruijn.pdf).
| uldMask | : Mask to mask out the interesting bits |
| >= | 0 : Index of bit set |
| INVALID_INDEX | : No bit is set |
| Int16 zeus::TBitCodedValue::getInt16 | ( | ) | const [inline] |
Returns a int16 value
| Int32 zeus::TBitCodedValue::getInt32 | ( | ) | const [inline] |
Returns a int32 value
| Int64 zeus::TBitCodedValue::getInt64 | ( | ) | const [inline] |
Returns a int64 value
| Int8 zeus::TBitCodedValue::getInt8 | ( | ) | const [inline] |
Returns a int8 value
| Int TBitCodedValue::getLastBitSet | ( | ) | const |
Returns the last bit index of a bit set to 1
| >= | 0 : Index of bit set |
| INVALID_INDEX | : No bit is set |
| Int TBitCodedValue::getLastBitSet | ( | Uint64 | uldMask ) | const |
Returns the last bit index of a bit set to 1
| uldMask | : Mask to mask out the interesting bits |
| >= | 0 : Index of bit set |
| INVALID_INDEX | : No bit is set |
| Uint16 zeus::TBitCodedValue::getUint16 | ( | ) | const [inline] |
Returns a Uint16 value
| Uint32 zeus::TBitCodedValue::getUint32 | ( | ) | const [inline] |
Returns a Uint32 value
| Uint64 zeus::TBitCodedValue::getUint64 | ( | ) | const [inline] |
Returns a Uint64 value
| Uint8 zeus::TBitCodedValue::getUint8 | ( | ) | const [inline] |
Returns a Uint8 value
| void zeus::TBitCodedValue::invertAll | ( | ) | [inline] |
inverts all bits
| bool TBitCodedValue::invertBit | ( | Int | iIndex ) |
inverts an indexed bit
| iIndex | : Index of the bit |
| bool zeus::TBitCodedValue::operator!= | ( | unsigned int | uiValue ) | const [inline] |
compares a value with the bit coded value
| bool zeus::TBitCodedValue::operator!= | ( | Uint64 | uldValue ) | const [inline] |
compares a value with the bit coded value
| bool zeus::TBitCodedValue::operator!= | ( | int | iValue ) | const [inline] |
compares a value with the bit coded value
| bool zeus::TBitCodedValue::operator!= | ( | Int64 | ldValue ) | const [inline] |
compares a value with the bit coded value
| bool zeus::TBitCodedValue::operator!= | ( | const TBitCodedValue & | rValue ) | const [inline] |
compares a value with the bit coded value
| TBitCodedValue & zeus::TBitCodedValue::operator= | ( | Uint64 | uldValue ) | [inline] |
assigns a new bit coded value
| TBitCodedValue & zeus::TBitCodedValue::operator= | ( | Int64 | ldValue ) | [inline] |
assigns a new bit coded value
| TBitCodedValue & zeus::TBitCodedValue::operator= | ( | int | iValue ) | [inline] |
assigns a new bit coded value
| TBitCodedValue & zeus::TBitCodedValue::operator= | ( | const TBitCodedValue & | rValue ) | [inline] |
assigns a new bit coded value
| TBitCodedValue & zeus::TBitCodedValue::operator= | ( | unsigned int | uiValue ) | [inline] |
assigns a new bit coded value
| bool zeus::TBitCodedValue::operator== | ( | const TBitCodedValue & | rValue ) | const [inline] |
compares a value with the bit coded value
| bool zeus::TBitCodedValue::operator== | ( | Int64 | ldValue ) | const [inline] |
compares a value with the bit coded value
| bool zeus::TBitCodedValue::operator== | ( | Uint64 | uldValue ) | const [inline] |
compares a value with the bit coded value
| bool zeus::TBitCodedValue::operator== | ( | int | iValue ) | const [inline] |
compares a value with the bit coded value
| bool zeus::TBitCodedValue::operator== | ( | unsigned int | uiValue ) | const [inline] |
compares a value with the bit coded value
| bool zeus::TBitCodedValue::operator[] | ( | Int | iIndex ) | const [inline] |
returns an indexed value
| bool TBitCodedValue::setBit | ( | Int | iIndex, |
| bool | bState | ||
| ) |
sets the state of a bit
| iIndex | : Index of the bit (0 to 63) |
| bState | : state of the bit |
| true | : Bit state has been set |
| false,: | wrong index |
| bool TBitCodedValue::setBitRange | ( | Int | iFromIndex, |
| Int | iToIndex, | ||
| Uint64 | uldValue, | ||
| bool | bForce = false |
||
| ) |
sets a bit range from iFromIndex to iToIndex. If the range is too small for the given value not all bit can be set. The method returns false. The content of the bit coded value does not change, if this method returned false. If the force-flag is set this method will ignore if not all bits could be set.
| iFromIndex,: | from index |
| iToIndex | : to index |
| uldValue | : Value to set |
| bForce | : force setting range even bits are not completly set |
| false | : wrong index or bits can not be set (value unchanged) |
| true | : changes has been performed |
| bForce | = false |
| bool zeus::TBitCodedValue::setBitRange | ( | Int | iFromIndex, |
| Int | iToIndex, | ||
| int | iValue, | ||
| bool | bForce = false |
||
| ) | [inline] |
sets a bit range from iFromIndex to iToIndex.
| iFromIndex,: | from index |
| iToIndex | : to index |
| iValue | : Value to set |
| bForce | : force setting range even bits are not completly set |
| false | : wrong index or bits can not be set (value unchanged) |
| true | : changes has been performed |
| bForce | = false |
| bool zeus::TBitCodedValue::setBitRange | ( | Int | iFromIndex, |
| Int | iToIndex, | ||
| unsigned int | uiValue, | ||
| bool | bForce = false |
||
| ) | [inline] |
sets a bit range from iFromIndex to iToIndex.
| iFromIndex,: | from index |
| iToIndex | : to index |
| uiValue | : Value to set |
| bForce | : force setting range even bits are not completly set |
| false | : wrong index or bits can not be set (value unchanged) |
| true | : changes has been performed |
| bForce | = false |
| bool zeus::TBitCodedValue::setBitRange | ( | Int | iFromIndex, |
| Int | iToIndex, | ||
| Int64 | ldValue, | ||
| bool | bForce = false |
||
| ) | [inline] |
sets a bit range from iFromIndex to iToIndex.
| iFromIndex,: | from index |
| iToIndex | : to index |
| ldValue | : Value to set |
| bForce | : force setting range even bits are not completly set |
| false | : wrong index or bits can not be set (value unchanged) |
| true | : changes has been performed |
| bForce | = false |
| TString zeus::TBitCodedValue::toBinary | ( | bool | bTrimZeros = false, |
| bool | bAddPreamble = true |
||
| ) | const [inline] |
converts the bit coded value into a binary output
| TString zeus::TBitCodedValue::toHex | ( | bool | bTrimZeros = false, |
| bool | bAddPreamble = true |
||
| ) | const [inline] |
converts the bit coded value into a hexadecimal output
Int zeus::TBitCodedValue::m_iMaxSize [protected] |
Max bit code size.
Uint64 zeus::TBitCodedValue::m_uldBitArray [protected] |
Bit coded value.