1 #ifndef BITFIELDCODER_H 2 #define BITFIELDCODER_H 28 Tokenizer( std::vector< std::string >& tokens,
char del )
29 : _tokens(tokens), _del(del), _last(del)
39 _tokens.push_back(
"") ;
72 long64
value(long64 bitfield)
const;
75 void set(long64& bitfield, long64
value)
const ;
81 unsigned offset()
const {
return _offset ; }
84 unsigned width()
const {
return _width ; }
90 ulong64
mask()
const {
return _mask ; }
134 typedef std::map<std::string, unsigned int>
IndexMap ;
169 static long64
toLong(
unsigned low_Word,
unsigned high_Word ) {
return ( ( low_Word & 0xffffffffULL ) | ( ( high_Word & 0xffffffffULL ) << 32 ) ); }
173 static unsigned lowWord(long64 bitfield) {
return unsigned( bitfield & 0xffffFFFFUL ); }
177 static unsigned highWord(long64 bitfield) {
return unsigned( bitfield >> 32); }
181 long64
get(long64 bitfield,
size_t index)
const {
return _fields.at(
index).value( bitfield ); }
189 void set(long64& bitfield,
size_t index, ulong64
value)
const { _fields.at(index).set( bitfield ,
value ); }
197 unsigned highestBit()
const ;
201 size_t size()
const {
return _fields.size() ; }
223 const std::vector<BitFieldValue>&
fields()
const {
return _fields;}
226 ulong64
mask()
const {
return _joined ; }
232 void addField(
const std::string& name,
unsigned offset,
int width );
243 std::vector<BitFieldValue> _fields{};
static unsigned highWord(long64 bitfield)
void operator()(const char &c)
std::vector< std::string > & _tokens
Helper class for BitFieldCoder that corresponds to one field value.
static unsigned lowWord(long64 bitfield)
BitFieldCoder(const std::string &initString)
const BitFieldValue & operator[](unsigned index) const
const BitFieldValue & operator[](const std::string &name) const
const std::vector< BitFieldValue > & fields() const
Tokenizer(std::vector< std::string > &tokens, char del)
static long64 toLong(unsigned low_Word, unsigned high_Word)
Helper class for decoding and encoding a bit field of 64bits for convenient declaration.
General GArSoft Utilities.
std::map< std::string, unsigned int > IndexMap
const std::string & name() const
LArSoft geometry interface.
unsigned long long ulong64