Recursively add new nodes to the tree structure.
329{
334
335
336
337
338
339
340
342 const IdDictFieldImplementation& impl)
343 {
346 if (impl.field().isEnumerated()) {
347 const element_vector&
vals = impl.field().get_values();
349 for (element_type v : vals) {
351 }
352 }
353 else if (impl.field().isBounded()) {
354 auto [minval, maxval] = impl.field().get_minmax();
357 indices.resize (maxidx - minidx + 1);
359 }
360 else {
361 std::abort();
362 }
364 };
365
366
367 const IdDictFieldImplementation& prev_impl =
re.implementation(ifield-1);
368
369 {
370
372 auto&
children = std::get<0> (
n.m_children);
373
374
375
376 if (ifield ==
re.n_implementation()) {
377 index_vector
indices = get_field_indices (n, prev_impl);
378 for (size_t idx : indices) {
380 }
381 return;
382 }
383
384
385 if (prev_impl.
bits() !=
n.m_impl.bits() ||
388 {
390 std::abort();
391 }
392
393
394
395 if (
n.m_impl.field() != prev_impl.
field()) {
396 if (!
n.m_other_impls) {
397 n.m_other_impls = std::make_unique<std::vector<const IdDictFieldImplementation*> > (1, &prev_impl);
398 }
399 else {
400 if (std::ranges::find_if (*
n.m_other_impls,
401 [&](
const IdDictFieldImplementation*
a)
402 { return a->field() == prev_impl.field(); })
403 ==
n.m_other_impls->end())
404 {
405 n.m_other_impls->push_back (&prev_impl);
406 }
407 }
408 }
409 }
410
411
413 const IdDictFieldImplementation& impl =
re.implementation(ifield);
414
415
416 auto children = [&]() -> std::vector<unsigned>& {
return std::get<0> (
m_region_tree[inode].m_children); };
417
418 unsigned new_node = 0;
419 std::vector<unsigned> nodes_seen;
420
421
422 for (size_t idx : indices) {
423
424
425 unsigned next_node =
children().at (idx);
428 std::abort();
429 }
430
431 if (next_node != 0) {
432
433
434 if (std::ranges::find (nodes_seen, next_node) == nodes_seen.end()) {
436 nodes_seen.push_back (next_node);
437 }
438 }
439 else {
440
441 if (new_node != 0) {
442
444 }
445 else {
446
449 std::abort();
450 }
451
455 }
456 }
457 }
458}
const boost::regex re(r_e)
size_type bits_offset() const
const Range::field & ored_field() const
const Range::field & field() const
std::vector< IdDictRegionTreeNode > m_region_tree
The list of region nodes.
void add_tree_field(const IdDictRegion &re, unsigned ifield, unsigned inode)
Recursively add new nodes to the tree structure.
void dump() const
Dump regions and tree for this group.
ExpandedIdentifier::size_type size_type
std::vector< element_type > element_vector
size_type get_value_index(element_type value) const
ExpandedIdentifier::element_type element_type
std::vector< size_type > index_vector
std::pair< long int, long int > indices
Tree structure for fast unpacking.
static constexpr unsigned END
Special value used to indicate that we've reached the end.