DD4hep  1.28.0
Detector Description Toolkit for High Energy Physics
BitField64.cpp
Go to the documentation of this file.
2 
3 #include <cmath>
4 #include <algorithm>
5 #include <stdexcept>
6 
7 namespace dd4hep{
8 
9 namespace DDSegmentation {
10 
11 
12  std::string BitField64::valueString() const {
13 
14  std::stringstream os ;
15 
16  for(unsigned i=0;i<size();i++){
17 
18  if( i != 0 ) os << "," ;
19 
20  os << _coder->fields()[i].name() << ":" << _coder->get( _value , i ) ;
21 
22  }
23  return os.str() ;
24  }
25 
26 
27  std::ostream& operator<<(std::ostream& os, const BitField64& b){
28 
29  os << " bitfield: 0x" << std::hex // << std::ios::width(16) << std::ios::fill('0') <<
30  << b._value << std::dec << std::endl ;
31 
32 
33  for(unsigned i=0;i<b._coder->size();i++){
34 
35  const BitFieldElement& bv = b._coder->fields()[i] ;
36 
37  os << " " << bv.name()
38  << " [" << bv.offset() << ":" ;
39 
40  if( bv.isSigned() ) os << "-" ;
41 
42  os << bv.width() << "] : " ;
43 
44  os << b._coder->get( b._value , i)
45  << std::endl ;
46 
47  }
48 
49  return os ;
50  }
51 
52 } // namespace
53 
54 } // namespace
dd4hep::DDSegmentation::BitFieldElement::offset
unsigned offset() const
Definition: BitFieldCoder.h:64
dd4hep::DDSegmentation::BitFieldElement
Helper class for BitFieldCoder that corresponds to one field value.
Definition: BitFieldCoder.h:32
dd4hep::DDSegmentation::BitField64::_value
CellID _value
Definition: BitField64.h:230
dd4hep::DDSegmentation::BitFieldElement::isSigned
bool isSigned() const
Definition: BitFieldCoder.h:70
dd4hep::DDSegmentation::BitFieldCoder::get
FieldID get(CellID bitfield, size_t idx) const
Definition: BitFieldCoder.h:165
dd4hep::DDSegmentation::BitField64
A bit field of 64bits that allows convenient declaration.
Definition: BitField64.h:110
dd4hep::DDSegmentation::BitFieldCoder::fields
const std::vector< BitFieldElement > & fields() const
Definition: BitFieldCoder.h:218
dd4hep::DDSegmentation::BitField64::valueString
std::string valueString() const
Definition: BitField64.cpp:12
BitField64.h
dd4hep::DDSegmentation::BitFieldElement::name
const std::string & name() const
Definition: BitFieldCoder.h:61
dd4hep::DDSegmentation::BitFieldElement::width
unsigned width() const
Definition: BitFieldCoder.h:67
dd4hep::DDSegmentation::BitField64::_coder
const BitFieldCoder * _coder
Definition: BitField64.h:231
dd4hep::DDSegmentation::BitField64::size
size_t size() const
Definition: BitField64.h:186
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::DDSegmentation::BitFieldCoder::size
size_t size() const
Definition: BitFieldCoder.h:192
dd4hep::DDSegmentation::operator<<
std::ostream & operator<<(std::ostream &os, const BitField64 &b)
Definition: BitField64.cpp:27