ATLAS Offline Software
IdDictRange.h
Go to the documentation of this file.
1  /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef IDDICT_IdDictRange_H
6 #define IDDICT_IdDictRange_H
7 
9 #include <string>
10 #include <vector>
11 
12 class IdDictMgr;
13 class IdDictDictionary;
14 class IdDictRegion;
15 class Range;
16 class IdDictField;
17 
18 class IdDictRange : public IdDictRegionEntry {
19 public:
26  by_minmax
27  };
34  };
35 
36 
37  // ==================================
38  //** @name Constructor/destructor
39  // @{
40 
42  IdDictRange (const std::string& field_name);
43 
45  IdDictRange (const std::string& field_name, const std::string& label);
46 
48  IdDictRange (const std::string& field_name, int value);
49 
51  IdDictRange (const std::string& field_name, int minvalue, int maxvalue);
52 
54  IdDictRange (const std::string& field_name, const std::vector<int>& values);
55 
57  IdDictRange (const std::string& field_name,
58  const std::vector<std::string>& labels);
59 
60  virtual ~IdDictRange () = default;
61 
62 
64  // ==================================
65  //** @name Simple accessors.
66  // @{
67 
68  const std::string& field_name() const;
69  const std::string& label() const;
70  const IdDictField* field() const;
72  const std::vector<int>& values() const;
73  const std::vector<std::string>& labels() const;
74 
75 
77  // ==================================
78  //** @name Methods used to initialize the object.
79  // @{
80 
82  void set_range (const std::string& label);
83 
85  void set_range (int value);
86 
88  void set_range (int minvalue, int maxvalue);
89 
91  void set_range (const std::vector<int>& values);
92 
94  void set_range (const std::vector<std::string>& labels);
95 
96 
98  void set_prev(int prev);
99 
100 
102  void set_next(int next);
103 
104 
106  void set_wrap_around();
107 
108  virtual void resolve_references (const IdDictMgr& idd,
110  IdDictRegion& region) override;
111  virtual void generate_implementation (const IdDictMgr& idd,
113  IdDictRegion& region,
114  const std::string& tag = "") override;
115  virtual Range build_range () const override;
116 
117 
119 
120 
121 private:
122  std::string m_field_name;
124 
126  std::string m_tag;
127  std::string m_label;
128  int m_value{};
129  int m_minvalue{};
130  int m_maxvalue{};
134  std::vector <std::string> m_labels;
135  std::vector <int> m_values;
136 
138 };
139 
140 
141 inline
142 const std::string& IdDictRange::field_name() const
143 {
144  return m_field_name;
145 }
146 
147 
148 inline
149 const std::string& IdDictRange::label() const
150 {
151  return m_label;
152 }
153 
154 
155 inline
157 {
158  return m_field;
159 }
160 
161 
162 inline
164 {
165  return m_specification;
166 }
167 
168 
169 inline
170 const std::vector<int>& IdDictRange::values() const
171 {
172  return m_values;
173 }
174 
175 
176 inline
177 const std::vector<std::string>& IdDictRange::labels() const
178 {
179  return m_labels;
180 }
181 
182 
183 #endif
184 
IdDictRange::generate_implementation
virtual void generate_implementation(const IdDictMgr &idd, IdDictDictionary &dictionary, IdDictRegion &region, const std::string &tag="") override
Definition: IdDictRange.cxx:178
IdDictRange::set_prev
void set_prev(int prev)
Set previous value and adjust continuation mode.
Definition: IdDictRange.cxx:109
IdDictRange::resolve_references
virtual void resolve_references(const IdDictMgr &idd, IdDictDictionary &dictionary, IdDictRegion &region) override
Definition: IdDictRange.cxx:132
IdDictRange::continuation_mode
continuation_mode
Definition: IdDictRange.h:28
IdDictRange::by_minmax
@ by_minmax
Definition: IdDictRange.h:26
IdDictRange::by_label
@ by_label
Definition: IdDictRange.h:24
IdDictRange::build_range
virtual Range build_range() const override
Definition: IdDictRange.cxx:238
IdDictRange::m_field_name
std::string m_field_name
Definition: IdDictRange.h:122
IdDictRange::by_labels
@ by_labels
Definition: IdDictRange.h:25
IdDictRange::specification_type
specification_type
Definition: IdDictRange.h:20
IdDictRange::set_wrap_around
void set_wrap_around()
Enable wraparound.
Definition: IdDictRange.cxx:125
athena.value
value
Definition: athena.py:124
IdDictRange::m_tag
std::string m_tag
Definition: IdDictRange.h:126
IdDictRange::none
@ none
Definition: IdDictRange.h:29
IdDictRange::set_next
void set_next(int next)
Set next value and adjust continuation mode.
Definition: IdDictRange.cxx:117
IdDictRange::m_specification
specification_type m_specification
Definition: IdDictRange.h:125
IdDictRegionEntry.h
IdDictRange::field
const IdDictField * field() const
Definition: IdDictRange.h:156
IdDictRegion
Definition: IdDictRegion.h:20
IdDictRange::m_field
IdDictField * m_field
Definition: IdDictRange.h:123
IdDictRange::has_previous
@ has_previous
Definition: IdDictRange.h:31
IdDictMgr
Definition: IdDictMgr.h:14
IdDictRange::m_maxvalue
int m_maxvalue
Definition: IdDictRange.h:130
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
IdDictRange::values
const std::vector< int > & values() const
Definition: IdDictRange.h:170
IdDictRange::has_both
@ has_both
Definition: IdDictRange.h:32
IdDictRange::m_prev_value
int m_prev_value
Definition: IdDictRange.h:131
IdDictRange::unknown
@ unknown
Definition: IdDictRange.h:21
IdDictRange::m_value
int m_value
Definition: IdDictRange.h:128
IdDictRange::label
const std::string & label() const
Definition: IdDictRange.h:149
IdDictRange::~IdDictRange
virtual ~IdDictRange()=default
master.dictionary
dictionary
Definition: master.py:47
IdDictRange::m_labels
std::vector< std::string > m_labels
Definition: IdDictRange.h:134
IdDictRange::has_next
@ has_next
Definition: IdDictRange.h:30
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
IdDictRange::m_continuation_mode
continuation_mode m_continuation_mode
Definition: IdDictRange.h:133
IdDictDictionary
Definition: IdDictDictionary.h:30
IdDictRegionEntry
Definition: IdDictRegionEntry.h:14
IdDictRange
Definition: IdDictRange.h:18
IdDictRange::set_range
void set_range(const std::string &label)
By label.
Definition: IdDictRange.cxx:68
IdDictRange::labels
const std::vector< std::string > & labels() const
Definition: IdDictRange.h:177
IdDictRange::IdDictRange
IdDictRange(const std::string &field_name)
Set name only; no range information.
Definition: IdDictRange.cxx:16
IdDictRange::m_resolved_references
bool m_resolved_references
Definition: IdDictRange.h:137
IdDictRange::by_values
@ by_values
Definition: IdDictRange.h:23
IdDictRange::specification
specification_type specification() const
Definition: IdDictRange.h:163
IdDictRange::m_label
std::string m_label
Definition: IdDictRange.h:127
IdDictRange::by_value
@ by_value
Definition: IdDictRange.h:22
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:23
IdDictField
Definition: IdDictField.h:15
IdDictRange::wrap_around
@ wrap_around
Definition: IdDictRange.h:33
IdDictRange::field_name
const std::string & field_name() const
Definition: IdDictRange.h:142
IdDictRange::m_minvalue
int m_minvalue
Definition: IdDictRange.h:129
IdDictRange::m_next_value
int m_next_value
Definition: IdDictRange.h:132
IdDictRange::m_values
std::vector< int > m_values
Definition: IdDictRange.h:135