![]() |
ATLAS Offline Software
|
#include <IdDictDictionary.h>
Public Types | |
| using | value_type = Identifier::value_type |
| using | size_type = Identifier::size_type |
Public Member Functions | |
| IdDictDictionary () | |
| IdDictDictionary (const std::string &name, const std::string &version="", const std::string &date="", const std::string &author="") | |
| ~IdDictDictionary () | |
| const std::string & | name () const |
| Dictionary name. More... | |
| const std::string & | version () const |
| Dictionary version. More... | |
| size_t | n_regions () const |
| Number of contained regions. More... | |
| const IdDictRegion & | region (size_t i) const |
| Region at index i. More... | |
| const std::string & | file_name () const |
| Access to file name. More... | |
| const std::string & | dict_tag () const |
| Access to the dictionary tag. More... | |
| const IdDictField * | find_field (const std::string &name) const |
| IdDictField * | find_field (const std::string &name) |
| const IdDictLabel * | find_label (const std::string &field, const std::string &label) const |
| int | get_label_value (const std::string &field, const std::string &label, int &value) const |
| IdDictSubRegion * | find_subregion (const std::string &subregion_name) |
| const IdDictRegion * | find_region (const std::string ®ion_name) const |
| IdDictRegion * | find_region (const std::string ®ion_name, const std::string &group_name) |
| const IdDictRegion * | find_region (const std::string ®ion_name, const std::string &group_name) const |
| IdDictGroup * | find_group (const std::string &group_name) |
| const IdDictGroup * | find_group (const std::string &group_name) const |
| int | find_region (const ExpandedIdentifier &id, size_type &index) const |
| const IdDictRegion * | find_region (const ExpandedIdentifier &id) const |
| const IdDictRegion * | find_region (const ExpandedIdentifier &id, const std::string &group_name) const |
| const std::vector< IdDictRegion * > & | all_regions () |
| Non-const access to vector of all regions. More... | |
| IdDictField * | add_field (std::unique_ptr< IdDictField > field) |
| IdDictSubRegion * | add_subregion (std::unique_ptr< IdDictSubRegion > subregion) |
| void | add_dictentry (std::unique_ptr< IdDictDictEntry > entry) |
| void | add_region (IdDictRegion *region) |
| void | add_subdictionary_name (const std::string &name) |
| void | set_parent_dict (IdDictDictionary *parent_dict) |
| void | set_file_name (const std::string &name) |
| Set file name. More... | |
| void | set_dict_tag (const std::string &tag) |
| Set the dictionary tag. More... | |
| void | resolve_references (IdDictMgr &idd) |
| void | generate_implementation (const IdDictMgr &idd, const std::string &tag="") |
| void | reset_implementation () |
| bool | verify () const |
| Here, we verify global constraints : (this must only be applied after the resolve_references and generate_implementation operations) More... | |
| void | sort () |
| Sort: More... | |
| void | clear () |
| void | integrate_bits () |
| Set up integral of bits for efficient unpacking. More... | |
| MultiRange | build_multirange () const |
| Get MultiRange for full dictionary. More... | |
| MultiRange | build_multirange (const ExpandedIdentifier ®ion_id, const Range &prefix=Range(), const std::string &last_field="") const |
| Get MultiRange for a specific region_id up to and including 'last_field' If last_field == "", all fields are taken. More... | |
| MultiRange | build_multirange (const ExpandedIdentifier ®ion_id, const std::string &group_name, const Range &prefix=Range(), const std::string &last_field="") const |
| Get MultiRange for a specific region_id, constrained to be within a specific named group. More... | |
| int | pack32 (const ExpandedIdentifier &id, size_t index1, size_t index2, Identifier &packedId) const |
| Pack to 32bits the subset of id between (inclusive) index1 and index2 - this is generic, i.e. More... | |
| int | pack32 (const int *fields, size_t index1, size_t index2, size_t region_index, Identifier &packedId, size_t first_field_index=0) const |
| Pack to 32bits the subset of id between (inclusive) index1 and index2. More... | |
| int | reset (size_t index1, size_t index2, size_t region_index, Identifier &packedId) const |
| Reset fields from index1 to index2. More... | |
| int | unpack (const std::string &group, const Identifier &id, const ExpandedIdentifier &prefix, size_t index2, ExpandedIdentifier &unpackedId) const |
| Unpack the value_type id to an expanded Identifier for a given group, considering the provided prefix (result will include the prefix) and up to index2 - (index1 is assumed to be 0, i.e. More... | |
| int | unpack (const std::string &group, const Identifier &id, const ExpandedIdentifier &prefix, size_t index2, const std::string &sep, std::string &unpackedId) const |
| Unpack the value_type id to a string for a given group, considering the provided prefix (result will include the prefix) and up to index2 - (index1 is assumed to be 0, i.e. More... | |
| int | unpack (const Identifier &id, size_t first_field_index, size_t field_index, size_t region_index, int &field) const |
| Unpack a single field of the value_type id. More... | |
| int | copy (const Identifier &idin, size_t first_field_index, size_t begin_field_index, size_t end_field_index, size_t region_index, Identifier &idout) const |
| Copy a number of fields of the value_type id into another value_type id. More... | |
| bool | do_checks () const |
| Checks are performed by default in debug compilation and NOT in optimized compilation. More... | |
| void | set_do_checks (bool do_checks) |
| bool | do_neighbours () const |
| Neighbour initialization is performed by default One can switch or query this mode for any idHelper with the following methods: More... | |
| void | set_do_neighbours (bool do_neighbours) |
| void | dump () const |
| Dump regions and trees for each group. More... | |
Private Types | |
| using | entries_type = std::vector< IdDictDictEntry * > |
| using | entries_it = entries_type::iterator |
| using | entries_const_it = entries_type::const_iterator |
| using | regions_type = std::vector< IdDictRegion * > |
| using | regions_it = regions_type::iterator |
| using | regions_const_it = regions_type::const_iterator |
| using | groups_type = std::vector< IdDictGroup * > |
| using | groups_it = groups_type::iterator |
| using | groups_const_it = groups_type::const_iterator |
Private Attributes | |
| std::string | m_name {} |
| std::string | m_version {} |
| std::string | m_date {} |
| std::string | m_author {} |
| std::map< std::string, std::unique_ptr< IdDictField > > | m_fields |
| std::map< std::string, std::unique_ptr< IdDictSubRegion > > | m_subregions |
| std::vector< IdDictRegion * > | m_regions |
| std::vector< IdDictRegion * > | m_all_regions |
| std::vector< std::unique_ptr< IdDictGroup > > | m_groups |
| std::vector< std::string > | m_subdictionary_names |
| IdDictDictionary * | m_parent_dict {nullptr} |
| std::string | m_file_name {} |
| std::string | m_dict_tag {} |
| bool | m_generated_implementation {false} |
| bool | m_do_checks {false} |
| bool | m_do_neighbours {true} |
Definition at line 31 of file IdDictDictionary.h.
|
private |
Definition at line 304 of file IdDictDictionary.h.
|
private |
Definition at line 303 of file IdDictDictionary.h.
|
private |
Definition at line 302 of file IdDictDictionary.h.
|
private |
Definition at line 312 of file IdDictDictionary.h.
|
private |
Definition at line 311 of file IdDictDictionary.h.
|
private |
Definition at line 310 of file IdDictDictionary.h.
|
private |
Definition at line 308 of file IdDictDictionary.h.
|
private |
Definition at line 307 of file IdDictDictionary.h.
|
private |
Definition at line 306 of file IdDictDictionary.h.
Definition at line 34 of file IdDictDictionary.h.
Definition at line 33 of file IdDictDictionary.h.
|
default |
|
default |
| void IdDictDictionary::add_dictentry | ( | std::unique_ptr< IdDictDictEntry > | entry | ) |
Definition at line 171 of file IdDictDictionary.cxx.
| IdDictField * IdDictDictionary::add_field | ( | std::unique_ptr< IdDictField > | field | ) |
| void IdDictDictionary::add_region | ( | IdDictRegion * | region | ) |
Definition at line 182 of file IdDictDictionary.cxx.
| void IdDictDictionary::add_subdictionary_name | ( | const std::string & | name | ) |
Definition at line 162 of file IdDictDictionary.cxx.
| IdDictSubRegion * IdDictDictionary::add_subregion | ( | std::unique_ptr< IdDictSubRegion > | subregion | ) |
Definition at line 157 of file IdDictDictionary.cxx.
|
inline |
Non-const access to vector of all regions.
Definition at line 399 of file IdDictDictionary.h.
| MultiRange IdDictDictionary::build_multirange | ( | ) | const |
Get MultiRange for full dictionary.
Definition at line 309 of file IdDictDictionary.cxx.
| MultiRange IdDictDictionary::build_multirange | ( | const ExpandedIdentifier & | region_id, |
| const Range & | prefix = Range(), |
||
| const std::string & | last_field = "" |
||
| ) | const |
Get MultiRange for a specific region_id up to and including 'last_field' If last_field == "", all fields are taken.
Prepend prefix if provided.
Definition at line 324 of file IdDictDictionary.cxx.
| MultiRange IdDictDictionary::build_multirange | ( | const ExpandedIdentifier & | region_id, |
| const std::string & | group_name, | ||
| const Range & | prefix = Range(), |
||
| const std::string & | last_field = "" |
||
| ) | const |
Get MultiRange for a specific region_id, constrained to be within a specific named group.
The depth of the multirange is up to and including 'last_field' If last_field == "", all fields are taken. Prepend prefix if provided.
Definition at line 384 of file IdDictDictionary.cxx.
| void IdDictDictionary::clear | ( | ) |
Definition at line 1062 of file IdDictDictionary.cxx.
| int IdDictDictionary::copy | ( | const Identifier & | idin, |
| size_t | first_field_index, | ||
| size_t | begin_field_index, | ||
| size_t | end_field_index, | ||
| size_t | region_index, | ||
| Identifier & | idout | ||
| ) | const |
Copy a number of fields of the value_type id into another value_type id.
Copy a number of fields of the bits32 id into another bits32 id.
One specifies the begin and end (inclusive) field indexes desired and passes in the region index to be used for decoding. The region index is obtained from find_region. The first_field_index is normally 0. It is non-zero when fields 0 to first_field_index -1 are missing from the compact
One specifies the begin and end (inclusive) field indexes desired and passes in the region index to be used for decoding. The region index is obtained from find_region. The first_field_index is normally 0. It is non-zero when fields 0 to first_field_index -1 are missing from the compact. In this case, idout is shift by the number of missing bits, if possible.
Definition at line 897 of file IdDictDictionary.cxx.
|
inline |
Access to the dictionary tag.
Definition at line 378 of file IdDictDictionary.h.
| bool IdDictDictionary::do_checks | ( | ) | const |
Checks are performed by default in debug compilation and NOT in optimized compilation.
One can switch or query this mode for any idHelper with the following methods:
Definition at line 984 of file IdDictDictionary.cxx.
| bool IdDictDictionary::do_neighbours | ( | ) | const |
Neighbour initialization is performed by default One can switch or query this mode for any idHelper with the following methods:
Definition at line 994 of file IdDictDictionary.cxx.
| void IdDictDictionary::dump | ( | ) | const |
Dump regions and trees for each group.
Definition at line 1070 of file IdDictDictionary.cxx.
|
inline |
Access to file name.
Definition at line 371 of file IdDictDictionary.h.
| IdDictField * IdDictDictionary::find_field | ( | const std::string & | name | ) |
Definition at line 65 of file IdDictDictionary.cxx.
| const IdDictField * IdDictDictionary::find_field | ( | const std::string & | name | ) | const |
Definition at line 47 of file IdDictDictionary.cxx.
| IdDictGroup * IdDictDictionary::find_group | ( | const std::string & | group_name | ) |
Definition at line 141 of file IdDictDictionary.cxx.
| const IdDictGroup * IdDictDictionary::find_group | ( | const std::string & | group_name | ) | const |
Definition at line 149 of file IdDictDictionary.cxx.
| const IdDictLabel * IdDictDictionary::find_label | ( | const std::string & | field, |
| const std::string & | label | ||
| ) | const |
Definition at line 84 of file IdDictDictionary.cxx.
| const IdDictRegion * IdDictDictionary::find_region | ( | const ExpandedIdentifier & | id | ) | const |
Definition at line 274 of file IdDictDictionary.cxx.
| const IdDictRegion * IdDictDictionary::find_region | ( | const ExpandedIdentifier & | id, |
| const std::string & | group_name | ||
| ) | const |
Definition at line 278 of file IdDictDictionary.cxx.
| int IdDictDictionary::find_region | ( | const ExpandedIdentifier & | id, |
| size_type & | index | ||
| ) | const |
Definition at line 254 of file IdDictDictionary.cxx.
| const IdDictRegion * IdDictDictionary::find_region | ( | const std::string & | region_name | ) | const |
Definition at line 114 of file IdDictDictionary.cxx.
| IdDictRegion * IdDictDictionary::find_region | ( | const std::string & | region_name, |
| const std::string & | group_name | ||
| ) |
Definition at line 119 of file IdDictDictionary.cxx.
| const IdDictRegion * IdDictDictionary::find_region | ( | const std::string & | region_name, |
| const std::string & | group_name | ||
| ) | const |
Definition at line 130 of file IdDictDictionary.cxx.
| IdDictSubRegion * IdDictDictionary::find_subregion | ( | const std::string & | subregion_name | ) |
Definition at line 107 of file IdDictDictionary.cxx.
| void IdDictDictionary::generate_implementation | ( | const IdDictMgr & | idd, |
| const std::string & | tag = "" |
||
| ) |
Definition at line 196 of file IdDictDictionary.cxx.
| int IdDictDictionary::get_label_value | ( | const std::string & | field, |
| const std::string & | label, | ||
| int & | value | ||
| ) | const |
Definition at line 92 of file IdDictDictionary.cxx.
| void IdDictDictionary::integrate_bits | ( | ) |
Set up integral of bits for efficient unpacking.
Definition at line 300 of file IdDictDictionary.cxx.
|
inline |
Number of contained regions.
Definition at line 363 of file IdDictDictionary.h.
|
inline |
| int IdDictDictionary::pack32 | ( | const ExpandedIdentifier & | id, |
| size_t | index1, | ||
| size_t | index2, | ||
| Identifier & | packedId | ||
| ) | const |
Pack to 32bits the subset of id between (inclusive) index1 and index2 - this is generic, i.e.
not the most efficient
Assumptions:
First we need to check whether the specified identifier really matches the Dictionary specifications.
However, we stop the search in the set of regions at the first matching region. Should we request that only one region matches ????
Definition at line 459 of file IdDictDictionary.cxx.
| int IdDictDictionary::pack32 | ( | const int * | fields, |
| size_t | index1, | ||
| size_t | index2, | ||
| size_t | region_index, | ||
| Identifier & | packedId, | ||
| size_t | first_field_index = 0 |
||
| ) | const |
Pack to 32bits the subset of id between (inclusive) index1 and index2.
Here one must provide the region index, which can be found with find_region. This is more efficient than the above pack32.
Assumptions: (different than the previous pack32)
Definition at line 536 of file IdDictDictionary.cxx.
|
inline |
Region at index i.
Definition at line 354 of file IdDictDictionary.h.
| int IdDictDictionary::reset | ( | size_t | index1, |
| size_t | index2, | ||
| size_t | region_index, | ||
| Identifier & | packedId | ||
| ) | const |
| void IdDictDictionary::reset_implementation | ( | ) |
Definition at line 243 of file IdDictDictionary.cxx.
| void IdDictDictionary::resolve_references | ( | IdDictMgr & | idd | ) |
Definition at line 186 of file IdDictDictionary.cxx.
|
inline |
Set the dictionary tag.
Definition at line 392 of file IdDictDictionary.h.
| void IdDictDictionary::set_do_checks | ( | bool | do_checks | ) |
Definition at line 989 of file IdDictDictionary.cxx.
| void IdDictDictionary::set_do_neighbours | ( | bool | do_neighbours | ) |
Definition at line 999 of file IdDictDictionary.cxx.
|
inline |
Set file name.
Definition at line 385 of file IdDictDictionary.h.
| void IdDictDictionary::set_parent_dict | ( | IdDictDictionary * | parent_dict | ) |
Definition at line 166 of file IdDictDictionary.cxx.
| void IdDictDictionary::sort | ( | ) |
Sort:
Prerequisite: first verify the dictionary - no overlaps
Then loop over regions and sort according to their first identifier
Definition at line 1048 of file IdDictDictionary.cxx.
| int IdDictDictionary::unpack | ( | const Identifier & | id, |
| size_t | first_field_index, | ||
| size_t | field_index, | ||
| size_t | region_index, | ||
| int & | field | ||
| ) | const |
Unpack a single field of the value_type id.
Unpack a single field of the bits32 id.
One specifies the field index desired and passes in the region index to be used for decoding. The region index is obtained from find_region. The first_field_index is normally 0. It is non-zero when fields 0 to first_field_index -1 are missing from the compact
Definition at line 810 of file IdDictDictionary.cxx.
| int IdDictDictionary::unpack | ( | const std::string & | group, |
| const Identifier & | id, | ||
| const ExpandedIdentifier & | prefix, | ||
| size_t | index2, | ||
| const std::string & | sep, | ||
| std::string & | unpackedId | ||
| ) | const |
Unpack the value_type id to a string for a given group, considering the provided prefix (result will include the prefix) and up to index2 - (index1 is assumed to be 0, i.e.
part of prefix).
Returns 0 on success, nonzero on error.
Definition at line 700 of file IdDictDictionary.cxx.
| int IdDictDictionary::unpack | ( | const std::string & | group, |
| const Identifier & | id, | ||
| const ExpandedIdentifier & | prefix, | ||
| size_t | index2, | ||
| ExpandedIdentifier & | unpackedId | ||
| ) | const |
Unpack the value_type id to an expanded Identifier for a given group, considering the provided prefix (result will include the prefix) and up to index2 - (index1 is assumed to be 0, i.e.
part of prefix).
Returns 0 on success, nonzero on error.
Definition at line 679 of file IdDictDictionary.cxx.
| bool IdDictDictionary::verify | ( | ) | const |
Here, we verify global constraints : (this must only be applied after the resolve_references and generate_implementation operations)
a) There should be no overlap between any region duet.
b) In a dictionary, a given field (ie. with a given name) must always be referenced at the same depth across all regions and subregions.
c) When a region specifies a reference to a sub-dictionary :
d) Within a dictionary, a given field must always be described either through an enumeration, or through its bounds. However, the various usages of a given field may specify different tag set (for enumerations) or bounds (for a bounded field).
Definition at line 1027 of file IdDictDictionary.cxx.
|
inline |
Dictionary version.
Definition at line 345 of file IdDictDictionary.h.
|
private |
Definition at line 317 of file IdDictDictionary.h.
|
private |
Definition at line 300 of file IdDictDictionary.h.
|
private |
Definition at line 299 of file IdDictDictionary.h.
|
private |
Definition at line 323 of file IdDictDictionary.h.
|
private |
Definition at line 325 of file IdDictDictionary.h.
|
private |
Definition at line 326 of file IdDictDictionary.h.
|
private |
Definition at line 314 of file IdDictDictionary.h.
|
private |
Definition at line 322 of file IdDictDictionary.h.
|
private |
Definition at line 324 of file IdDictDictionary.h.
|
private |
Definition at line 318 of file IdDictDictionary.h.
|
private |
Definition at line 297 of file IdDictDictionary.h.
|
private |
Definition at line 320 of file IdDictDictionary.h.
|
private |
Definition at line 316 of file IdDictDictionary.h.
|
private |
Definition at line 319 of file IdDictDictionary.h.
|
private |
Definition at line 315 of file IdDictDictionary.h.
|
private |
Definition at line 298 of file IdDictDictionary.h.
1.8.18