PandaRoot
TMrfData_8b Class Reference

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
 

Detailed Description

Base interface class for data storage and manipulation. Compatible with IO classes from MRF Suite.

Definition at line 35 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.

Constructor & Destructor Documentation

◆ TMrfData_8b() [1/4]

TMrfData_8b::TMrfData_8b ( )

◆ TMrfData_8b() [2/4]

TMrfData_8b::TMrfData_8b ( UInt_t  _reglengthbits,
UInt_t  _reglengthwords,
UInt_t  _lastreglengthbits,
std::vector< UChar_t >  _regdata 
)

◆ TMrfData_8b() [3/4]

TMrfData_8b::TMrfData_8b ( )

◆ TMrfData_8b() [4/4]

TMrfData_8b::TMrfData_8b ( UInt_t  _reglengthbits,
UInt_t  _reglengthwords,
UInt_t  _lastreglengthbits,
std::vector< UChar_t >  _regdata 
)

Member Function Documentation

◆ appendBit() [1/2]

const UInt_t& TMrfData_8b::appendBit ( const bool &  state)

Appends a bit to the data stream.

Parameters
stateBoolean state of the bit to be set to. True sets to 1, False sets to 0.
Returns
New length of the binary data stream.

◆ appendBit() [2/2]

const UInt_t& TMrfData_8b::appendBit ( const bool &  state)

Appends a bit to the data stream.

Parameters
stateBoolean state of the bit to be set to. True sets to 1, False sets to 0.
Returns
New length of the binary data stream.

◆ appendWord() [1/2]

const UChar_t& TMrfData_8b::appendWord ( const UChar_t &  dataword)

◆ appendWord() [2/2]

const UChar_t& TMrfData_8b::appendWord ( const UChar_t &  dataword)

◆ bitInBlock() [1/2]

UInt_t TMrfData_8b::bitInBlock ( const UInt_t &  position) const

Returns the word index which holds bit position.

Parameters
positionPosition (unit is bits) of bit in binary data stream to be investigated.
Returns
Position (unit is words) of bit in binary data stream.

◆ bitInBlock() [2/2]

UInt_t TMrfData_8b::bitInBlock ( const UInt_t &  position) const

Returns the word index which holds bit position.

Parameters
positionPosition (unit is bits) of bit in binary data stream to be investigated.
Returns
Position (unit is words) of bit in binary data stream.

◆ clearDataStream() [1/2]

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.

◆ clearDataStream() [2/2]

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.

◆ exportBinString() [1/2]

const std::string& TMrfData_8b::exportBinString ( ) const

Exports a data stream to a string representing binary digits.

Returns
A string containing a binary representation of the binary data stream.

◆ exportBinString() [2/2]

const std::string& TMrfData_8b::exportBinString ( ) const

Exports a data stream to a string representing binary digits.

Returns
A string containing a binary representation of the binary data stream.

◆ getBit() [1/2]

bool TMrfData_8b::getBit ( const UInt_t &  position) const

Determines if bit at position is set.

Parameters
positionPosition (unit is bits) of bit in binary data stream to be investigated.
Returns
True if the bit is set (1), False if the bit is not set (0).

◆ getBit() [2/2]

bool TMrfData_8b::getBit ( const UInt_t &  position) const

Determines if bit at position is set.

Parameters
positionPosition (unit is bits) of bit in binary data stream to be investigated.
Returns
True if the bit is set (1), False if the bit is not set (0).

◆ getBitBlock() [1/2]

const UInt_t& TMrfData_8b::getBitBlock ( const UInt_t &  position,
const UInt_t &  length,
const UInt_t &  offset = 0,
const bool &  reverse = false 
) const

◆ getBitBlock() [2/2]

const UInt_t& TMrfData_8b::getBitBlock ( const UInt_t &  position,
const UInt_t &  length,
const UInt_t &  offset = 0,
const bool &  reverse = false 
) const

◆ getLastError() [1/2]

const UInt_t& TMrfData_8b::getLastError ( ) const

Returns an integer with errorflags of all errors occured after last successful command.

Returns
An integer with errorflags of all errors occured after last successful command. Zero returned means success.

◆ getLastError() [2/2]

const UInt_t& TMrfData_8b::getLastError ( ) const

