FairRoot/PandaRoot
Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
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 38 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.h.

Constructor & Destructor Documentation

TMrfData_8b::TMrfData_8b ( )

Definition at line 20 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.

21 : reglengthbits(0), reglengthwords(0), lastreglengthbits(0), errcode(0) //, bitsinablock(sizeof(mrf::registertype) * CHAR_BIT)
22 {
23 }
UInt_t errcode
Internal error code.
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 
)

Member Function Documentation

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.

Definition at line 90 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.

References reglengthbits, setBit(), and setNumBits().

91 {
93  setBit(reglengthbits - 1, state);
94  return reglengthbits;
95 }
void setBit(const UInt_t &position, const bool &state)
Sets or resets the bit at position.
void setNumBits(const UInt_t &length)
Sets the length of the binary data stream.
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.
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.

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.
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.

Definition at line 247 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.

248 {
249  return (position / bitsinablock);
250 }
static const UInt_t bitsinablock
Number of bits stored in each data word.
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().

253 {
254  //setNumBits(0);
255  setNumWords(0);
256 }
void setNumWords(const UInt_t &length)
Sets the length of the register to lengths words.
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.

Definition at line 280 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.

References _data, getBit(), getNumBits(), and i.

281 {
282  u_int8_t i;
283  _data.clear();
284  for (i = 0; i < getNumBits(); ++i) {
285  if (getBit(i)) {
286  _data.append("1");
287  } else {
288  _data.append("0");
289  }
290  }
291  return _data;
292 }
Int_t i
Definition: run_full.C:25
const UInt_t & getNumBits() const
Retrieves the length of the register in bits.
bool getBit(const UInt_t &position) const
Determines if bit at position is set.
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.
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).
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).

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().

80 {
81  if (position < reglengthbits) {
82  errcode = 0;
83  return bool (regdata.at(position / bitsinablock) & ((u_int8_t) 1<<(position % bitsinablock)));
84  } else {
86  return false;
87  }
88 }
static const UInt_t bitsinablock
Number of bits stored in each data word.
std::vector< UChar_t > regdata
Internal storage for data structure.
UInt_t errcode
Internal error code.
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().

179 {
180  UInt_t i;
181  _bitblock = 0;
182  if (reverse) {
183  for (i = 0; i < length; ++i) {
184  //setBit(position + length - 1 - i, getIntBit(value, offset + i));
185  setIntBit(offset + i, _bitblock, getBit(position + length - 1 - i));
186  }
187  } else {
188  for (i = 0; i < length; ++i) {
189  //setBit(position + i, getIntBit(value, offset + i));
190  setIntBit(offset + i, _bitblock, getBit(position + i));
191  }
192  }
193  return _bitblock;
194 }
Int_t i
Definition: run_full.C:25
TVector3 offset(2, 0, 0)
bool getBit(const UInt_t &position) const
Determines if bit at position is set.
void setIntBit(const UInt_t &position, UInt_t &value, const bool &state)
Sets a single bit in an integer value.
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.

Definition at line 323 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.

References errcode.

324 {
325  return errcode;
326 }
UInt_t errcode
Internal error code.
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.
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.
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.

Definition at line 45 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.

References reglengthbits.

Referenced by exportBinString(), importBinString(), and resample().

46 {
47  return reglengthbits;
48 }
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.

Definition at line 57 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.

References reglengthwords.

Referenced by PndTopix4::GetRawData(), PndMvdReadInTBData::ReadInRawData(), and PndMQTopix4Sampler::Run().

58 {
59  return reglengthwords;
60 }
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.
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.
const u_int8_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.

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().

146 {
147  if (position < reglengthwords) {
148  errcode = 0;
149  return regdata.at(position);
150  } else {
152  return zeroval;
153  }
154 }
std::vector< UChar_t > regdata
Internal storage for data structure.
UInt_t errcode
Internal error code.
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.

Definition at line 263 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.

References getNumBits(), i, setBit(), and setNumBits().

264 {
265  UInt_t i;
266  UInt_t reglength = data.length();
267  if (getNumBits() < (offset + reglength)) {
268  setNumBits(offset + reglength);
269  }
270  for (i = 0; i < reglength; ++i) {
271  setBit(offset + i, (data.compare(i, 1, "1") == 0));
272  }
273 }
Int_t i
Definition: run_full.C:25
void setBit(const UInt_t &position, const bool &state)
Sets or resets the bit at position.
TVector3 offset(2, 0, 0)
const UInt_t & getNumBits() const
Retrieves the length of the register in bits.
void setNumBits(const UInt_t &length)
Sets the length of the binary data stream.
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.
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.

Definition at line 328 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.

References errcode.

329 {
330  return !(errcode);
331 }
UInt_t errcode
Internal error code.
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.
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.

Definition at line 301 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.

