1 #ifndef UTIL_BitField64_H
2 #define UTIL_BitField64_H 1
12 #include "LCIOTypes.h"
23 std::vector< std::string >& _tokens ;
42 _tokens.push_back(
"") ;
66 unsigned offset,
int signedWidth ) ;
89 const std::string&
name()
const {
return _name ; }
92 unsigned offset()
const {
return _offset ; }
95 unsigned width()
const {
return _width ; }
138 typedef std::map<std::string, unsigned int> IndexMap ;
142 for(
unsigned i=0;i<_fields.size();i++){
161 BitField64(
const std::string& initString ) : _value(0), _joined(0){
181 return *_fields.at( theIndex ) ;
187 return *_fields.at( theIndex ) ;
195 size_t size()
const {
return _fields.size() ; }
199 size_t index(
const std::string& name)
const ;
205 return *_fields[
index( name ) ] ;
211 return *_fields[
index( name ) ] ;
217 unsigned lowWord()
const {
return unsigned( _value & 0xffffFFFF ) ; }
221 unsigned highWord()
const {
return unsigned( _value >> 32 ) ; }
236 void addField(
const std::string& name,
unsigned offset,
int width );
241 void init(
const std::string& initString) ;
249 std::vector<BitFieldValue*> _fields ;
261 std::ostream&
operator<<(std::ostream& os,
const BitField64& b) ;
BitFieldValue & operator=(lcio::long64 in)
Assignment operator for user convenience.
Definition: BitField64.cc:75
LCTokenizer(std::vector< std::string > &tokens, char del)
Only c'tor, give (empty) token vector and delimeter character.
Definition: BitField64.h:30
unsigned highestBit() const
Highest bit used in fields [0-63].
Definition: BitField64.cc:109
std::ostream & operator<<(std::ostream &os, const BitField64 &b)
Operator for dumping BitField64 to streams.
Definition: BitField64.cc:251
unsigned width() const
The field's width.
Definition: BitField64.h:95
unsigned long long ulong64
64 bit unsigned integer,e.g.to be used for masks
Definition: LCIOTypes.h:17
bool isSigned() const
True if field is interpreted as signed.
Definition: BitField64.h:98
BitFieldValue(lcio::long64 &bitfield, const std::string &name, unsigned offset, int signedWidth)
The default c'tor.
Definition: BitField64.cc:11
std::string fieldDescription() const
Return a valid description string of all fields.
Definition: BitField64.cc:136
size_t index(const std::string &name) const
Index for field named 'name'.
Definition: BitField64.cc:97
A bit field of 64bits that allows convenient declaration and manipulation of sub fields of various wi...
Definition: BitField64.h:132
Helper class for BitField64 that corresponds to one field value.
Definition: BitField64.h:55
lcio::ulong64 mask() const
The field's mask.
Definition: BitField64.h:101
std::string valueString() const
Return a string with a comma separated list of the current sub field values.
Definition: BitField64.cc:122
long long long64
64 bit signed integer,e.g.to be used for timestamps
Definition: LCIOTypes.h:14
const std::string & name() const
fg: removed because it causes ambiguities with operator lcio::long64().
Definition: BitField64.h:89
BitFieldValue & operator[](size_t theIndex)
Acces to field through index.
Definition: BitField64.h:180
BitFieldValue & operator[](const std::string &name)
Access to field through name .
Definition: BitField64.h:203
lcio::long64 value() const
Returns the current field value.
Definition: BitField64.cc:56
BitField64(const std::string &initString)
The c'tor takes an initialization string of the form: <fieldDesc>[,<fieldDesc>...] fieldDesc = name:[start]:[-]length where: name: The name of the field start: The start bit of the field.
Definition: BitField64.h:161
void addField(const std::string &name, unsigned offset, int width)
Add an additional field to the list.
Definition: BitField64.cc:172
void operator()(const char &c)
Operator for use with algorithms, e.g.
Definition: BitField64.h:37
friend std::ostream & operator<<(std::ostream &os, const BitField64 &b)
Operator for dumping BitField64 to streams.
Definition: BitField64.cc:251
unsigned offset() const
The field's offset.
Definition: BitField64.h:92
unsigned highWord() const
The high word, bits 32-63.
Definition: BitField64.h:221
void reset()
Reset - same as setValue(0) - useful if the same encoder is used for many objects.
Definition: BitField64.h:176
void setValue(lcio::long64 value)
Set a new 64bit value.
Definition: BitField64.h:172
lcio::long64 getValue() const
Returns the current 64bit value.
Definition: BitField64.h:168
Helper class for string tokenization.
Definition: BitField64.h:21
BitField64()
No default c'tor.
Definition: BitField64.h:244
unsigned lowWord() const
The low word, bits 0-31.
Definition: BitField64.h:217
size_t size() const
Number of values.
Definition: BitField64.h:195
utility class to manage indexes according to Collection Parameters
Definition: IndexMap.h:21
const BitFieldValue & operator[](const std::string &name) const
Const Access to field through name .
Definition: BitField64.h:209
void init(const std::string &initString)
Decode the initialization string as described in the constructor.
Definition: BitField64.cc:195
const BitFieldValue & operator[](size_t theIndex) const
Const acces to field through index.
Definition: BitField64.h:186