FairRoot/PandaRoot
|
Base interface class for data storage and manipulation. Compatible with IO classes from MRF Suite. More...
#include <mrfdata_8b.h>
Public Member Functions | |
TMrfData_8b () | |
TMrfData_8b (UInt_t _reglengthbits, UInt_t _reglengthwords, UInt_t _lastreglengthbits, std::vector< UChar_t > _regdata) | |
void | setNumBits (const UInt_t &length) |
Sets the length of the binary data stream. More... | |
const UInt_t & | getNumBits () const |
Retrieves the length of the register in bits. More... | |
void | setNumWords (const UInt_t &length) |
Sets the length of the register to lengths words. More... | |
const UInt_t & | getNumWords () const |
Retrieves the length of the register in words. More... | |
void | setBit (const UInt_t &position, const bool &state) |
Sets or resets the bit at position. More... | |
bool | getBit (const UInt_t &position) const |
Determines if bit at position is set. More... | |
const UInt_t & | appendBit (const bool &state) |
Appends a bit to the data stream. More... | |
void | setWord (const UInt_t &position, const UChar_t &dataword, const bool &truncate_ok=false) |
Sets a complete data word at position to value. More... | |
void | setWordMasked (const UInt_t &position, const UChar_t &dataword, const UChar_t &mask=~0, const bool &truncate_ok=false) |
Sets a subset of bits in a word based on a mask. More... | |
const UChar_t & | getWord (const UInt_t &position) const |
Retrieves the word found at position. More... | |
const UChar_t & | appendWord (const UChar_t &dataword) |
void | setBitBlock (const UInt_t &position, const UInt_t &length, const UChar_t &value, const UInt_t &offset=0, const bool &reverse=false) |
Sets a bit block of given length to the least significant bits of value. More... | |
const UInt_t & | getBitBlock (const UInt_t &position, const UInt_t &length, const UInt_t &offset=0, const bool &reverse=false) const |
UInt_t | bitInBlock (const UInt_t &position) const |
Returns the word index which holds bit position. More... | |
void | clearDataStream () |
Sets a bitfield within the data storage based on the configuration stored in the map parameter bitmap. More... | |
bool | sameDataStream (const TMrfData_8b &other) const |
Checks data streams for equality. More... | |
void | importBinString (const std::string &data, const UInt_t &offset=0) |
Imports a data stream from a string representing binary digits. More... | |
const std::string & | exportBinString () const |
Exports a data stream to a string representing binary digits. More... | |
void | resample (const UInt_t &offset, const UInt_t &factor, const bool &reverse=false, const UInt_t &cutoff=0) |
Extracts binary data from returned oversampled data. More... | |
const UInt_t & | getLastError () const |
Returns an integer with errorflags of all errors occured after last successful command. More... | |
bool | lastActionSuccessful () const |
Returns True if the last action completed successfullly, False otherwise. More... | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int) |
TMrfData_8b () | |
TMrfData_8b (UInt_t _reglengthbits, UInt_t _reglengthwords, UInt_t _lastreglengthbits, std::vector< UChar_t > _regdata) | |
void | setNumBits (const UInt_t &length) |
Sets the length of the binary data stream. More... | |
const UInt_t & | getNumBits () const |
Retrieves the length of the register in bits. More... | |
void | setNumWords (const UInt_t &length) |
Sets the length of the register to lengths words. More... | |
const UInt_t & | getNumWords () const |
Retrieves the length of the register in words. More... | |
void | setBit (const UInt_t &position, const bool &state) |
Sets or resets the bit at position. More... | |
bool | getBit (const UInt_t &position) const |
Determines if bit at position is set. More... | |
const UInt_t & | appendBit (const bool &state) |
Appends a bit to the data stream. More... | |
void | setWord (const UInt_t &position, const UChar_t &dataword, const bool &truncate_ok=false) |
Sets a complete data word at position to value. More... | |
void | setWordMasked (const UInt_t &position, const UChar_t &dataword, const UChar_t &mask=~0, const bool &truncate_ok=false) |
Sets a subset of bits in a word based on a mask. More... | |
const UChar_t & | getWord (const UInt_t &position) const |
Retrieves the word found at position. More... | |
const UChar_t & | appendWord (const UChar_t &dataword) |
void | setBitBlock (const UInt_t &position, const UInt_t &length, const UChar_t &value, const UInt_t &offset=0, const bool &reverse=false) |
Sets a bit block of given length to the least significant bits of value. More... | |
const UInt_t & | getBitBlock (const UInt_t &position, const UInt_t &length, const UInt_t &offset=0, const bool &reverse=false) const |
UInt_t | bitInBlock (const UInt_t &position) const |
Returns the word index which holds bit position. More... | |
void | clearDataStream () |
Sets a bitfield within the data storage based on the configuration stored in the map parameter bitmap. More... | |
bool | sameDataStream (const TMrfData_8b &other) const |
Checks data streams for equality. More... | |
void | importBinString (const std::string &data, const UInt_t &offset=0) |
Imports a data stream from a string representing binary digits. More... | |
const std::string & | exportBinString () const |
Exports a data stream to a string representing binary digits. More... | |
void | resample (const UInt_t &offset, const UInt_t &factor, const bool &reverse=false, const UInt_t &cutoff=0) |
Extracts binary data from returned oversampled data. More... | |
const UInt_t & | getLastError () const |
Returns an integer with errorflags of all errors occured after last successful command. More... | |
bool | lastActionSuccessful () const |
Returns True if the last action completed successfullly, False otherwise. More... | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int) |
Public Attributes | |
UInt_t | reglengthbits |
UInt_t | reglengthwords |
UInt_t | lastreglengthbits |
UInt_t | _bitblock |
std::string | _data |
UInt_t | errcode |
Internal error code. More... | |
std::vector< UChar_t > | regdata |
Internal storage for data structure. More... | |
Static Public Attributes | |
static const UInt_t | zeroval = 0 |
static const UInt_t | bitsinablock = sizeof(UChar_t) * CHAR_BIT |
Number of bits stored in each data word. More... | |
Friends | |
class | boost::serialization::access |
Base interface class for data storage and manipulation. Compatible with IO classes from MRF Suite.
Definition at line 38 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.
TMrfData_8b::TMrfData_8b | ( | ) |
Definition at line 20 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
TMrfData_8b::TMrfData_8b | ( | UInt_t | _reglengthbits, |
UInt_t | _reglengthwords, | ||
UInt_t | _lastreglengthbits, | ||
std::vector< UChar_t > | _regdata | ||
) |
TMrfData_8b::TMrfData_8b | ( | ) |
TMrfData_8b::TMrfData_8b | ( | UInt_t | _reglengthbits, |
UInt_t | _reglengthwords, | ||
UInt_t | _lastreglengthbits, | ||
std::vector< UChar_t > | _regdata | ||
) |
const UInt_t & TMrfData_8b::appendBit | ( | const bool & | state | ) |
Appends a bit to the data stream.
state | Boolean state of the bit to be set to. True sets to 1, False sets to 0. |
Definition at line 90 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References reglengthbits, setBit(), and setNumBits().
const UInt_t& TMrfData_8b::appendBit | ( | const bool & | state | ) |
Appends a bit to the data stream.
state | Boolean state of the bit to be set to. True sets to 1, False sets to 0. |
const UChar_t& TMrfData_8b::appendWord | ( | const UChar_t & | dataword | ) |
const UChar_t& TMrfData_8b::appendWord | ( | const UChar_t & | dataword | ) |
UInt_t TMrfData_8b::bitInBlock | ( | const UInt_t & | position | ) | const |
Returns the word index which holds bit position.
position | Position (unit is bits) of bit in binary data stream to be investigated. |
UInt_t TMrfData_8b::bitInBlock | ( | const UInt_t & | position | ) | const |
Returns the word index which holds bit position.
position | Position (unit is bits) of bit in binary data stream to be investigated. |
Definition at line 247 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
void TMrfData_8b::clearDataStream | ( | ) |
Sets a bitfield within the data storage based on the configuration stored in the map parameter bitmap.
Retrieves a bitfield from the data storage based on the configuration stored in the map parameter bitmap. Clears the data stream.
void TMrfData_8b::clearDataStream | ( | ) |
Sets a bitfield within the data storage based on the configuration stored in the map parameter bitmap.
Retrieves a bitfield from the data storage based on the configuration stored in the map parameter bitmap. Clears the data stream.
Definition at line 252 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References setNumWords().
const std::string & TMrfData_8b::exportBinString | ( | ) | const |
Exports a data stream to a string representing binary digits.
Definition at line 280 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References _data, getBit(), getNumBits(), and i.
const std::string& TMrfData_8b::exportBinString | ( | ) | const |
Exports a data stream to a string representing binary digits.
bool TMrfData_8b::getBit | ( | const UInt_t & | position | ) | const |
Determines if bit at position is set.
position | Position (unit is bits) of bit in binary data stream to be investigated. |
bool TMrfData_8b::getBit | ( | const UInt_t & | position | ) | const |
Determines if bit at position is set.
position | Position (unit is bits) of bit in binary data stream to be investigated. |
Definition at line 79 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References bitsinablock, errcode, mrfdata_8b_error::out_of_bounds, regdata, and reglengthbits.
Referenced by exportBinString(), and getBitBlock().
const UInt_t& TMrfData_8b::getBitBlock | ( | const UInt_t & | position, |
const UInt_t & | length, | ||
const UInt_t & | offset = 0 , |
||
const bool & | reverse = false |
||
) | const |
const UInt_t & TMrfData_8b::getBitBlock | ( | const UInt_t & | position, |
const UInt_t & | length, | ||
const UInt_t & | offset = 0 , |
||
const bool & | reverse = false |
||
) | const |
Definition at line 178 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References _bitblock, getBit(), i, and mrftools::setIntBit().
const UInt_t & TMrfData_8b::getLastError | ( | ) | const |
Returns an integer with errorflags of all errors occured after last successful command.
Definition at line 323 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References errcode.
const UInt_t& TMrfData_8b::getLastError | ( | ) | const |
Returns an integer with errorflags of all errors occured after last successful command.
const UInt_t& TMrfData_8b::getNumBits | ( | ) | const |
Retrieves the length of the register in bits.
const UInt_t & TMrfData_8b::getNumBits | ( | ) | const |
Retrieves the length of the register in bits.
Definition at line 45 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References reglengthbits.
Referenced by exportBinString(), importBinString(), and resample().
const UInt_t & TMrfData_8b::getNumWords | ( | ) | const |
Retrieves the length of the register in words.
Definition at line 57 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References reglengthwords.
Referenced by PndTopix4::GetRawData(), PndMvdReadInTBData::ReadInRawData(), and PndMQTopix4Sampler::Run().
const UInt_t& TMrfData_8b::getNumWords | ( | ) | const |
Retrieves the length of the register in words.
const UChar_t& TMrfData_8b::getWord | ( | const UInt_t & | position | ) | const |
Retrieves the word found at position.
position | Position (unit is words) of data word to be investigated. |
const u_int8_t & TMrfData_8b::getWord | ( | const UInt_t & | position | ) | const |
Retrieves the word found at position.
position | Position (unit is words) of data word to be investigated. |
Definition at line 145 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References errcode, mrfdata_8b_error::out_of_bounds, regdata, reglengthwords, and zeroval.
Referenced by PndTopix4::GetRawData(), and PndMvdReadInTBData::ReadInRawData().
void TMrfData_8b::importBinString | ( | const std::string & | data, |
const UInt_t & | offset = 0 |
||
) |
Imports a data stream from a string representing binary digits.
data | String consiting only of characters "0" and "1" to be imported as binary data stream. |
offset | Optional offset (unit is bits) to change the import start position in the binary data stream. |
Definition at line 263 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References getNumBits(), i, setBit(), and setNumBits().
void TMrfData_8b::importBinString | ( | const std::string & | data, |
const UInt_t & | offset = 0 |
||
) |
Imports a data stream from a string representing binary digits.
data | String consiting only of characters "0" and "1" to be imported as binary data stream. |
offset | Optional offset (unit is bits) to change the import start position in the binary data stream. |
bool TMrfData_8b::lastActionSuccessful | ( | ) | const |
Returns True if the last action completed successfullly, False otherwise.
Definition at line 328 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References errcode.
bool TMrfData_8b::lastActionSuccessful | ( | ) | const |
Returns True if the last action completed successfullly, False otherwise.
void TMrfData_8b::resample | ( | const UInt_t & | offset, |
const UInt_t & | factor, | ||
const bool & | reverse = false , |
||
const UInt_t & | cutoff = 0 |
||
) |
Extracts binary data from returned oversampled data.
offset | Initial offset of oversampled data, after which sampling starts. |
factor | Oversampling factor. |
reverse | When set to true the order in which the bits of each data word are processed, is revesed. Default is false. |
cutoff | Optional maximum length of the resulting data stream. The default is to not cut the data stream. |
Definition at line 301 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References mrftools::getIntBit(), getNumBits(), regdata, setBit(), and setNumBits().
void TMrfData_8b::resample | ( | const UInt_t & | offset, |
const UInt_t & | factor, | ||
const bool & | reverse = false , |
||
const UInt_t & | cutoff = 0 |
||
) |
Extracts binary data from returned oversampled data.
offset | Initial offset of oversampled data, after which sampling starts. |
factor | Oversampling factor. |
reverse | When set to true the order in which the bits of each data word are processed, is revesed. Default is false. |
cutoff | Optional maximum length of the resulting data stream. The default is to not cut the data stream. |
bool TMrfData_8b::sameDataStream | ( | const TMrfData_8b & | other | ) | const |
Checks data streams for equality.
Definition at line 258 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References regdata.
bool TMrfData_8b::sameDataStream | ( | const TMrfData_8b & | other | ) | const |
Checks data streams for equality.
|
inline |
Definition at line 221 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.
References lastreglengthbits, regdata, reglengthbits, and reglengthwords.
|
inline |
Definition at line 221 of file MvdTestBeam/Tools/mrfdata_8b.h.
References lastreglengthbits, regdata, reglengthbits, and reglengthwords.
void TMrfData_8b::setBit | ( | const UInt_t & | position, |
const bool & | state | ||
) |
Sets or resets the bit at position.
position | Position (unit is bits) of bit in binary data stream to be manipulated. |
state | Boolean state of the bit to be set to. True sets to 1, False sets to 0. |
Definition at line 62 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References bitsinablock, errcode, mrfdata_8b_error::out_of_bounds, regdata, reglengthbits, and mrftools::setIntBit().
Referenced by appendBit(), importBinString(), and resample().
void TMrfData_8b::setBit | ( | const UInt_t & | position, |
const bool & | state | ||
) |
Sets or resets the bit at position.
position | Position (unit is bits) of bit in binary data stream to be manipulated. |
state | Boolean state of the bit to be set to. True sets to 1, False sets to 0. |
void TMrfData_8b::setBitBlock | ( | const UInt_t & | position, |
const UInt_t & | length, | ||
const UChar_t & | value, | ||
const UInt_t & | offset = 0 , |
||
const bool & | reverse = false |
||
) |
Sets a bit block of given length to the least significant bits of value.
position | Position (unit is bits) of bit block to be set. |
length | Length (unit is bits) of the bit block to be set. |
value | Value the bit block is to be set to, least significant bits are considered first. |
offset | Optional offset of bits in value to be skipped, starting from LSB |
reverse | If True, the bit order of the value is reversed. |
void TMrfData_8b::setBitBlock | ( | const UInt_t & | position, |
const UInt_t & | length, | ||
const UChar_t & | value, | ||
const UInt_t & | offset = 0 , |
||
const bool & | reverse = false |
||
) |
Sets a bit block of given length to the least significant bits of value.
position | Position (unit is bits) of bit block to be set. |
length | Length (unit is bits) of the bit block to be set. |
value | Value the bit block is to be set to, least significant bits are considered first. |
offset | Optional offset of bits in value to be skipped, starting from LSB |
reverse | If True, the bit order of the value is reversed. |
void TMrfData_8b::setNumBits | ( | const UInt_t & | length | ) |
Sets the length of the binary data stream.
length | Length (in bits) of the binary data stream to be set. |
void TMrfData_8b::setNumBits | ( | const UInt_t & | length | ) |
Sets the length of the binary data stream.
length | Length (in bits) of the binary data stream to be set. |
Definition at line 34 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References bitsinablock, lastreglengthbits, regdata, reglengthbits, and reglengthwords.
Referenced by appendBit(), importBinString(), and resample().
void TMrfData_8b::setNumWords | ( | const UInt_t & | length | ) |
Sets the length of the register to lengths words.
length | Length (in data words) of the binary data stream to be set. |
Definition at line 50 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.
References bitsinablock, regdata, reglengthbits, and reglengthwords.
Referenced by clearDataStream(), PndMQTopix4ProcessorTask::Exec(), and PndMQTopix4Processor::Run().
void TMrfData_8b::setNumWords | ( | const UInt_t & | length | ) |
Sets the length of the register to lengths words.
length | Length (in data words) of the binary data stream to be set. |
void TMrfData_8b::setWord | ( | const UInt_t & | position, |
const UChar_t & | dataword, | ||
const bool & | truncate_ok = false |
||
) |
Sets a complete data word at position to value.
position | Position (unit is words) of data word to be set. |
dataword | New value of the data word to be set. |
truncate_ok | If True, the data word is silently truncated in case it exceeds the length of the binary data stream. Otherwise, a flag in the internal error code is set. |
Error codes:
void TMrfData_8b::setWord | ( | const UInt_t & | position, |
const UChar_t & | dataword, | ||
const bool & | truncate_ok = false |
||
) |
Sets a complete data word at position to value.
position | Position (unit is words) of data word to be set. |
dataword | New value of the data word to be set. |
truncate_ok | If True, the data word is silently truncated in case it exceeds the length of the binary data stream. Otherwise, a flag in the internal error code is set. |
Error codes:
void TMrfData_8b::setWordMasked | ( | const UInt_t & | position, |
const UChar_t & | dataword, | ||
const UChar_t & | mask = ~0 , |
||
const bool & | truncate_ok = false |
||
) |
Sets a subset of bits in a word based on a mask.
position | Position (unit is words) of data word to be set. |
dataword | New value of the data word to be set. |
mask | Manipulation mask. All bits at positions set in the mask will be set/reset, all other bits will remain unchanged. |
truncate_ok | If True, the data word is silently truncated in case it exceeds the length of the binary data stream. Otherwise, a flag in the internal error code is set. |
Error codes:
void TMrfData_8b::setWordMasked | ( | const UInt_t & | position, |
const UChar_t & | dataword, | ||
const UChar_t & | mask = ~0 , |
||
const bool & | truncate_ok = false |
||
) |
Sets a subset of bits in a word based on a mask.
position | Position (unit is words) of data word to be set. |
dataword | New value of the data word to be set. |
mask | Manipulation mask. All bits at positions set in the mask will be set/reset, all other bits will remain unchanged. |
truncate_ok | If True, the data word is silently truncated in case it exceeds the length of the binary data stream. Otherwise, a flag in the internal error code is set. |
Error codes:
|
friend |
Definition at line 218 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.
|
mutable |
Definition at line 213 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.
Referenced by getBitBlock().
|
mutable |
Definition at line 214 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.
Referenced by exportBinString().
|
static |
Number of bits stored in each data word.
Definition at line 238 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.
Referenced by getBit(), setBit(), setNumBits(), and setNumWords().
|
mutable |
Internal error code.
The internal error code is a binary OR of all error flags which were set after the last successful command, which resets the error code to 0.
Definition at line 235 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.
Referenced by getBit(), getLastError(), getWord(), lastActionSuccessful(), and setBit().
UInt_t TMrfData_8b::lastreglengthbits |
Definition at line 211 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.
Referenced by serialize(), and setNumBits().
std::vector< UChar_t > TMrfData_8b::regdata |
Internal storage for data structure.
Do not access directly unless you are absolutely sure you need to do this. If you are absolutely sure, think about it once again.
Definition at line 244 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.
Referenced by PndMQTopix4ProcessorTask::Exec(), getBit(), getWord(), resample(), PndMQTopix4Sampler::Run(), PndMQTopix4Processor::Run(), sameDataStream(), serialize(), setBit(), setNumBits(), and setNumWords().
UInt_t TMrfData_8b::reglengthbits |
Definition at line 209 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.
Referenced by appendBit(), getBit(), getNumBits(), serialize(), setBit(), setNumBits(), and setNumWords().
UInt_t TMrfData_8b::reglengthwords |
Definition at line 210 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.
Referenced by getNumWords(), getWord(), serialize(), setNumBits(), and setNumWords().
|
static |
Definition at line 212 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.
Referenced by getWord().