8 #ifndef __MRFDATA_8b_H__
9 #define __MRFDATA_8b_H__
20 #include <boost/archive/archive_exception.hpp>
21 #include <boost/serialization/access.hpp>
22 #include <boost/serialization/base_object.hpp>
23 #include <boost/serialization/vector.hpp>
29 namespace mrfdata_8b_error {
43 TMrfData_8b(UInt_t _reglengthbits,UInt_t _reglengthwords,UInt_t _lastreglengthbits,std::vector<UChar_t> _regdata );
78 void setBit(
const UInt_t& position,
const bool& state);
85 bool getBit(
const UInt_t& position)
const;
92 const UInt_t&
appendBit(
const bool& state);
104 void setWord(
const UInt_t& position,
const UChar_t& dataword,
const bool& truncate_ok =
false);
117 void setWordMasked(
const UInt_t& position,
const UChar_t& dataword,
const UChar_t& mask = ~0,
const bool& truncate_ok =
false);
124 const UChar_t&
getWord(
const UInt_t& position)
const;
126 const UChar_t&
appendWord(
const UChar_t &dataword);
136 void setBitBlock(
const UInt_t& position,
const UInt_t& length,
const UChar_t& value,
const UInt_t&
offset = 0,
const bool& reverse =
false);
138 const UInt_t&
getBitBlock(
const UInt_t& position,
const UInt_t& length,
const UInt_t&
offset = 0,
const bool& reverse =
false)
const;
148 UInt_t
bitInBlock(
const UInt_t& position)
const;
189 void resample(
const UInt_t&
offset,
const UInt_t& factor,
const bool& reverse =
false,
const UInt_t& cutoff = 0);
212 static const UInt_t
zeroval = 0;
214 mutable std::string
_data;
218 friend class boost::serialization::access;
220 template<
class Archive>
238 static const UInt_t
bitsinablock =
sizeof(UChar_t) * CHAR_BIT;
250 #endif // __MRFDATA_8b_H__
static const UInt_t not_found
static const UInt_t out_of_bounds
void setNumWords(const UInt_t &length)
Sets the length of the register to lengths words.
static const UInt_t success
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.
static const UInt_t zeroval
void setBit(const UInt_t &position, const bool &state)
Sets or resets the bit at position.
const UInt_t & appendBit(const bool &state)
Appends a bit to the data stream.
bool lastActionSuccessful() const
Returns True if the last action completed successfullly, False otherwise.
static const UInt_t bitsinablock
Number of bits stored in each data word.
const std::string & exportBinString() const
Exports a data stream to a string representing binary digits.
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.
const UInt_t & getNumBits() const
Retrieves the length of the register in bits.
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.
Base interface class for data storage and manipulation. Compatible with IO classes from MRF Suite...
std::vector< UChar_t > regdata
Internal storage for data structure.
void setWord(const UInt_t &position, const UChar_t &dataword, const bool &truncate_ok=false)
Sets a complete data word at position to value.
void clearDataStream()
Sets a bitfield within the data storage based on the configuration stored in the map parameter bitmap...
void serialize(Archive &ar, const unsigned int)
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.
const UChar_t & getWord(const UInt_t &position) const
Retrieves the word found at position.
void setNumBits(const UInt_t &length)
Sets the length of the binary data stream.
static const UInt_t size_mismatch
void importBinString(const std::string &data, const UInt_t &offset=0)
Imports a data stream from a string representing binary digits.
UInt_t errcode
Internal error code.
const UInt_t & getLastError() const
Returns an integer with errorflags of all errors occured after last successful command.
const UChar_t & appendWord(const UChar_t &dataword)
bool getBit(const UInt_t &position) const
Determines if bit at position is set.
const UInt_t & getNumWords() const
Retrieves the length of the register in words.
bool sameDataStream(const TMrfData_8b &other) const
Checks data streams for equality.