References mrftools::getIntBit(), getNumBits(), regdata, setBit(), and setNumBits().

302 {
303  std::vector<u_int8_t> tmp = regdata;
304  UInt_t newlength = 0;
305  if (reverse) {
306  for (UInt_t i = offset; i < getNumBits(); i += factor) {
307  setBit((i - offset) / factor, getIntBit(bitsinablock - 1 - (i % bitsinablock), tmp.at(i / bitsinablock)));
308  ++newlength;
309  }
310  } else {
311  for (UInt_t i = offset; i < getNumBits(); i += factor) {
312  setBit((i - offset) / factor, getIntBit(i % bitsinablock, tmp.at(i / bitsinablock)));
313  ++newlength;
314  }
315  }
316  if (cutoff == 0) {
317  setNumBits(newlength);
318  } else {
319  setNumBits(cutoff);
320  }
321 }
Int_t i
Definition: run_full.C:25
void setBit(const UInt_t &position, const bool &state)
Sets or resets the bit at position.
TVector3 offset(2, 0, 0)
static const UInt_t bitsinablock
Number of bits stored in each data word.
const UInt_t & getNumBits() const
Retrieves the length of the register in bits.
std::vector< UChar_t > regdata
Internal storage for data structure.
void setNumBits(const UInt_t &length)
Sets the length of the binary data stream.
bool getIntBit(const UInt_t &position, const UInt_t &value)
Retrieves a single bit from an integer value.
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.
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.

259 {
260  return (regdata == other.regdata);
261 }
std::vector< UChar_t > regdata
Internal storage for data structure.
bool TMrfData_8b::sameDataStream ( const TMrfData_8b other) const

Checks data streams for equality.

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

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

References lastreglengthbits, regdata, reglengthbits, and reglengthwords.

222  {
223  ar & reglengthbits;
224  ar & reglengthwords;
225  ar & lastreglengthbits;
226  ar & regdata;
227 
228  }
std::vector< UChar_t > regdata
Internal storage for data structure.
template<class Archive >
void TMrfData_8b::serialize ( Archive &  ar,
const unsigned  int 
)
inline

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

References lastreglengthbits, regdata, reglengthbits, and reglengthwords.

222  {
223  ar & reglengthbits;
224  ar & reglengthwords;
225  ar & lastreglengthbits;
226  ar & regdata;
227 
228  }
std::vector< UChar_t > regdata
Internal storage for data structure.
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.

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().

63 {
64  if ((position < reglengthbits) && (reglengthbits > 0)) {
65  /*
66  if (state) {
67  regdata.at(position / bitsinablock) |= ((mrf::registertype) 1<<(position % bitsinablock));
68  } else {
69  regdata.at(position / bitsinablock) &= (~((mrf::registertype) 1<<(position % bitsinablock))) ;
70  }
71  */
72  setIntBit(position % bitsinablock,(UInt_t&)regdata.at(position / bitsinablock), state);
73  errcode = 0;
74  } else {
76  }
77 }
static const UInt_t bitsinablock
Number of bits stored in each data word.
std::vector< UChar_t > regdata
Internal storage for data structure.
UInt_t errcode
Internal error code.
void setIntBit(const UInt_t &position, UInt_t &value, const bool &state)
Sets a single bit in an integer value.
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.
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.
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.
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.
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.

Definition at line 34 of file MvdOfflineTBAnalysis_Topix4/mrfdata_8b.cxx.

References bitsinablock, lastreglengthbits, regdata, reglengthbits, and reglengthwords.

Referenced by appendBit(), importBinString(), and resample().

35 {
36  reglengthbits = length;
37  reglengthwords = (length + bitsinablock - 1) / bitsinablock;
38  regdata.resize(reglengthwords);
40  if (lastreglengthbits) {
41  regdata.at(reglengthwords-1) &= (~((~0) << lastreglengthbits));
42  }
43 }
static const UInt_t bitsinablock
Number of bits stored in each data word.
std::vector< UChar_t > regdata
Internal storage for data structure.
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.

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().

51 {
52  reglengthwords = length;
53  reglengthbits = length * bitsinablock;
54  regdata.resize(reglengthwords);
55 }
static const UInt_t bitsinablock
Number of bits stored in each data word.
std::vector< UChar_t > regdata
Internal storage for data structure.
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.
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:

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:

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:

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
friend

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

Member Data Documentation

UInt_t TMrfData_8b::_bitblock
mutable

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

Referenced by getBitBlock().

std::string TMrfData_8b::_data
mutable

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

Referenced by exportBinString().

static const UInt_t TMrfData_8b::bitsinablock = sizeof(UChar_t) * CHAR_BIT
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().

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 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
UInt_t TMrfData_8b::reglengthwords
static const UInt_t TMrfData_8b::zeroval = 0
static

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

Referenced by getWord().


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