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

#include <IdDictMgr.h>

Collaboration diagram for IdDictMgr:

Public Types

using dictionary_vec = std::vector<const IdDictDictionary*>
using metadata_map = std::map<std::string, std::string>

Public Member Functions

 IdDictMgr ()
 ~IdDictMgr ()
const std::string & tag () const
 Version tag.
const IdDictDictionaryfind_dictionary (const std::string &name) const
 Access dictionary by name.
IdDictDictionaryfind_dictionary (const std::string &name)
dictionary_vec get_dictionaries () const
 Access to all dictionaries.
const std::string & DTD_version () const
 DTD version.
bool do_checks () const
 Check whether or not to do checks for ids.
bool do_neighbours () const
 Check whether or not to init neighbours.
const std::string & find_metadata (const std::string &name) const
 Access to meta data, name/value pairs.
void add_dictionary (std::unique_ptr< IdDictDictionary > dictionary)
 Fillers:
void add_subdictionary_name (const std::string &name)
void add_metadata (const std::string &name, const std::string &value)
void set_DTD_version (const std::string &DTD_version)
void set_do_checks (bool do_checks)
void set_do_neighbours (bool do_neighbours)
void resolve_references ()
 Construct dictionary after parsing.
void generate_implementation (const std::string &tag="")
void reset_implementation ()
 Reset of implementation.
void clear ()
bool verify () const

Private Types

using dictionary_map = std::map<std::string, std::unique_ptr<IdDictDictionary> >

Private Member Functions

void find_subdicts (IdDictDictionary *dict)

Private Attributes

std::string m_DTD_version
std::string m_tag
dictionary_map m_dictionaries
metadata_map m_metadata
std::set< std::string > m_subdictionary_names
bool m_resolved_references
bool m_generated_implementation
bool m_do_checks
bool m_do_neighbours

Detailed Description

Definition at line 16 of file IdDictMgr.h.

Member Typedef Documentation

◆ dictionary_map

using IdDictMgr::dictionary_map = std::map<std::string, std::unique_ptr<IdDictDictionary> >
private

Definition at line 68 of file IdDictMgr.h.

◆ dictionary_vec

using IdDictMgr::dictionary_vec = std::vector<const IdDictDictionary*>

Definition at line 18 of file IdDictMgr.h.

◆ metadata_map

using IdDictMgr::metadata_map = std::map<std::string, std::string>

Definition at line 19 of file IdDictMgr.h.

Constructor & Destructor Documentation

◆ IdDictMgr()

IdDictMgr::IdDictMgr ( )

Definition at line 44 of file IdDictMgr.cxx.

45 :
48 m_do_checks(false),
49 m_do_neighbours(true) {
50}
bool m_do_neighbours
Definition IdDictMgr.h:80
bool m_generated_implementation
Definition IdDictMgr.h:78
bool m_do_checks
Definition IdDictMgr.h:79
bool m_resolved_references
Definition IdDictMgr.h:77

◆ ~IdDictMgr()

IdDictMgr::~IdDictMgr ( )
default

Member Function Documentation

◆ add_dictionary()

void IdDictMgr::add_dictionary ( std::unique_ptr< IdDictDictionary > dictionary)

Fillers:

Definition at line 128 of file IdDictMgr.cxx.

128 {
129 if (dictionary == 0) return;
130
131 const std::string& name = dictionary->name();
132
133 m_dictionaries[name] = std::move(dictionary);
134
135 if (Debugger::debug()) {
136 dictionary_map::iterator it;
137
138 for (const auto& p : m_dictionaries) {
139 std::cout << "IdDictMgr::add_dictionary> d[" << p.first << "]=" << p.second.get() << std::endl;
140 }
141 }
142}
static bool debug()
Definition Debugger.h:18
dictionary_map m_dictionaries
Definition IdDictMgr.h:74
dictionary
Definition master.py:47

◆ add_metadata()

void IdDictMgr::add_metadata ( const std::string & name,
const std::string & value )

Definition at line 95 of file IdDictMgr.cxx.

95 {
96 if (!m_metadata.insert(metadata_map::value_type(name, value)).second) {
97 std::cout << "IdDictMgr::add_metadata> unable to add name/value " << name << "/" << value << std::endl;
98 }
99}
metadata_map m_metadata
Definition IdDictMgr.h:75

◆ add_subdictionary_name()

void IdDictMgr::add_subdictionary_name ( const std::string & name)

Definition at line 144 of file IdDictMgr.cxx.

144 {
145 m_subdictionary_names.insert(name);
146}
std::set< std::string > m_subdictionary_names
Definition IdDictMgr.h:76

◆ clear()

void IdDictMgr::clear ( )

Definition at line 201 of file IdDictMgr.cxx.

201 {
202 m_dictionaries.clear();
203 m_resolved_references = false;
205}

◆ do_checks()

bool IdDictMgr::do_checks ( ) const

Check whether or not to do checks for ids.

Definition at line 62 of file IdDictMgr.cxx.

62 {
63 return m_do_checks;
64}

◆ do_neighbours()

bool IdDictMgr::do_neighbours ( ) const

Check whether or not to init neighbours.

Definition at line 74 of file IdDictMgr.cxx.

74 {
75 return m_do_neighbours;
76}

◆ DTD_version()

const std::string & IdDictMgr::DTD_version ( ) const

DTD version.

Definition at line 58 of file IdDictMgr.cxx.

58 {
59 return m_DTD_version;
60}
std::string m_DTD_version
Definition IdDictMgr.h:72

◆ find_dictionary() [1/2]

IdDictDictionary * IdDictMgr::find_dictionary ( const std::string & name)

Definition at line 122 of file IdDictMgr.cxx.

122 {
123 auto it = m_dictionaries.find(name);
124 if (it == m_dictionaries.end()) return nullptr;
125 return it->second.get();
126}

◆ find_dictionary() [2/2]

const IdDictDictionary * IdDictMgr::find_dictionary ( const std::string & name) const

Access dictionary by name.

Definition at line 116 of file IdDictMgr.cxx.

116 {
117 auto it = m_dictionaries.find(name);
118 if (it == m_dictionaries.end()) return nullptr;
119 return it->second.get();
120}

◆ find_metadata()

const std::string & IdDictMgr::find_metadata ( const std::string & name) const

Access to meta data, name/value pairs.

Definition at line 87 of file IdDictMgr.cxx.

87 {
88 metadata_map::const_iterator it = m_metadata.find(name);
89 static const std::string empty;
90 if (it != m_metadata.end()) return(it->second);
91 else return empty;
92}
static const Attributes_t empty

◆ find_subdicts()

void IdDictMgr::find_subdicts ( IdDictDictionary * dict)
private

◆ generate_implementation()

void IdDictMgr::generate_implementation ( const std::string & tag = "")

Definition at line 157 of file IdDictMgr.cxx.

157 {
158 if (Debugger::debug()) {
159 std::cout << "IdDictMgr::generate_implementation>" << std::endl;
160 }
161
162 // Must reset the implementation for multiple passes, this resets
163 // the generated flags
165
167 m_tag = tag;
168 for (auto& p : m_dictionaries) {
169 // From mgr, only generate impl for top-level dictionaries
170 IdDictDictionary& dictionary = *p.second;
171 if (m_subdictionary_names.find(dictionary.name()) != m_subdictionary_names.end()) continue;
172 dictionary.generate_implementation(*this, tag);
173 }
175 }
176}
const std::string & tag() const
Version tag.
Definition IdDictMgr.cxx:54
void reset_implementation()
Reset of implementation.
std::string m_tag
Definition IdDictMgr.h:73

◆ get_dictionaries()

std::vector< const IdDictDictionary * > IdDictMgr::get_dictionaries ( ) const

Access to all dictionaries.

Definition at line 106 of file IdDictMgr.cxx.

