Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

UTIL::BitField64 Class Reference

#include <BitField64.h>

Inheritance diagram for UTIL::BitField64:

UTIL::CellIDEncoder< T > List of all members.

Public Types

typedef std::map< std::string,
unsigned int > 
IndexMap

Public Member Functions

 ~BitField64 ()
 BitField64 (const std::string &initString)
lcio::long64 getValue ()
void setValue (lcio::long64 value)
BitFieldValueoperator[] (size_t index)
const BitFieldValueoperator[] (size_t index) const
unsigned highestBit ()
size_t size ()
size_t index (const std::string &name) const
BitFieldValueoperator[] (const std::string &name)
const BitFieldValueoperator[] (const std::string &name) const
unsigned lowWord () const
unsigned highWord () const
std::string fieldDescription () const
std::string valueString () const

Protected Member Functions

void addField (const std::string &name, unsigned offset, int width)
void init (const std::string &initString)
 BitField64 ()

Protected Attributes

std::vector< BitFieldValue * > _fields
lcio::long64 _value
IndexMap _map
lcio::long64 _joined

Friends

std::ostream & operator<< (std::ostream &os, const BitField64 &b)

Detailed Description

A bit field of 64bits that allows convenient declaration and manipulation of sub fields of various widths.
Example:
BitField64 b("layer:7,system:-3,barrel:3,theta:32:11,phi:11" ) ;
b[ "layer" ] = 123 ;
b[ "system" ] = -4 ;
b[ "barrel" ] = 7 ;
b[ "theta" ] = 180 ;
b[ "phi" ] = 270 ;
...
int theta = b["theta"] ;
...
unsigned phiIndex = b.index("phi) ;
int phi = b[ phiIndex ] ;

Definition at line 132 of file BitField64.h.


Member Typedef Documentation

typedef std::map<std::string, unsigned int> UTIL::BitField64::IndexMap
 

Definition at line 138 of file BitField64.h.


Constructor & Destructor Documentation

UTIL::BitField64::~BitField64  )  [inline]
 

Definition at line 141 of file BitField64.h.

UTIL::BitField64::BitField64 const std::string &  initString  )  [inline]
 

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. If omitted assumed to start immediately following previous field, or at the least significant bit if the first field.
length: The number of bits in the field. If preceeded by '-' the field is signed, otherwise unsigned.
Bit numbering is from the least significant bit (bit 0) to the most significant (bit 63).
Example: "layer:7,system:-3,barrel:3,theta:32:11,phi:11"

Definition at line 161 of file BitField64.h.

UTIL::BitField64::BitField64  )  [inline, protected]
 

No default c'tor

Definition at line 241 of file BitField64.h.


Member Function Documentation

void UTIL::BitField64::addField const std::string &  name,
unsigned  offset,
int  width
[protected]
 

Add an additional field to the list

Definition at line 169 of file BitField64.cc.

References _fields, _joined, _map, _value, and UTIL::BitFieldValue::mask().

Referenced by init().

std::string UTIL::BitField64::fieldDescription  )  const
 

Return a valid description string of all fields

Definition at line 133 of file BitField64.cc.

References _fields.

lcio::long64 UTIL::BitField64::getValue  )  [inline]
 

Returns the current 64bit value

Definition at line 168 of file BitField64.h.

unsigned UTIL::BitField64::highestBit  ) 
 

Highest bit used in fields [0-63]

Definition at line 106 of file BitField64.cc.

References _fields.

unsigned UTIL::BitField64::highWord  )  const [inline]
 

The high word, bits 32-63

Definition at line 218 of file BitField64.h.

size_t UTIL::BitField64::index const std::string &  name  )  const
 

Index for field named 'name'

Definition at line 94 of file BitField64.cc.

References _map.

void UTIL::BitField64::init const std::string &  initString  )  [protected]
 

Decode the initialization string as described in the constructor.

See also:
BitField64( const std::string& initString )

Definition at line 192 of file BitField64.cc.

References addField().

unsigned UTIL::BitField64::lowWord  )  const [inline]
 

The low word, bits 0-31

Definition at line 214 of file BitField64.h.

const BitFieldValue& UTIL::BitField64::operator[] const std::string &  name  )  const [inline]
 

Const Access to field through name .

Definition at line 206 of file BitField64.h.

BitFieldValue& UTIL::BitField64::operator[] const std::string &  name  )  [inline]
 

Access to field through name .

Definition at line 200 of file BitField64.h.

const BitFieldValue& UTIL::BitField64::operator[] size_t  index  )  const [inline]
 

Const acces to field through index

Definition at line 183 of file BitField64.h.

BitFieldValue& UTIL::BitField64::operator[] size_t  index  )  [inline]
 

Acces to field through index

Definition at line 177 of file BitField64.h.

void UTIL::BitField64::setValue lcio::long64  value  )  [inline]
 

Set a new 64bit value

Definition at line 172 of file BitField64.h.

Referenced by UTIL::CellIDDecoder< T >::operator()().

size_t UTIL::BitField64::size  )  [inline]
 

Number of values

Definition at line 192 of file BitField64.h.

std::string UTIL::BitField64::valueString  )  const
 

Return a string with a comma separated list of the current sub field values

Definition at line 119 of file BitField64.cc.

References _fields.


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  os,
const BitField64 b
[friend]
 

Operator for dumping BitField64 to streams

Definition at line 248 of file BitField64.cc.


Member Data Documentation

std::vector<BitFieldValue*> UTIL::BitField64::_fields [protected]
 

Definition at line 246 of file BitField64.h.

Referenced by addField(), fieldDescription(), highestBit(), and valueString().

lcio::long64 UTIL::BitField64::_joined [protected]
 

Definition at line 249 of file BitField64.h.

Referenced by addField().

IndexMap UTIL::BitField64::_map [protected]
 

Definition at line 248 of file BitField64.h.

Referenced by addField(), index(), and UTIL::operator<<().

lcio::long64 UTIL::BitField64::_value [protected]
 

Definition at line 247 of file BitField64.h.

Referenced by addField(), and UTIL::operator<<().


The documentation for this class was generated from the following files:
Generated on Sun Jun 3 06:32:40 2007 for A TPC Tracking Environment by  doxygen 1.3.9.1