 |
ATLAS Offline Software
|
#include <IdDictGroup.h>
|
| IdDictGroup () |
|
| IdDictGroup (const std::string &name) |
|
| ~IdDictGroup () |
|
const std::string & | name () |
|
const std::vector< IdDictDictEntry * > & | entries () |
|
const std::vector< IdDictRegion * > & | regions () |
|
MultiRange | build_multirange () const |
| Get MultiRange for this group. More...
|
|
void | add_dictentry (IdDictDictEntry *entry) |
|
void | resolve_references (const IdDictMgr &idd, IdDictDictionary &dictionary, size_t &index) |
|
void | generate_implementation (const IdDictMgr &idd, IdDictDictionary &dictionary, const std::string &tag="") |
|
void | reset_implementation () |
|
bool | verify () const |
|
void | sort () |
| Sort: More...
|
|
void | clear () |
|
int | unpack (const Identifier &id, const ExpandedIdentifier &prefix, size_t index2, ExpandedIdentifier &unpackedId, std::vector< const IdDictFieldImplementation * > *impls=nullptr) 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...
|
|
void | build_region_tree () |
| Take the list of regions and build a tree structure for fast unpacking. More...
|
|
void | dump () const |
| Dump regions and tree for this group. More...
|
|
void | dump_regions () const |
| Dump the list of regions for this group. More...
|
|
void | dump_tree () const |
| Dump the tree structure built from the regions for fast unpacking. More...
|
|
Definition at line 25 of file IdDictGroup.h.
◆ IdDictGroup() [1/2]
IdDictGroup::IdDictGroup |
( |
| ) |
|
◆ IdDictGroup() [2/2]
IdDictGroup::IdDictGroup |
( |
const std::string & |
name | ) |
|
◆ ~IdDictGroup()
IdDictGroup::~IdDictGroup |
( |
| ) |
|
◆ add_dictentry()
◆ add_tree_field()
void IdDictGroup::add_tree_field |
( |
const IdDictRegion & |
re, |
|
|
unsigned |
ifield, |
|
|
unsigned |
inode |
|
) |
| |
|
private |
Recursively add new nodes to the tree structure.
- Parameters
-
re | The region we're processing. |
ifield | The index of the next field to add. |
inode | The index of the node to which to add. |
Definition at line 351 of file IdDictGroup.cxx.
366 auto get_field_indices = [] (
const IdDictRegionTreeNode&
n,
371 if (
impl.field().isEnumerated()) {
372 const element_vector&
vals =
impl.field().get_values();
374 for (element_type
v :
vals) {
378 else if (
impl.field().isBounded()) {
379 auto [minval, maxval] =
impl.field().get_minmax();
397 auto&
children = std::get<0> (
n.m_children);
401 if (ifield ==
re.m_implementation.size()) {
402 index_vector
indices = get_field_indices (
n, prev_impl);
410 if (prev_impl.
bits() !=
n.m_impl.bits() ||
420 if (
n.m_impl.field() != prev_impl.
field()) {
421 if (!
n.m_other_impls) {
422 n.m_other_impls = std::make_unique<std::vector<const IdDictFieldImplementation*> > (1, &prev_impl);
425 if (std::ranges::find_if (*
n.m_other_impls,
427 { return a->field() == prev_impl.field(); })
428 ==
n.m_other_impls->end())
430 n.m_other_impls->push_back (&prev_impl);
443 unsigned new_node = 0;
444 std::vector<unsigned> nodes_seen;
456 if (next_node != 0) {
461 nodes_seen.push_back (next_node);
◆ build_multirange()
MultiRange IdDictGroup::build_multirange |
( |
| ) |
const |
◆ build_region_tree()
void IdDictGroup::build_region_tree |
( |
| ) |
|
Take the list of regions and build a tree structure for fast unpacking.
Definition at line 490 of file IdDictGroup.cxx.
493 [[maybe_unused]]
unsigned iregion = 0;
496 if (
re->fieldSize() == 0 ||
re->name() ==
"dummy") {
◆ clear()
void IdDictGroup::clear |
( |
| ) |
|
◆ dump()
void IdDictGroup::dump |
( |
| ) |
const |
Dump regions and tree for this group.
Definition at line 522 of file IdDictGroup.cxx.
524 std::cout <<
"===== IdDictGroup " <<
m_name <<
"\n";
◆ dump_regions()
void IdDictGroup::dump_regions |
( |
| ) |
const |
Dump the list of regions for this group.
Definition at line 533 of file IdDictGroup.cxx.
535 std::cout <<
"Regions:\n";
537 std::cout <<
" " << iregion++ <<
" " <<
re->name() <<
" " <<
re->m_group <<
" " <<
re->m_tag <<
"\n";
539 std::cout << (
first ?
" " :
"; ") <<
impl.field() <<
" " <<
impl.ored_field() <<
" " <<
impl.bits() <<
"/" <<
impl.bits_offset();
◆ dump_tree()
void IdDictGroup::dump_tree |
( |
| ) |
const |
Dump the tree structure built from the regions for fast unpacking.
Definition at line 550 of file IdDictGroup.cxx.
554 if (
n.m_children.index() == 0) {
555 sz += std::get<0>(
n.m_children).size();
558 std::cout <<
"Region Tree totsize " <<
sz <<
"\n";
560 std::cout <<
" " <<
inode++ <<
" " <<
n.m_impl.field()
561 <<
" " <<
n.m_impl.ored_field() <<
" -- ";
563 if (
n.m_children.index() == 0) {
564 const auto&
children = std::get<0> (
n.m_children);
571 if (!
first) std::cout <<
" ";
574 std::cout << istart <<
"-";
576 std::cout <<
i-1 <<
":";
590 if (!
first) std::cout <<
" ";
592 std::cout << istart <<
"-";
594 std::cout <<
children.size()-1 <<
":";
604 const auto&
children = std::get<1> (
n.m_children);
609 std::cout <<
"0-" <<
children.first-1 <<
":";
618 if (
n.m_other_impls) {
626 std::cout << ii->
field();
◆ entries()
◆ generate_implementation()
Definition at line 92 of file IdDictGroup.cxx.
96 std::cout <<
"IdDictGroup::generate_implementation>" << std::endl;
118 std::cout <<
"IdDictGroup::generate_implementation - mismatch of sizes: regions/entries "
◆ name()
const std::string & IdDictGroup::name |
( |
| ) |
|
◆ regions()
◆ reset_implementation()
void IdDictGroup::reset_implementation |
( |
| ) |
|
◆ resolve_references()
◆ sort()
void IdDictGroup::sort |
( |
| ) |
|
Sort:
Loop over regions and sort according to their first identifier
Definition at line 154 of file IdDictGroup.cxx.
155 std::map< ExpandedIdentifier, IdDictDictEntry* >
regions;
163 auto first = itr.begin();
164 auto last = itr.end();
168 std::cout <<
"IdDictDictionary::sort - WARNING empty region cannot sort "
175 std::vector<IdDictRegion*>::size_type vecIt = 0;
176 for (; mapIt !=
regions.end(); ++mapIt, ++vecIt) {
180 std::cout <<
"IdDictGroup::sort - WARNING region map size is NOT the same as the vector size. Map size "
◆ unpack()
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.
part of prefix). If impls is provided, then fill it with pointers to the implementations for each unpacked field.
Returns 0 on success, nonzero on error.
Definition at line 242 of file IdDictGroup.cxx.
277 validx =
n.m_impl.ored_field().get_value_index (
val);
280 validx =
n.m_impl.unpackToIndex (
id);
282 val =
n.m_impl.ored_field().get_value_at (validx);
283 }
catch (
const std::out_of_range&) {
290 if (
n.m_children.index() == 0) {
292 const auto&
children = std::get<0> (
n.m_children);
302 const auto&
children = std::get<1> (
n.m_children);
323 if (
n.m_impl.field().match (
val)) {
324 impls->push_back (&
n.m_impl);
326 else if (
n.m_other_impls) {
329 impls->push_back (ii);
334 if (unpackedId.
fields() != impls->size()) std::abort();
◆ verify()
bool IdDictGroup::verify |
( |
| ) |
const |
◆ m_entries
◆ m_generated_implementation
bool IdDictGroup::m_generated_implementation |
|
private |
◆ m_name
std::string IdDictGroup::m_name |
|
private |
◆ m_region_tree
◆ m_regions
The documentation for this class was generated from the following files:
JetConstituentVector::iterator iterator
virtual Range build_range() const override
std::string find(const std::string &s)
return a remapped string
ExpandedIdentifier::element_type element_type
IdDictRegion * m_selected_region
std::vector< IdDictRegion * > m_regions
std::pair< long int, long int > indices
void add(element_type value)
Append a value into a new field.
This iterator is able to generate all possible identifiers, from a fully bounded Range.
void dump_tree() const
Dump the tree structure built from the regions for fast unpacking.
std::vector< IdDictDictEntry * > m_entries
bool match(element_type value) const
The basic match operation Given a value, test to see if it satisfies the constraints for this field.
const Range::field & field() const
size_type get_value_index(element_type value) const
size_type bits_offset() const
regions_type::iterator regions_it
const Range::field & ored_field() const
const std::vector< IdDictRegion * > & regions()
std::vector< element_type > element_vector
regions_type::const_iterator regions_const_it
std::vector< IdDictRegionTreeNode > m_region_tree
The list of region nodes.
static constexpr unsigned END
Special value used to indicate that we've reached the end.
A MultiRange combines several Ranges.
ExpandedIdentifier::size_type size_type
entries_type::iterator entries_it
std::vector< size_type > index_vector
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
const std::string & name()
bool m_generated_implementation
void add_tree_field(const IdDictRegion &re, unsigned ifield, unsigned inode)
Recursively add new nodes to the tree structure.
const boost::regex re(r_e)
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
void clear()
Erase all fields.
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
void dump_regions() const
Dump the list of regions for this group.
const std::string & name() const
void dump() const
Dump regions and tree for this group.