ATLAS Offline Software
Loading...
Searching...
No Matches
IdDictAltRegions.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4
7#include "Identifier/Range.h"
9
10#include <iostream>
11
19
21
22std::string
24 std::string result;
25 if (!m_regions.empty()) result = m_regions.begin()->second->group_name();
26 return(result);
27}
28
29void
31 for (auto& p : m_regions) {
32 p.second->set_index(index);
33 }
34}
35
36void
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
46void
48 IdDictDictionary& dictionary,
49 const std::string& 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
66void
70
71bool
73 return(true);
74}
75
76void
80
84
85 if (m_selected_region) result = m_selected_region->build_range();
86 return(result);
87}
88
89
91void IdDictAltRegions::add_region (std::unique_ptr<IdDictRegion> region)
92{
93 m_regions[region->tag()] = std::move(region);
94}
95
96
98void 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}
void select_region(const std::string &name)
Select the named region.
IdDictRegion * m_selected_region
void add_region(std::unique_ptr< IdDictRegion > region)
Add a new region, with key given by the tag.
virtual void clear() override
virtual void set_index(size_t index) override
virtual void resolve_references(IdDictMgr &idd, IdDictDictionary &dictionary) override
virtual void generate_implementation(const IdDictMgr &idd, IdDictDictionary &dictionary, const std::string &tag="") override
map_type::iterator map_iterator
virtual Range build_range() const override
virtual ~IdDictAltRegions()
virtual void reset_implementation() override
virtual bool verify() const override
virtual std::string group_name() const override
Group name for this region.
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition index.py:1