![]() |
ATLAS Offline Software
|
#include <IdDictDictionary.h>
Public Types | |
typedef Identifier::value_type | value_type |
typedef Identifier::size_type | size_type |
typedef std::vector< IdDictDictEntry * > | entries_type |
typedef entries_type::iterator | entries_it |
typedef entries_type::const_iterator | entries_const_it |
typedef std::vector< IdDictRegion * > | regions_type |
typedef regions_type::iterator | regions_it |
typedef regions_type::const_iterator | regions_const_it |
typedef std::vector< IdDictGroup * > | groups_type |
typedef groups_type::iterator | groups_it |
typedef groups_type::const_iterator | groups_const_it |
Public Member Functions | |
IdDictDictionary () | |
~IdDictDictionary () | |
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 |
IdDictGroup * | find_group (const std::string &group_name) const |
void | add_field (IdDictField *field) |
void | add_subregion (IdDictSubRegion *subregion) |
void | add_dictentry (IdDictDictEntry *entry) |
void | add_subdictionary_name (const std::string &name) |
void | resolve_references (const 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 () |
int | find_region (const ExpandedIdentifier &id, size_type &index) const |
Find first region that matches id. More... | |
IdDictRegion * | find_region (const ExpandedIdentifier &id) const |
IdDictRegion * | find_region (const ExpandedIdentifier &id, const std::string &group_name) const |
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 Identifier &id, const ExpandedIdentifier &prefix, size_t index2, ExpandedIdentifier &unpackedId) const |
Unpack the value_type id to an expanded Identifier, 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, const ExpandedIdentifier &prefix, size_t index2, const std::string &sep, std::string &unpackedId) const |
Unpack the value_type id to a string, 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 (void) 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 (void) 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) |
const std::string & | file_name (void) const |
Access to file name. More... | |
const std::string & | dict_tag (void) const |
Access to the dictionary tag. More... | |
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... | |
Public Attributes | |
std::string | m_name |
std::string | m_version |
std::string | m_date |
std::string | m_author |
std::map< std::string, IdDictField * > | m_fields |
std::map< std::string, IdDictSubRegion * > | m_subregions |
std::vector< IdDictRegion * > | m_regions |
std::vector< IdDictRegion * > | m_all_regions |
std::vector< IdDictGroup * > | m_groups |
std::vector< std::string > | m_subdictionary_names |
IdDictDictionary * | m_parent_dict |
Private Attributes | |
std::string | m_file_name |
std::string | m_dict_tag |
bool | m_generated_implementation |
bool | m_do_checks |
bool | m_do_neighbours |
Definition at line 30 of file IdDictDictionary.h.
typedef entries_type::const_iterator IdDictDictionary::entries_const_it |
Definition at line 223 of file IdDictDictionary.h.
typedef entries_type::iterator IdDictDictionary::entries_it |
Definition at line 222 of file IdDictDictionary.h.
typedef std::vector<IdDictDictEntry*> IdDictDictionary::entries_type |
Definition at line 221 of file IdDictDictionary.h.
typedef groups_type::const_iterator IdDictDictionary::groups_const_it |
Definition at line 231 of file IdDictDictionary.h.
typedef groups_type::iterator IdDictDictionary::groups_it |
Definition at line 230 of file IdDictDictionary.h.
typedef std::vector<IdDictGroup*> IdDictDictionary::groups_type |
Definition at line 229 of file IdDictDictionary.h.
typedef regions_type::const_iterator IdDictDictionary::regions_const_it |
Definition at line 227 of file IdDictDictionary.h.
typedef regions_type::iterator IdDictDictionary::regions_it |
Definition at line 226 of file IdDictDictionary.h.
typedef std::vector<IdDictRegion*> IdDictDictionary::regions_type |
Definition at line 225 of file IdDictDictionary.h.
Definition at line 33 of file IdDictDictionary.h.
Definition at line 32 of file IdDictDictionary.h.
IdDictDictionary::IdDictDictionary | ( | ) |
Definition at line 33 of file IdDictDictionary.cxx.
IdDictDictionary::~IdDictDictionary | ( | ) |
Definition at line 42 of file IdDictDictionary.cxx.
void IdDictDictionary::add_dictentry | ( | IdDictDictEntry * | entry | ) |
Definition at line 136 of file IdDictDictionary.cxx.
void IdDictDictionary::add_field | ( | IdDictField * | field | ) |
void IdDictDictionary::add_subdictionary_name | ( | const std::string & | name | ) |
Definition at line 132 of file IdDictDictionary.cxx.
void IdDictDictionary::add_subregion | ( | IdDictSubRegion * | subregion | ) |
Definition at line 124 of file IdDictDictionary.cxx.
MultiRange IdDictDictionary::build_multirange | ( | ) | const |
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 318 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 380 of file IdDictDictionary.cxx.
void IdDictDictionary::clear | ( | ) |
Definition at line 1245 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 1078 of file IdDictDictionary.cxx.
|
inline |
Access to the dictionary tag.
Definition at line 262 of file IdDictDictionary.h.
bool IdDictDictionary::do_checks | ( | void | ) | 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 1165 of file IdDictDictionary.cxx.
bool IdDictDictionary::do_neighbours | ( | void | ) | const |
Neighbour initialization is performed by default One can switch or query this mode for any idHelper with the following methods:
Definition at line 1175 of file IdDictDictionary.cxx.
|
inline |
Access to file name.
Definition at line 255 of file IdDictDictionary.h.
IdDictField * IdDictDictionary::find_field | ( | const std::string & | name | ) | const |
Definition at line 45 of file IdDictDictionary.cxx.
IdDictGroup * IdDictDictionary::find_group | ( | const std::string & | group_name | ) | const |
Definition at line 115 of file IdDictDictionary.cxx.
IdDictLabel * IdDictDictionary::find_label | ( | const std::string & | field, |
const std::string & | label | ||
) | const |
Definition at line 65 of file IdDictDictionary.cxx.
IdDictRegion * IdDictDictionary::find_region | ( | const ExpandedIdentifier & | id | ) | const |
Definition at line 253 of file IdDictDictionary.cxx.
IdDictRegion * IdDictDictionary::find_region | ( | const ExpandedIdentifier & | id, |
const std::string & | group_name | ||
) | const |
Definition at line 257 of file IdDictDictionary.cxx.
int IdDictDictionary::find_region | ( | const ExpandedIdentifier & | id, |
size_type & | index | ||
) | const |
IdDictRegion * IdDictDictionary::find_region | ( | const std::string & | region_name | ) | const |
Definition at line 101 of file IdDictDictionary.cxx.
IdDictRegion * IdDictDictionary::find_region | ( | const std::string & | region_name, |
const std::string & | group_name | ||
) | const |
Definition at line 105 of file IdDictDictionary.cxx.
IdDictSubRegion * IdDictDictionary::find_subregion | ( | const std::string & | subregion_name | ) | const |
Definition at line 91 of file IdDictDictionary.cxx.
void IdDictDictionary::generate_implementation | ( | const IdDictMgr & | idd, |
const std::string & | tag = "" |
||
) |
Definition at line 174 of file IdDictDictionary.cxx.
int IdDictDictionary::get_label_value | ( | const std::string & | field, |
const std::string & | label, | ||
int & | value | ||
) | const |
Definition at line 73 of file IdDictDictionary.cxx.
void IdDictDictionary::integrate_bits | ( | ) |
Set up integral of bits for efficient unpacking.
Definition at line 279 of file IdDictDictionary.cxx.
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 457 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 534 of file IdDictDictionary.cxx.
int IdDictDictionary::reset | ( | size_t | index1, |
size_t | index2, | ||
size_t | region_index, | ||
Identifier & | packedId | ||
) | const |
void IdDictDictionary::reset_implementation | ( | ) |
Definition at line 221 of file IdDictDictionary.cxx.
Definition at line 147 of file IdDictDictionary.cxx.
|
inline |
Set the dictionary tag.
Definition at line 276 of file IdDictDictionary.h.
void IdDictDictionary::set_do_checks | ( | bool | do_checks | ) |
Definition at line 1170 of file IdDictDictionary.cxx.
void IdDictDictionary::set_do_neighbours | ( | bool | do_neighbours | ) |
Definition at line 1180 of file IdDictDictionary.cxx.
|
inline |
Set file name.
Definition at line 269 of file IdDictDictionary.h.
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 1229 of file IdDictDictionary.cxx.
int IdDictDictionary::unpack | ( | 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, considering the provided prefix (result will include the prefix) and up to index2 - (index1 is assumed to be 0, i.e.
Unpack the bits32 id to a string, considering the provided prefix (result will include the prefix) and up to index2 - (index1 is assumed to be 0, i.e.
part of prefix).
First we need to check whether the specified identifier prefix really matches the Dictionary specifications.
ok we require that the region is at least as large as the prefix.
We have one region that matches the prefix. Let's now try to expand the bits32 from the fields of the region that are beyond the prefix.
this index extracted from the bits32 does not match this field in the region... Let's try another region
Definition at line 800 of file IdDictDictionary.cxx.
int IdDictDictionary::unpack | ( | const Identifier & | id, |
const ExpandedIdentifier & | prefix, | ||
size_t | index2, | ||
ExpandedIdentifier & | unpackedId | ||
) | const |
Unpack the value_type id to an expanded Identifier, considering the provided prefix (result will include the prefix) and up to index2 - (index1 is assumed to be 0, i.e.
Unpack the bits32 id to an expanded Identifier, considering the provided prefix (result will include the prefix)
part of prefix).
First we need to check whether the specified identifier prefix really matches the Dictionary specifications.
ok we require that the region is at least as large as the prefix.
We have one region that matches the prefix. Let's now try to expand the bits32 from the fields of the region that are beyond the prefix.
this index extracted from the bits32 does not seem to match this field in the region... Let's try another region
this index extracted from the bits32 does not match this field in the region... Let's try another region
Definition at line 683 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 991 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 1208 of file IdDictDictionary.cxx.
std::vector<IdDictRegion*> IdDictDictionary::m_all_regions |
Definition at line 236 of file IdDictDictionary.h.
std::string IdDictDictionary::m_author |
Definition at line 219 of file IdDictDictionary.h.
std::string IdDictDictionary::m_date |
Definition at line 218 of file IdDictDictionary.h.
|
private |
Definition at line 243 of file IdDictDictionary.h.
|
private |
Definition at line 245 of file IdDictDictionary.h.
|
private |
Definition at line 246 of file IdDictDictionary.h.
std::map<std::string, IdDictField*> IdDictDictionary::m_fields |
Definition at line 233 of file IdDictDictionary.h.
|
private |
Definition at line 242 of file IdDictDictionary.h.
|
private |
Definition at line 244 of file IdDictDictionary.h.
std::vector<IdDictGroup*> IdDictDictionary::m_groups |
Definition at line 237 of file IdDictDictionary.h.
std::string IdDictDictionary::m_name |
Definition at line 216 of file IdDictDictionary.h.
IdDictDictionary* IdDictDictionary::m_parent_dict |
Definition at line 239 of file IdDictDictionary.h.
std::vector<IdDictRegion*> IdDictDictionary::m_regions |
Definition at line 235 of file IdDictDictionary.h.
std::vector<std::string> IdDictDictionary::m_subdictionary_names |
Definition at line 238 of file IdDictDictionary.h.
std::map<std::string, IdDictSubRegion*> IdDictDictionary::m_subregions |
Definition at line 234 of file IdDictDictionary.h.
std::string IdDictDictionary::m_version |
Definition at line 217 of file IdDictDictionary.h.