ATLAS Offline Software
IdDictFieldImplementation.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3  */
4 
12 #include "IdDict/IdDictDefs.h"
13 #include <iostream>
14 #include <sstream>
15 
16 namespace {
17  void tabify(int ntot_spaces, std::stringstream& str) {
18  for (int i = 0; i < ntot_spaces; ++i) {
19  str << " ";
20  }
21  }
22 }
23 
24 const IdDictRange*
26 
27 void
29  m_range = range;
30 }
31 
32 void
34  std::cout << show_to_string() << std::endl;
35 }
36 
37 std::string
39  std::stringstream str;
40  unsigned int pos;
41  unsigned int nchar;
42  str << "decode " << m_decode_index;
43  str << " vals ";
44  pos = str.tellp();
45  // values
46  str << (std::string) m_ored_field;
47  nchar = (unsigned int) str.tellp() - pos;
48  if (nchar < 15) tabify(15 - nchar, str);
49  str << " mask/zero mask/shift/bits/offset ";
50  pos = str.tellp();
51  // mask
52  str << std::hex << m_mask << " ";
53  nchar = (unsigned int) str.tellp() - pos;
54  if (nchar < 4) tabify(4 - nchar, str);
55  // zeroing mask
56  str << m_zeroing_mask << " " << std::dec;
57  pos = str.tellp();
58  // shift
59  str << m_shift << " ";
60  nchar = (unsigned int) str.tellp() - pos;
61  if (nchar < 3) tabify(3 - nchar, str);
62  pos = str.tellp();
63  // bits
64  str << m_bits << " ";
65  nchar = (unsigned int) str.tellp() - pos;
66  if (nchar < 3) tabify(3 - nchar, str);
67  pos = str.tellp();
68  // offset
69  str << m_bits_offset << " ";
70  nchar = (unsigned int) str.tellp() - pos;
71  if (nchar < 3) tabify(3 - nchar, str);
72  str << "indexes ";
73  pos = str.tellp();
74  // indexes
75  for (size_type i = 0; i < m_ored_field.get_indexes().size(); ++i) {
76  str << m_ored_field.get_indexes()[i] << " ";
77  }
78  nchar = (unsigned int) str.tellp() - pos;
79  if (nchar < 20) tabify(20 - nchar, str);
80  str << "mode ";
81  if (m_ored_field.isBounded()) str << "both_bounded ";
82  else if (m_ored_field.isEnumerated()) str << "enumerated ";
83  else str << "unknown ";
84  return(str.str());
85 }
IdDictFieldImplementation::show_to_string
std::string show_to_string(void) const
Definition: IdDictFieldImplementation.cxx:38
IdDictFieldImplementation::m_decode_index
bool m_decode_index
Definition: IdDictFieldImplementation.h:116
IdDictFieldImplementation::m_range
const IdDictRange * m_range
Definition: IdDictFieldImplementation.h:108
IdDictDefs.h
IdDictFieldImplementation::m_bits_offset
size_type m_bits_offset
Definition: IdDictFieldImplementation.h:112
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
IdDictFieldImplementation::m_mask
size_type m_mask
Definition: IdDictFieldImplementation.h:113
IdentifierField::get_indexes
const index_vector & get_indexes() const
Definition: IdentifierField.h:79
lumiFormat.i
int i
Definition: lumiFormat.py:85
IdDictFieldImplementation::m_zeroing_mask
value_type m_zeroing_mask
Definition: IdDictFieldImplementation.h:114
python.LArMinBiasAlgConfig.int
int
Definition: LArMinBiasAlgConfig.py:59
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
IdentifierField::isEnumerated
bool isEnumerated() const
Definition: IdentifierField.h:117
IdDictFieldImplementation::range
const IdDictRange * range() const
Accessors.
Definition: IdDictFieldImplementation.cxx:25
IdDictFieldImplementation::show
void show(void) const
Definition: IdDictFieldImplementation.cxx:33
IdDictFieldImplementation::set_range
void set_range(const IdDictRange *range)
Modifiers.
Definition: IdDictFieldImplementation.cxx:28
IdDictFieldImplementation::m_bits
size_type m_bits
Definition: IdDictFieldImplementation.h:111
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
IdDictFieldImplementation.h
IdentifierField::isBounded
bool isBounded() const
Definition: IdentifierField.h:116
IdDictRange
Definition: IdDictRange.h:18
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
IdDictFieldImplementation::m_ored_field
Range::field m_ored_field
Definition: IdDictFieldImplementation.h:110
str
Definition: BTagTrackIpAccessor.cxx:11
IdDictFieldImplementation::m_shift
size_type m_shift
Definition: IdDictFieldImplementation.h:115
IdDictFieldImplementation::size_type
Identifier::size_type size_type
Definition: IdDictFieldImplementation.h:62