Returns an integer with errorflags of all errors occured after last successful command.

Returns
An integer with errorflags of all errors occured after last successful command. Zero returned means success.

◆ getNumBits() [1/2]

const UInt_t& TMrfData_8b::getNumBits ( ) const

Retrieves the length of the register in bits.

Returns
Current length (in bits) of the binary data stream.

◆ getNumBits() [2/2]

const UInt_t& TMrfData_8b::getNumBits ( ) const

Retrieves the length of the register in bits.

Returns
Current length (in bits) of the binary data stream.

◆ getNumWords() [1/2]

const UInt_t& TMrfData_8b::getNumWords ( ) const

Retrieves the length of the register in words.

Returns
Current length (in data words) of the binary data stream.

◆ getNumWords() [2/2]

const UInt_t& TMrfData_8b::getNumWords ( ) const

Retrieves the length of the register in words.

Returns
Current length (in data words) of the binary data stream.

◆ getWord() [1/2]

const UChar_t& TMrfData_8b::getWord ( const UInt_t &  position) const

Retrieves the word found at position.

Parameters
positionPosition (unit is words) of data word to be investigated.
Returns
Value of the data word.

◆ getWord() [2/2]

const UChar_t& TMrfData_8b::getWord ( const UInt_t &  position) const

Retrieves the word found at position.

Parameters
positionPosition (unit is words) of data word to be investigated.
Returns
Value of the data word.

◆ importBinString() [1/2]

void TMrfData_8b::importBinString ( const std::string &  data,
const UInt_t &  offset = 0 
)

Imports a data stream from a string representing binary digits.

Parameters
dataString consiting only of characters "0" and "1" to be imported as binary data stream.
offsetOptional offset (unit is bits) to change the import start position in the binary data stream.

◆ importBinString() [2/2]

void TMrfData_8b::importBinString ( const std::string &  data,
const UInt_t &  offset = 0 
)

Imports a data stream from a string representing binary digits.

Parameters
dataString consiting only of characters "0" and "1" to be imported as binary data stream.
offsetOptional offset (unit is bits) to change the import start position in the binary data stream.

◆ lastActionSuccessful() [1/2]

bool TMrfData_8b::lastActionSuccessful ( ) const

Returns True if the last action completed successfullly, False otherwise.

Returns
True if the last action completed successfullly, False if any error occured.

◆ lastActionSuccessful() [2/2]

bool TMrfData_8b::lastActionSuccessful ( ) const

Returns True if the last action completed successfullly, False otherwise.

Returns
True if the last action completed successfullly, False if any error occured.

◆ resample() [1/2]

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.

Parameters
offsetInitial offset of oversampled data, after which sampling starts.
factorOversampling factor.
reverseWhen set to true the order in which the bits of each data word are processed, is revesed. Default is false.
cutoffOptional maximum length of the resulting data stream. The default is to not cut the data stream.

◆ resample() [2/2]

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.

Parameters
offsetInitial offset of oversampled data, after which sampling starts.
factorOversampling factor.
reverseWhen set to true the order in which the bits of each data word are processed, is revesed. Default is false.
cutoffOptional maximum length of the resulting data stream. The default is to not cut the data stream.

◆ sameDataStream() [1/2]

bool TMrfData_8b::sameDataStream ( const TMrfData_8b other) const

Checks data streams for equality.

◆ sameDataStream() [2/2]

bool TMrfData_8b::sameDataStream ( const TMrfData_8b other) const

Checks data streams for equality.

◆ serialize() [1/2]

template<class Archive >
void TMrfData_8b::serialize ( Archive &  ar,
const unsigned  int 
)
inline

Definition at line 217 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.

218  {
219  ar &reglengthbits;
220  ar &reglengthwords;
221  ar &lastreglengthbits;
222  ar &regdata;
223  }
std::vector< UChar_t > regdata
Internal storage for data structure.

◆ serialize() [2/2]

template<class Archive >
void TMrfData_8b::serialize ( Archive &  ar,
const unsigned  int 
)
inline

Definition at line 217 of file MvdTestBeam/Tools/mrfdata_8b.h.

218  {
219  ar &reglengthbits;
220  ar &reglengthwords;
221  ar &lastreglengthbits;
222  ar &regdata;
223  }
std::vector< UChar_t > regdata
Internal storage for data structure.

