ATLAS Offline Software
Loading...
Searching...
No Matches
IdDictAltRegions Class Reference

#include <IdDictAltRegions.h>

Inheritance diagram for IdDictAltRegions:
Collaboration diagram for IdDictAltRegions:

Public Member Functions

 IdDictAltRegions ()
virtual ~IdDictAltRegions ()
virtual std::string group_name () const override
 Group name for this region.
IdDictRegionselected_region ()
 Currently selected region.
void add_region (std::unique_ptr< IdDictRegion > region)
 Add a new region, with key given by the tag.
void select_region (const std::string &name)
 Select the named region.
virtual void set_index (size_t index) override
virtual Range build_range () const override
virtual void resolve_references (IdDictMgr &idd, IdDictDictionary &dictionary) override
virtual void generate_implementation (const IdDictMgr &idd, IdDictDictionary &dictionary, const std::string &tag="") override
virtual void reset_implementation () override
virtual bool verify () const override
virtual void clear () override

Private Types

using map_type = std::map<std::string, std::unique_ptr<IdDictRegion> >
using map_iterator = map_type::iterator
using value_type = map_type::value_type

Private Attributes

map_type m_regions
IdDictRegionm_selected_region {}

Detailed Description

Definition at line 21 of file IdDictAltRegions.h.

Member Typedef Documentation

◆ map_iterator

using IdDictAltRegions::map_iterator = map_type::iterator
private

Definition at line 72 of file IdDictAltRegions.h.

◆ map_type

using IdDictAltRegions::map_type = std::map<std::string, std::unique_ptr<IdDictRegion> >
private

Definition at line 71 of file IdDictAltRegions.h.

◆ value_type

using IdDictAltRegions::value_type = map_type::value_type
private

Definition at line 73 of file IdDictAltRegions.h.

Constructor & Destructor Documentation

◆ IdDictAltRegions()

IdDictAltRegions::IdDictAltRegions ( )

Definition at line 15 of file IdDictAltRegions.cxx.

16 :
18}
IdDictRegion * m_selected_region

◆ ~IdDictAltRegions()

IdDictAltRegions::~IdDictAltRegions ( )
virtualdefault

Member Function Documentation

◆ add_region()

void IdDictAltRegions::add_region ( std::unique_ptr< IdDictRegion > region)

Add a new region, with key given by the tag.

Definition at line 91 of file IdDictAltRegions.cxx.

92{
93 m_regions[region->tag()] = std::move(region);
94}
const std::string & tag() const

◆ build_range()

Range IdDictAltRegions::build_range ( ) const
overridevirtual

Implements IdDictDictEntry.

Definition at line 82 of file IdDictAltRegions.cxx.

82 {
83 Range result;
84
85 if (m_selected_region) result = m_selected_region->build_range();
86 return(result);
87}

◆ clear()

void IdDictAltRegions::clear ( )
overridevirtual

Implements IdDictDictEntry.

Definition at line 77 of file IdDictAltRegions.cxx.

77 {
78 m_regions.clear();
79}

◆ generate_implementation()

void IdDictAltRegions::generate_implementation ( const IdDictMgr & idd,
IdDictDictionary & dictionary,
const std::string & tag = "" )
overridevirtual

Implements IdDictDictEntry.

Definition at line 47 of file IdDictAltRegions.cxx.

49 {
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}
map_type::iterator map_iterator

◆ group_name()

std::string IdDictAltRegions::group_name ( ) const
overridevirtual

Group name for this region.

Implements IdDictDictEntry.

Definition at line 23 of file IdDictAltRegions.cxx.

23 {
24 std::string result;
25 if (!m_regions.empty()) result = m_regions.begin()->second->group_name();
26 return(result);
27}

◆ reset_implementation()

void IdDictAltRegions::reset_implementation ( )
overridevirtual

Implements IdDictDictEntry.

Definition at line 67 of file IdDictAltRegions.cxx.

67 {
68 if (m_selected_region) m_selected_region->reset_implementation();
69}

◆ resolve_references()

void IdDictAltRegions::resolve_references ( IdDictMgr & idd,
IdDictDictionary & dictionary )
overridevirtual

Implements IdDictDictEntry.

Definition at line 37 of file IdDictAltRegions.cxx.

38 {
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}

◆ select_region()

void IdDictAltRegions::select_region ( const std::string & name)

Select the named region.

Definition at line 98 of file IdDictAltRegions.cxx.

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}

◆ selected_region()

IdDictRegion * IdDictAltRegions::selected_region ( )
inline

Currently selected region.

Definition at line 82 of file IdDictAltRegions.h.

83{
84 return m_selected_region;
85}

◆ set_index()

void IdDictAltRegions::set_index ( size_t index)
overridevirtual

Implements IdDictDictEntry.

Definition at line 30 of file IdDictAltRegions.cxx.

30 {
31 for (auto& p : m_regions) {
32 p.second->set_index(index);
33 }
34}

◆ verify()

bool IdDictAltRegions::verify ( ) const
overridevirtual

Implements IdDictDictEntry.

Definition at line 72 of file IdDictAltRegions.cxx.

72 {
73 return(true);
74}

Member Data Documentation

◆ m_regions

map_type IdDictAltRegions::m_regions
private

Definition at line 75 of file IdDictAltRegions.h.

◆ m_selected_region

IdDictRegion* IdDictAltRegions::m_selected_region {}
private

Definition at line 76 of file IdDictAltRegions.h.

76{};

The documentation for this class was generated from the following files: