ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
IdDictDictionaryRef Class Reference

#include <IdDictDictionaryRef.h>

Inheritance diagram for IdDictDictionaryRef:
Collaboration diagram for IdDictDictionaryRef:

Public Member Functions

 IdDictDictionaryRef (const std::string &dictionary_name)
 
 IdDictDictionaryRef (IdDictDictionary *dictionary)
 
virtual ~IdDictDictionaryRef ()
 
const std::string & dictionary_name () const
 
virtual void resolve_references (IdDictMgr &idd, IdDictDictionary &dictionary, IdDictRegion &region) override
 
virtual void generate_implementation (const IdDictMgr &idd, IdDictDictionary &dictionary, IdDictRegion &region, const std::string &tag="") override
 
virtual void reset_implementation () override
 
virtual bool verify () const override
 
virtual Range build_range () const override
 
virtual void clear ()
 

Private Attributes

std::string m_dictionary_name
 
IdDictDictionarym_dictionary {}
 
bool m_resolved_references {}
 
bool m_generated_implementation {}
 
bool m_propagated_information {}
 

Detailed Description

Definition at line 16 of file IdDictDictionaryRef.h.

Constructor & Destructor Documentation

◆ IdDictDictionaryRef() [1/2]

IdDictDictionaryRef::IdDictDictionaryRef ( const std::string &  dictionary_name)

Definition at line 15 of file IdDictDictionaryRef.cxx.

16  :
18  m_dictionary(nullptr),
19  m_resolved_references(false),
22 }

◆ IdDictDictionaryRef() [2/2]

IdDictDictionaryRef::IdDictDictionaryRef ( IdDictDictionary dictionary)

Definition at line 24 of file IdDictDictionaryRef.cxx.

25  :
30 }

◆ ~IdDictDictionaryRef()

IdDictDictionaryRef::~IdDictDictionaryRef ( )
virtual

Definition at line 32 of file IdDictDictionaryRef.cxx.

32  {
33 }

Member Function Documentation

◆ build_range()

Range IdDictDictionaryRef::build_range ( ) const
overridevirtual

Implements IdDictRegionEntry.

Definition at line 144 of file IdDictDictionaryRef.cxx.

144  {
145  Range result;
146 
147  return(result);
148 }

◆ clear()

void IdDictRegionEntry::clear ( )
virtualinherited

Definition at line 29 of file IdDictRegionEntry.cxx.

29  {
30 }

◆ dictionary_name()

const std::string & IdDictDictionaryRef::dictionary_name ( ) const
inline

Definition at line 68 of file IdDictDictionaryRef.h.

69 {
70  return m_dictionary_name;
71 }

◆ generate_implementation()

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

Reimplemented from IdDictRegionEntry.

Definition at line 48 of file IdDictDictionaryRef.cxx.

51  {
53  if (m_dictionary) {
55  // Propagate information to referenced dictionary:
56  //
57  // 1) Loop over ranges in this region and add them to the
58  // referenced dictionary, then propagate the generate
59  // implementation
60 
61  // 2) Duplicate the regions of the current dictionary in
62  // referenced dictionary. Only the top level range(s) need
63  // to be propagated to correctly calculate the bits of the
64  // upper levels.
65 
66  // Save a vector of entries to prepend, inverting their order
67  std::vector<IdDictRegionEntry*> prepend_entries;
68  for (const std::unique_ptr<IdDictRegionEntry>& entry : region.entries()) {
69  if (this == entry.get()) break; // end when we get to the dictionary (this)
70  // If this is a range entry, add a duplicate to all
71  // regions in the subdictionary
72  IdDictRange* range = dynamic_cast<IdDictRange*> (entry.get());
73  if (range) {
74  prepend_entries.insert(prepend_entries.begin(), entry.get());
75  }
76  }
77 
78 
79 
80 
81  // Now prepend list to each region and generate each region
82  for (IdDictRegion* region2 : m_dictionary->all_regions()) {
83  for (IdDictRegionEntry* entry : prepend_entries) {
84  IdDictRange* range = dynamic_cast<IdDictRange*> (entry);
85  if (range) {
86  region2->prepend_entry(std::make_unique<IdDictRangeRef> (*range));
87  }
88  }
89  }
90 
91  // Now copy all prefixes into new regions in the
92  // referenced dictionary
93  if (prepend_entries.size() > 0) {
94  // Save region number
95  const IdDictRegion& region2 = *m_dictionary->all_regions().back();
96  size_t region_number = region2.index() + 1;
97 
98  // Loop over all regions of current dict, add to ref dict (m_dictionary)
99  for (IdDictRegion* region3 : dictionary.all_regions()) {
100  auto new_region = std::make_unique<IdDictRegion> ("dummy", "dummy", "");
101 
102  new_region->set_index (region_number++);
103 
104  // Now add in only the ranges
105  size_t i = 0;
106  for (const std::unique_ptr<IdDictRegionEntry>& entry : region3->entries()) {
107  if (i++ >= prepend_entries.size()) continue;
108 
109  IdDictRange* range = dynamic_cast<IdDictRange*> (entry.get());
110  if (range) {
111  new_region->add_entry(std::make_unique<IdDictRangeRef> (*range));
112  }
113  }
114 
115  // to all region vectors
116  m_dictionary->add_region(new_region.get());
117  // to the entries of the dictionary
118  m_dictionary->add_dictentry(std::move(new_region));
119  }
120  }
122  }
125  } else {
126  std::cout <<
127  "IdDictDictionaryRef::generate_implementation: - WARNING no dictionary named " << m_dictionary_name << " found, cannot generate implementation "
128  << std::endl;
129  }
130  }
131 }