107{
108 std::vector<const IdDictDictionary*> out;
109 out.reserve (m_dictionaries.size());
110 for (const auto& p : m_dictionaries) {
111 out.push_back (p.second.get());
112 }
113 return out;
114}

◆ reset_implementation()

void IdDictMgr::reset_implementation ( )

Reset of implementation.

Definition at line 178 of file IdDictMgr.cxx.

178 {
179 std::cout << "IdDictMgr::reset_implementation" << std::endl;
180
181
183 for (auto& p : m_dictionaries) {
184 // From mgr, only generate impl for top-level dictionaries
185 IdDictDictionary& dictionary = *p.second;
186 if (m_subdictionary_names.find(dictionary.name()) != m_subdictionary_names.end()) continue;
187 dictionary.reset_implementation();
188 }
190 }
191}

◆ resolve_references()

void IdDictMgr::resolve_references ( )

Construct dictionary after parsing.

Definition at line 148 of file IdDictMgr.cxx.

148 {
149 for (auto& p : m_dictionaries) {
150 // From mgr, only resolve refs for top-level dictionaries
151 IdDictDictionary& dictionary = *p.second;
152 if (m_subdictionary_names.find(dictionary.name()) != m_subdictionary_names.end()) continue;
153 dictionary.resolve_references(*this);
154 }
155}

◆ set_do_checks()

void IdDictMgr::set_do_checks ( bool do_checks)

Definition at line 67 of file IdDictMgr.cxx.

67 {
69 for (const auto& p : m_dictionaries) {
70 p.second->set_do_checks(do_checks);
71 }
72}
bool do_checks() const
Check whether or not to do checks for ids.
Definition IdDictMgr.cxx:62

◆ set_do_neighbours()

void IdDictMgr::set_do_neighbours ( bool do_neighbours)

Definition at line 79 of file IdDictMgr.cxx.

79 {
81 for (const auto& p : m_dictionaries) {
82 p.second->set_do_neighbours(do_neighbours);
83 }
84}
bool do_neighbours() const
Check whether or not to init neighbours.
Definition IdDictMgr.cxx:74

◆ set_DTD_version()

void IdDictMgr::set_DTD_version ( const std::string & DTD_version)

Definition at line 102 of file IdDictMgr.cxx.

102 {
104}
const std::string & DTD_version() const
DTD version.
Definition IdDictMgr.cxx:58

◆ tag()

const std::string & IdDictMgr::tag ( ) const

Version tag.

Definition at line 54 of file IdDictMgr.cxx.

54 {
55 return m_tag;
56}

◆ verify()

bool IdDictMgr::verify ( ) const

Definition at line 193 of file IdDictMgr.cxx.

193 {
194 for (auto& p : m_dictionaries) {
195 if (!p.second->verify()) return(false);
196 }
197
198 return(true);
199}

Member Data Documentation

◆ m_dictionaries

dictionary_map IdDictMgr::m_dictionaries
private

Definition at line 74 of file IdDictMgr.h.

◆ m_do_checks

bool IdDictMgr::m_do_checks
private

Definition at line 79 of file IdDictMgr.h.

◆ m_do_neighbours

bool IdDictMgr::m_do_neighbours
private

Definition at line 80 of file IdDictMgr.h.

◆ m_DTD_version

std::string IdDictMgr::m_DTD_version
private

Definition at line 72 of file IdDictMgr.h.

◆ m_generated_implementation

bool IdDictMgr::m_generated_implementation
private

Definition at line 78 of file IdDictMgr.h.

◆ m_metadata

metadata_map IdDictMgr::m_metadata
private

Definition at line 75 of file IdDictMgr.h.

◆ m_resolved_references

bool IdDictMgr::m_resolved_references
private

Definition at line 77 of file IdDictMgr.h.

◆ m_subdictionary_names

std::set<std::string> IdDictMgr::m_subdictionary_names
private

Definition at line 76 of file IdDictMgr.h.

◆ m_tag

std::string IdDictMgr::m_tag
private

Definition at line 73 of file IdDictMgr.h.


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