 |
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 339 of file IdDictGroup.cxx.
354 auto get_field_indices = [] (
const IdDictRegionTreeNode&
n,
359 if (
impl.field().isEnumerated()) {
360 const element_vector&
vals =
impl.field().get_values();
362 for (element_type
v :
vals) {
366 else if (
impl.field().isBounded()) {
367 auto [minval, maxval] =
impl.field().get_minmax();
385 auto&
children = std::get<0> (
n.m_children);
389 if (ifield ==
re.n_implementation()) {
390 index_vector
indices = get_field_indices (
n, prev_impl);
398 if (prev_impl.
bits() !=
n.m_impl.bits() ||
408 if (
n.m_impl.field() != prev_impl.
field()) {
409 if (!
n.m_other_impls) {
410 n.m_other_impls = std::make_unique<std::vector<const IdDictFieldImplementation*> > (1, &prev_impl);
413 if (std::ranges::find_if (*
n.m_other_impls,
415 { return a->field() == prev_impl.field(); })
416 ==
n.m_other_impls->end())
418 n.m_other_impls->push_back (&prev_impl);
431 unsigned new_node = 0;
432 std::vector<unsigned> nodes_seen;
444 if (next_node != 0) {
449 nodes_seen.push_back (next_node);
◆ build_multirange()
| MultiRange IdDictGroup::build_multirange |
( |
| ) |
const |
Get MultiRange for this group.
Definition at line 51 of file IdDictGroup.cxx.
57 if (
"dummy" == region->name())
continue;
61 if (region->is_empty())
continue;
63 Range r = region->build_range();
◆ build_region_tree()
| void IdDictGroup::build_region_tree |
( |
| ) |
|
Take the list of regions and build a tree structure for fast unpacking.
Definition at line 478 of file IdDictGroup.cxx.
481 [[maybe_unused]]
unsigned iregion = 0;
484 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 510 of file IdDictGroup.cxx.
512 std::cout <<
"===== IdDictGroup " <<
m_name <<
"\n";
◆ dump_regions()
| void IdDictGroup::dump_regions |
( |
| ) |
const |
Dump the list of regions for this group.
Definition at line 521 of file IdDictGroup.cxx.
523 std::cout <<
"Regions:\n";
525 std::cout <<
" " << iregion++ <<
" " <<
re->name() <<
" " <<
re->group_name() <<
" " <<
re->tag() <<
"\n";
526 size_t nimpl =
re->n_implementation();
528 for (
size_t i = 0;
i < nimpl; ++
i) {
530 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 541 of file IdDictGroup.cxx.
545 if (
n.m_children.index() == 0) {
546 sz += std::get<0>(
n.m_children).size();
549 std::cout <<
"Region Tree totsize " <<
sz <<
"\n";
551 std::cout <<
" " <<
inode++ <<
" " <<
n.m_impl.field()
552 <<
" " <<
n.m_impl.ored_field() <<
" -- ";
554 if (
n.m_children.index() == 0) {
555 const auto&
children = std::get<0> (
n.m_children);
562 if (!
first) std::cout <<
" ";
565 std::cout << istart <<
"-";
567 std::cout <<
i-1 <<
":";
581 if (!
first) std::cout <<
" ";
583 std::cout << istart <<
"-";
585 std::cout <<
children.size()-1 <<
":";
595 const auto&
children = std::get<1> (
n.m_children);
600 std::cout <<
"0-" <<
children.first-1 <<
":";
609 if (
n.m_other_impls) {
617 std::cout << ii->
field();
◆ entries()
◆ generate_implementation()
Definition at line 88 of file IdDictGroup.cxx.
92 std::cout <<
"IdDictGroup::generate_implementation>" << std::endl;
113 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 148 of file IdDictGroup.cxx.
149 std::map< ExpandedIdentifier, IdDictDictEntry* >
regions;
154 auto first = itr.begin();
155 auto last = itr.end();
159 std::cout <<
"IdDictDictionary::sort - WARNING empty region cannot sort "
166 std::vector<IdDictRegion*>::size_type vecIt = 0;
167 for (; mapIt !=
regions.end(); ++mapIt, ++vecIt) {
171 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 230 of file IdDictGroup.cxx.
265 validx =
n.m_impl.ored_field().get_value_index (
val);
268 validx =
n.m_impl.unpackToIndex (
id);
270 val =
n.m_impl.ored_field().get_value_at (validx);
271 }
catch (
const std::out_of_range&) {
278 if (
n.m_children.index() == 0) {
280 const auto&
children = std::get<0> (
n.m_children);
290 const auto&
children = std::get<1> (
n.m_children);
311 if (
n.m_impl.field().match (
val)) {
312 impls->push_back (&
n.m_impl);
314 else if (
n.m_other_impls) {
317 impls->push_back (ii);
322 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
IdDictRegion * selected_region()
Currently selected region.
std::string find(const std::string &s)
return a remapped string
ExpandedIdentifier::element_type element_type
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
const Range::field & ored_field() const
const std::vector< IdDictRegion * > & regions()
std::vector< element_type > element_vector
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
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.
void dump() const
Dump regions and tree for this group.