ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DetectorDescription
IdDict
src
IdDictAltRegions.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
IdDict/IdDictAltRegions.h
"
6
#include "
IdDict/IdDictRegion.h
"
7
#include "
Identifier/Range.h
"
8
#include "
IdDict/IdDictFieldImplementation.h
"
9
10
#include <iostream>
11
15
IdDictAltRegions::IdDictAltRegions
()
16
:
17
m_selected_region
(0) {
18
}
19
20
IdDictAltRegions::~IdDictAltRegions
() =
default
;
21
22
std::string
23
IdDictAltRegions::group_name
()
const
{
24
std::string result;
25
if
(!
m_regions
.empty()) result =
m_regions
.begin()->second->group_name();
26
return
(result);
27
}
28
29
void
30
IdDictAltRegions::set_index
(
size_t
index
) {
31
for
(
auto
& p :
m_regions
) {
32
p.second->set_index(
index
);
33
}
34
}
35
36
void
37
IdDictAltRegions::resolve_references
(
IdDictMgr
& idd,
38
IdDictDictionary
& dictionary) {
39
// We assume that it is not necessary to select only those with
40
// the correct tag -> send to all in map
41
for
(
auto
& p :
m_regions
) {
42
p.second->resolve_references(idd, dictionary);
43
}
44
}
45
46
void
47
IdDictAltRegions::generate_implementation
(
const
IdDictMgr
& idd,
48
IdDictDictionary
& dictionary,
49
std::string_view tag) {
50
// Find the region given by the tag
51
map_iterator
region_it =
m_regions
.find(tag);
52
53
if
(region_it ==
m_regions
.end()) {
54
std::cout <<
"IdDictAltRegions::generate_implementation could not find region for tag "
55
<< tag <<
" Keys in map "
<< std::endl;
56
for
(
int
i = 0;
const
auto
& p :
m_regions
) {
57
std::cout <<
" i "
<< i++ <<
" key "
<< p.first;
58
}
59
std::cout << std::endl;
60
return
;
61
}
62
m_selected_region
= region_it->second.get();
63
m_selected_region
->generate_implementation(idd, dictionary, tag);
64
}
65
66
void
67
IdDictAltRegions::reset_implementation
() {
68
if
(
m_selected_region
)
m_selected_region
->reset_implementation();
69
}
70
71
bool
72
IdDictAltRegions::verify
()
const
{
73
return
(
true
);
74
}
75
76
void
77
IdDictAltRegions::clear
() {
78
m_regions
.clear();
79
}
80
81
Range
82
IdDictAltRegions::build_range
()
const
{
83
Range
result;
84
85
if
(
m_selected_region
) result =
m_selected_region
->build_range();
86
return
(result);
87
}
88
89
91
void
IdDictAltRegions::add_region
(std::unique_ptr<IdDictRegion> region)
92
{
93
m_regions
[region->tag()] = std::move(region);
94
}
95
96
98
void
IdDictAltRegions::select_region
(
const
std::string& name)
99
{
100
map_iterator
region_it =
m_regions
.find (name);
101
if
(region_it ==
m_regions
.end()){
102
std::cout <<
"IdDictAltRegion::select_region could not find region \""
103
<< name <<
"\". Keys in map "
<< std::endl;
104
for
(
const
auto
& p :
m_regions
) {
105
std::cout <<
" key "
<< p.first;
106
}
107
std::cout << std::endl;
108
}
else
{
109
m_selected_region
= region_it->second.get();
110
}
111
}
Range.h
IdDictAltRegions.h
IdDictFieldImplementation.h
IdDictRegion.h
IdDictAltRegions::select_region
void select_region(const std::string &name)
Select the named region.
Definition
IdDictAltRegions.cxx:98
IdDictAltRegions::m_selected_region
IdDictRegion * m_selected_region
Definition
IdDictAltRegions.h:77
IdDictAltRegions::add_region
void add_region(std::unique_ptr< IdDictRegion > region)
Add a new region, with key given by the tag.
Definition
IdDictAltRegions.cxx:91
IdDictAltRegions::clear
virtual void clear() override
Definition
IdDictAltRegions.cxx:77
IdDictAltRegions::generate_implementation
virtual void generate_implementation(const IdDictMgr &idd, IdDictDictionary &dictionary, std::string_view tag="") override
Definition
IdDictAltRegions.cxx:47
IdDictAltRegions::set_index
virtual void set_index(size_t index) override
Definition
IdDictAltRegions.cxx:30
IdDictAltRegions::resolve_references
virtual void resolve_references(IdDictMgr &idd, IdDictDictionary &dictionary) override
Definition
IdDictAltRegions.cxx:37
IdDictAltRegions::map_iterator
map_type::iterator map_iterator
Definition
IdDictAltRegions.h:73
IdDictAltRegions::m_regions
map_type m_regions
Definition
IdDictAltRegions.h:76
IdDictAltRegions::build_range
virtual Range build_range() const override
Definition
IdDictAltRegions.cxx:82
IdDictAltRegions::~IdDictAltRegions
virtual ~IdDictAltRegions()
IdDictAltRegions::IdDictAltRegions
IdDictAltRegions()
Definition
IdDictAltRegions.cxx:15
IdDictAltRegions::reset_implementation
virtual void reset_implementation() override
Definition
IdDictAltRegions.cxx:67
IdDictAltRegions::verify
virtual bool verify() const override
Definition
IdDictAltRegions.cxx:72
IdDictAltRegions::group_name
virtual std::string group_name() const override
Group name for this region.
Definition
IdDictAltRegions.cxx:23
IdDictDictionary
Definition
IdDictDictionary.h:33
IdDictMgr
Definition
IdDictMgr.h:17
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition
DetectorDescription/Identifier/Identifier/Range.h:31
index
Definition
index.py:1
Generated on
for ATLAS Offline Software by
1.17.0