 |
ATLAS Offline Software
|
Go to the documentation of this file.
24 m_generated_implementation(false) {
30 m_generated_implementation(false) {
40 const std::vector<IdDictDictEntry*>&
45 const std::vector<IdDictRegion*>&
60 if (
"dummy" == region.
name())
continue;
84 (*it)->set_index(
index);
94 const std::string&
tag) {
96 std::cout <<
"IdDictGroup::generate_implementation>" << std::endl;
118 std::cout <<
"IdDictGroup::generate_implementation - mismatch of sizes: regions/entries "
133 (*it)->reset_implementation();
155 std::map< ExpandedIdentifier, IdDictDictEntry* >
regions;
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 "
204 m_children (std::in_place_index<0>,
205 impl.ored_field().get_indices(), 0)
213 if (m_children.index() == 0) {
215 auto&
children = std::get<0> (m_children);
217 while (ipos > 0 &&
children[ipos-1] == 0) {
223 while (ipos2 > 0 &&
children[ipos2-1] ==
c) {
226 if (ipos2 > 0)
return;
228 m_children.emplace<1> (ipos,
c);
246 std::vector<const IdDictFieldImplementation*>* impls )
const
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();
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);
493 [[maybe_unused]]
unsigned iregion = 0;
496 if (
re->fieldSize() == 0 ||
re->name() ==
"dummy") {
524 std::cout <<
"===== IdDictGroup " <<
m_name <<
"\n";
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();
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();
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.
void generate_implementation(const IdDictMgr &idd, IdDictDictionary &dictionary, const std::string &tag="")
RangeIterator begin() const
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.
void resolve_references(const IdDictMgr &idd, IdDictDictionary &dictionary, size_t &index)
void build_region_tree()
Take the list of regions and build a tree structure for fast unpacking.
const Range::field & field() const
size_type get_value_index(element_type value) const
MultiRange build_multirange() const
Get MultiRange for this group.
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 incl...
size_type bits_offset() const
void add_dictentry(IdDictDictEntry *entry)
regions_type::iterator regions_it
IdDictRegionTreeNode(const IdDictFieldImplementation &impl)
Constructor, taking a reference to the implementation.
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
Tree structure for fast unpacking.
void optimize()
Compress the vector of node indices, if they are all the same.
std::vector< size_type > index_vector
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
RangeIterator end() const
const std::string & name()
void reset_implementation()
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.
const std::vector< IdDictDictEntry * > & entries()
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.