ATLAS Offline Software
Loading...
Searching...
No Matches
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
29class Range {
30public:
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 (element_type value);
89
92
94 void add (const field& f);
95
97 void add (field&& f);
98
100 void add (const Range& subrange);
101
103 void add (Range&& subrange);
104
106 int match (const ExpandedIdentifier& id) const;
107
109 const field& operator [] (size_type index) const;
110 size_type fields () const;
111 bool is_empty () const;
112
118 ExpandedIdentifier minimum () const;
119 ExpandedIdentifier maximum () const;
120
126 size_type cardinality () const;
127 // Up to a given id
129
131 bool overlaps_with (const Range& other) const;
132
133 void show () const;
134 void show (std::ostream& s) const;
135
137 operator std::string () const;
138
139 bool operator == (const Range& other) const;
140
141private:
143};
144
145
146
147//-----------------------------------------------
149 return (m_fields.size ());
150}
151
152
153
154//-----------------------------------------------
155inline bool Range::is_empty () const {
156 if (m_fields.size () == 0) return (true);
157 return (false);
158}
159
160
161std::ostream &
162operator << (std::ostream &out, const Range &r);
163
164std::istream &
165operator >> (std::istream &in, Range &r);
166
167
168#endif
std::ostream & operator<<(std::ostream &out, const Range &r)
std::istream & operator>>(std::istream &in, Range &r)
boost::container::small_vector< element_type, 12 >::size_type size_type
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
ExpandedIdentifier maximum() const
int match(const ExpandedIdentifier &id) const
Match an identifier.
Range()=default
ExpandedIdentifier minimum() const
min and max ExpandedIdentifiers (if they exist, ie.
bool operator==(const Range &other) const
void add(element_type value)
Add a required value. (ie. low = high = value)
ExpandedIdentifier::element_type element_type
size_type cardinalityUpTo(const ExpandedIdentifier &id) const
Get the cardinality from the beginning up to the given ExpandedIdentifier.
ExpandedIdentifier::size_type size_type
void build(const std::string &text)
Build Range from a textual description.
const field & operator[](size_type index) const
Access the field elements.
bool overlaps_with(const Range &other) const
Check if two Ranges overlap.
size_type cardinality() const
Computes a possible cardinality :
int r
Definition globals.cxx:22
Definition index.py:1