◆ reset_implementation()

void IdDictDictionaryRef::reset_implementation ( )
overridevirtual

Reimplemented from IdDictRegionEntry.

Definition at line 133 of file IdDictDictionaryRef.cxx.

133  {
137  }
138 }

◆ resolve_references()

void IdDictDictionaryRef::resolve_references ( IdDictMgr idd,
IdDictDictionary dictionary,
IdDictRegion region 
)
overridevirtual

Reimplemented from IdDictRegionEntry.

Definition at line 35 of file IdDictDictionaryRef.cxx.

37  {
38  if (!m_resolved_references) {
40  if (m_dictionary) {
43  }
44  m_resolved_references = true;
45  }
46 }

◆ verify()

bool IdDictDictionaryRef::verify ( ) const
overridevirtual

Reimplemented from IdDictRegionEntry.

Definition at line 140 of file IdDictDictionaryRef.cxx.

140  {
141  return(true);
142 }

Member Data Documentation

◆ m_dictionary

IdDictDictionary* IdDictDictionaryRef::m_dictionary {}
private

Definition at line 57 of file IdDictDictionaryRef.h.

◆ m_dictionary_name

std::string IdDictDictionaryRef::m_dictionary_name
private

Definition at line 56 of file IdDictDictionaryRef.h.

◆ m_generated_implementation

bool IdDictDictionaryRef::m_generated_implementation {}
private

Definition at line 62 of file IdDictDictionaryRef.h.

◆ m_propagated_information

bool IdDictDictionaryRef::m_propagated_information {}
private

Definition at line 63 of file IdDictDictionaryRef.h.

◆ m_resolved_references

bool IdDictDictionaryRef::m_resolved_references {}
private

Definition at line 61 of file IdDictDictionaryRef.h.


The documentation for this class was generated from the following files:
IdDictDictionary::all_regions
const std::vector< IdDictRegion * > & all_regions()
Non-const access to vector of all regions.
Definition: IdDictDictionary.h:399
get_generator_info.result
result
Definition: get_generator_info.py:21
IdDictDictionary::generate_implementation
void generate_implementation(const IdDictMgr &idd, const std::string &tag="")
Definition: IdDictDictionary.cxx:196
IdDictDictionary::resolve_references
void resolve_references(IdDictMgr &idd)
Definition: IdDictDictionary.cxx:186
IdDictRegion
Definition: IdDictRegion.h:21
IdDictDictionaryRef::m_dictionary_name
std::string m_dictionary_name
Definition: IdDictDictionaryRef.h:56
IdDictDictionary::reset_implementation
void reset_implementation()
Definition: IdDictDictionary.cxx:243
lumiFormat.i
int i
Definition: lumiFormat.py:85
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
IdDictDictionaryRef::m_propagated_information
bool m_propagated_information
Definition: IdDictDictionaryRef.h:63
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
master.dictionary
dictionary
Definition: master.py:47
IdDictDictionary::add_region
void add_region(IdDictRegion *region)
Definition: IdDictDictionary.cxx:182
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
IdDictRegionEntry
Definition: IdDictRegionEntry.h:14
IdDictRange
Definition: IdDictRange.h:18
IdDictMgr::find_dictionary
const IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
Definition: IdDictMgr.cxx:116
IdDictDictionary::set_parent_dict
void set_parent_dict(IdDictDictionary *parent_dict)
Definition: IdDictDictionary.cxx:166
IdDictDictionaryRef::m_dictionary
IdDictDictionary * m_dictionary
Definition: IdDictDictionaryRef.h:57
IdDictRegion::index
size_t index() const
Definition: IdDictRegion.h:175
IdDictDictionaryRef::m_generated_implementation
bool m_generated_implementation
Definition: IdDictDictionaryRef.h:62
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:23
IdDictDictionaryRef::m_resolved_references
bool m_resolved_references
Definition: IdDictDictionaryRef.h:61
IdDictDictionary::add_dictentry
void add_dictentry(std::unique_ptr< IdDictDictEntry > entry)
Definition: IdDictDictionary.cxx:171
IdDictRegion::entries
const std::vector< std::unique_ptr< IdDictRegionEntry > > & entries()
Non-const access to entry pointers.
Definition: IdDictRegion.h:302
IdDictDictionaryRef::dictionary_name
const std::string & dictionary_name() const
Definition: IdDictDictionaryRef.h:68