◆ setBit() [1/2]

void TMrfData_8b::setBit ( const UInt_t &  position,
const bool &  state 
)

Sets or resets the bit at position.

Parameters
positionPosition (unit is bits) of bit in binary data stream to be manipulated.
stateBoolean state of the bit to be set to. True sets to 1, False sets to 0.

◆ setBit() [2/2]

void TMrfData_8b::setBit ( const UInt_t &  position,
const bool &  state 
)

Sets or resets the bit at position.

Parameters
positionPosition (unit is bits) of bit in binary data stream to be manipulated.
stateBoolean state of the bit to be set to. True sets to 1, False sets to 0.

◆ setBitBlock() [1/2]

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.

Parameters
positionPosition (unit is bits) of bit block to be set.
lengthLength (unit is bits) of the bit block to be set.
valueValue the bit block is to be set to, least significant bits are considered first.
offsetOptional offset of bits in value to be skipped, starting from LSB
reverseIf True, the bit order of the value is reversed.

◆ setBitBlock() [2/2]

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.

Parameters
positionPosition (unit is bits) of bit block to be set.
lengthLength (unit is bits) of the bit block to be set.
valueValue the bit block is to be set to, least significant bits are considered first.
offsetOptional offset of bits in value to be skipped, starting from LSB
reverseIf True, the bit order of the value is reversed.

◆ setNumBits() [1/2]

void TMrfData_8b::setNumBits ( const UInt_t &  length)

Sets the length of the binary data stream.

Parameters
lengthLength (in bits) of the binary data stream to be set.

◆ setNumBits() [2/2]

void TMrfData_8b::setNumBits ( const UInt_t &  length)

Sets the length of the binary data stream.

Parameters
lengthLength (in bits) of the binary data stream to be set.

◆ setNumWords() [1/2]

void TMrfData_8b::setNumWords ( const UInt_t &  length)

Sets the length of the register to lengths words.

Parameters
lengthLength (in data words) of the binary data stream to be set.

◆ setNumWords() [2/2]

void TMrfData_8b::setNumWords ( const UInt_t &  length)

Sets the length of the register to lengths words.

Parameters
lengthLength (in data words) of the binary data stream to be set.

◆ setWord() [1/2]

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.

Parameters
positionPosition (unit is words) of data word to be set.
datawordNew value of the data word to be set.
truncate_okIf 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:

◆ setWord() [2/2]

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.

Parameters
positionPosition (unit is words) of data word to be set.
datawordNew value of the data word to be set.
truncate_okIf 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:

◆ setWordMasked() [1/2]

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.

Parameters
positionPosition (unit is words) of data word to be set.
datawordNew value of the data word to be set.
maskManipulation mask. All bits at positions set in the mask will be set/reset, all other bits will remain unchanged.
truncate_okIf 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:

◆ setWordMasked() [2/2]

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.

Parameters
positionPosition (unit is words) of data word to be set.
datawordNew value of the data word to be set.
maskManipulation mask. All bits at positions set in the mask will be set/reset, all other bits will remain unchanged.
truncate_okIf 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:

Friends And Related Function Documentation

◆ boost::serialization::access

boost::serialization::access
friend

Definition at line 214 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.

Member Data Documentation

◆ _bitblock

UInt_t TMrfData_8b::_bitblock
mutable

Definition at line 209 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.

◆ _data

std::string TMrfData_8b::_data
mutable

Definition at line 210 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.

◆ bitsinablock

static const UInt_t TMrfData_8b::bitsinablock = sizeof(UChar_t) * CHAR_BIT
static

Number of bits stored in each data word.

Definition at line 233 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.

◆ errcode

UInt_t TMrfData_8b::errcode
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 230 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.

◆ lastreglengthbits

UInt_t TMrfData_8b::lastreglengthbits

Definition at line 207 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.

◆ regdata

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 239 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.

◆ reglengthbits

UInt_t TMrfData_8b::reglengthbits

Definition at line 205 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.

◆ reglengthwords

UInt_t TMrfData_8b::reglengthwords

Definition at line 206 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.

◆ zeroval

static const UInt_t TMrfData_8b::zeroval = 0
static

Definition at line 208 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.


The documentation for this class was generated from the following file: