ATLAS Offline Software
Loading...
Searching...
No Matches
IdDictRange.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2026 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 <string_view>
11#include <vector>
12
13class IdDictMgr;
15class IdDictRegion;
16class Range;
17class IdDictField;
18
20public:
36
37
38 // ==================================
39 //** @name Constructor/destructor
40 // @{
41
43 IdDictRange (const std::string& field_name);
44
46 IdDictRange (const std::string& field_name, const std::string& label);
47
49 IdDictRange (const std::string& field_name, int value);
50
52 IdDictRange (const std::string& field_name, int minvalue, int maxvalue);
53
55 IdDictRange (const std::string& field_name, const std::vector<int>& values);
56
58 IdDictRange (const std::string& field_name,
59 const std::vector<std::string>& labels);
60
61 virtual ~IdDictRange () = default;
62
63
65 // ==================================
66 //** @name Simple accessors.
67 // @{
68
69 const std::string& field_name() const;
70 const std::string& label() const;
71 const IdDictField* field() const;
73 const std::vector<int>& values() const;
74 const std::vector<std::string>& labels() const;
75
76
78 // ==================================
79 //** @name Methods used to initialize the object.
80 // @{
81
83 void set_range (const std::string& label);
84
86 void set_range (int value);
87
89 void set_range (int minvalue, int maxvalue);
90
92 void set_range (const std::vector<int>& values);
93
95 void set_range (const std::vector<std::string>& labels);
96
97
99 void set_prev(int prev);
100
101
103 void set_next(int next);
104
105
107 void set_wrap_around();
108
109 virtual void resolve_references (IdDictMgr& idd,
110 IdDictDictionary& dictionary,
111 IdDictRegion& region) override;
112 virtual void generate_implementation (const IdDictMgr& idd,
113 IdDictDictionary& dictionary,
114 IdDictRegion& region,
115 std::string_view tag = "") override;
116 virtual Range build_range () const override;
117
118
120
121
122private:
123 std::string m_field_name;
125
127 std::string m_tag;
128 std::string m_label;
129 int m_value{};
135 std::vector <std::string> m_labels;
136 std::vector <int> m_values;
137
139};
140
141
142inline
143const std::string& IdDictRange::field_name() const
144{
145 return m_field_name;
146}
147
148
149inline
150const std::string& IdDictRange::label() const
151{
152 return m_label;
153}
154
155
156inline
158{
159 return m_field;
160}
161
162
163inline
168
169
170inline
171const std::vector<int>& IdDictRange::values() const
172{
173 return m_values;
174}
175
176
177inline
178const std::vector<std::string>& IdDictRange::labels() const
179{
180 return m_labels;
181}
182
183
184#endif
185
std::vector< int > m_values
std::string m_tag
virtual ~IdDictRange()=default
const std::string & field_name() const
const std::string & label() const
const std::vector< int > & values() const
void set_range(const std::string &label)
By label.
virtual Range build_range() const override
std::string m_label
void set_next(int next)
Set next value and adjust continuation mode.
void set_prev(int prev)
Set previous value and adjust continuation mode.
std::vector< std::string > m_labels
virtual void generate_implementation(const IdDictMgr &idd, IdDictDictionary &dictionary, IdDictRegion &region, std::string_view tag="") override
specification_type specification() const
IdDictRange(const std::string &field_name)
Set name only; no range information.
std::string m_field_name
const IdDictField * field() const
virtual void resolve_references(IdDictMgr &idd, IdDictDictionary &dictionary, IdDictRegion &region) override
specification_type m_specification
void set_wrap_around()
Enable wraparound.
continuation_mode m_continuation_mode
const std::vector< std::string > & labels() const
bool m_resolved_references
IdDictField * m_field
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
std::string label(const std::string &format, int i)
Definition label.h:19