ATLAS Offline Software
DetectorDescription/Identifier/Identifier/Range.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef IDENTIFIER_RANGE_H
6 #define IDENTIFIER_RANGE_H
7 
10 #include <vector>
11 #include <cassert>
12 #include <stdexcept>
13 #include <bit>
14 #include <iosfwd>
15 
29 class Range {
30 public:
31 
35  using field_vector = std::vector<field>;
36 
37 
38  Range () = default;
39 
40 
46  Range (const Range& other, size_type start);
47 
48 
49 
54  Range (const ExpandedIdentifier& root);
55 
56  explicit Range(const std::string & text);
57 
75  void build (const std::string& text);
76 
81  void build (const ExpandedIdentifier& root);
82 
84 
85  void clear ();
86 
88  void add ();
89 
91  void add (element_type value);
92 
95 
97  void add (const field& f);
98 
100  void add (field&& f);
101 
103  void add (const Range& subrange);
104 
106  void add (Range&& subrange);
107 
109  int match (const ExpandedIdentifier& id) const;
110 
112  const field& operator [] (size_type index) const;
113  size_type fields () const;
114  bool is_empty () const;
115 
121  ExpandedIdentifier minimum () const;
122  ExpandedIdentifier maximum () const;
123 
129  size_type cardinality () const;
130  // Up to a given id
131  size_type cardinalityUpTo (const ExpandedIdentifier& id) const;
132 
134  bool overlaps_with (const Range& other) const;
135 
136  void show () const;
137  void show (std::ostream& s) const;
138 
140  operator std::string () const;
141 
142  bool operator == (const Range& other) const;
143 
144 private:
146 };
147 
148 
149 
150 //-----------------------------------------------
151 inline Range::size_type Range::fields () const {
152  return (m_fields.size ());
153 }
154 
155 
156 
157 //-----------------------------------------------
158 inline bool Range::is_empty () const {
159  if (m_fields.size () == 0) return (true);
160  return (false);
161 }
162 
163 
164 std::ostream &
165 operator << (std::ostream &out, const Range &r);
166 
167 std::istream &
168 operator >> (std::istream &in, Range &r);
169 
170 
171 #endif
beamspotman.r
def r
Definition: beamspotman.py:676
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
Range::clear
void clear()
Modifications.
Definition: DetectorDescription/Identifier/src/Range.cxx:125
Range::operator==
bool operator==(const Range &other) const
Definition: DetectorDescription/Identifier/src/Range.cxx:383
Range::size_type
ExpandedIdentifier::size_type size_type
Definition: DetectorDescription/Identifier/Identifier/Range.h:33
Range::match
int match(const ExpandedIdentifier &id) const
Match an identifier.
Definition: DetectorDescription/Identifier/src/Range.cxx:130
Range::show
void show() const
Definition: DetectorDescription/Identifier/src/Range.cxx:335
index
Definition: index.py:1
Range::maximum
ExpandedIdentifier maximum() const
Definition: DetectorDescription/Identifier/src/Range.cxx:187
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
operator<<
std::ostream & operator<<(std::ostream &out, const Range &r)
Definition: DetectorDescription/Identifier/src/Range.cxx:400
athena.value
value
Definition: athena.py:124
ExpandedIdentifier.h
sendEI_SPB.root
root
Definition: sendEI_SPB.py:34
Range::m_fields
field_vector m_fields
Definition: DetectorDescription/Identifier/Identifier/Range.h:145
Range::minimum
ExpandedIdentifier minimum() const
min and max ExpandedIdentifiers (if they exist, ie.
Definition: DetectorDescription/Identifier/src/Range.cxx:158
Range::Range
Range()=default
hist_file_dump.f
f
Definition: hist_file_dump.py:135
operator>>
std::istream & operator>>(std::istream &in, Range &r)
Definition: DetectorDescription/Identifier/src/Range.cxx:406
Range::fields
size_type fields() const
Definition: DetectorDescription/Identifier/Identifier/Range.h:151
ExpandedIdentifier::size_type
boost::container::small_vector< element_type, 12 >::size_type size_type
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:112
Range::operator[]
const field & operator[](size_type index) const
Access the field elements.
Definition: DetectorDescription/Identifier/src/Range.cxx:28
IdentifierField.h
Range::is_empty
bool is_empty() const
Definition: DetectorDescription/Identifier/Identifier/Range.h:158
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
Range::add
void add()
Add a wild card field.
Definition: DetectorDescription/Identifier/src/Range.cxx:75
Range::field_vector
std::vector< field > field_vector
Definition: DetectorDescription/Identifier/Identifier/Range.h:35
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
IdentifierField
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
Definition: IdentifierField.h:21
Range::overlaps_with
bool overlaps_with(const Range &other) const
Check if two Ranges overlap.
Definition: DetectorDescription/Identifier/src/Range.cxx:323
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
ExpandedIdentifier::element_type
int element_type
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:106
Range::cardinality
size_type cardinality() const
Computes a possible cardinality :
Definition: DetectorDescription/Identifier/src/Range.cxx:239
Range::build
void build(const std::string &text)
Build Range from a textual description.
Definition: DetectorDescription/Identifier/src/Range.cxx:58
Range::element_type
ExpandedIdentifier::element_type element_type
Definition: DetectorDescription/Identifier/Identifier/Range.h:32
Range::cardinalityUpTo
size_type cardinalityUpTo(const ExpandedIdentifier &id) const
Get the cardinality from the beginning up to the given ExpandedIdentifier.
Definition: DetectorDescription/Identifier/src/Range.cxx:253