 |
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*>&
80 ent->set_index(
index);
90 const std::string&
tag) {
92 std::cout <<
"IdDictGroup::generate_implementation>" << std::endl;
113 std::cout <<
"IdDictGroup::generate_implementation - mismatch of sizes: regions/entries "
127 ent->reset_implementation();
149 std::map< ExpandedIdentifier, IdDictDictEntry* >
regions;
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 "
192 m_children (std::in_place_index<0>,
193 impl.ored_field().get_indices(), 0)
201 if (m_children.index() == 0) {
203 auto&
children = std::get<0> (m_children);
205 while (ipos > 0 &&
children[ipos-1] == 0) {
211 while (ipos2 > 0 &&
children[ipos2-1] ==
c) {
214 if (ipos2 > 0)
return;
216 m_children.emplace<1> (ipos,
c);
234 std::vector<const IdDictFieldImplementation*>* impls )
const
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();
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);
481 [[maybe_unused]]
unsigned iregion = 0;
484 if (
re->fieldSize() == 0 ||
re->name() ==
"dummy") {
512 std::cout <<
"===== IdDictGroup " <<
m_name <<
"\n";
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();
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();
JetConstituentVector::iterator iterator
virtual void clear() override
virtual Range build_range() const override
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.
void generate_implementation(const IdDictMgr &idd, IdDictDictionary &dictionary, const std::string &tag="")
RangeIterator begin() const
std::vector< IdDictDictEntry * > m_entries
const IdDictRegion & region(size_t index) const
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)
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
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
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.