| 580 | */ |
| 581 | template <typename Key> |
| 582 | static void collectMappings(Radix::Node<Key> *node, MappingSet &mappings) |
| 583 | { |
| 584 | if (node == nullptr) |
| 585 | return; |
| 586 | if (!node->inner) |
| 587 | { |
| 588 | for (auto mapping = node->leaf.mappings; mapping != nullptr; |
| 589 | mapping = mapping->next) |
| 590 | { |
| 591 | std::string str; |
| 592 | bitstring(node->key, str); |
| 593 | log(COLOR_NONE, '['); |
| 594 | log(COLOR_YELLOW, str.c_str()); |
| 595 | log(COLOR_NONE, ']'); |
| 596 | insertMapping(mapping, mappings); |
| 597 | stat_num_physical_mappings++; |
| 598 | } |
| 599 | } |
| 600 | else |
| 601 | { |
| 602 | for (unsigned i = 0; i < BRANCH_MAX; i++) |
| 603 | collectMappings(node->child[i], mappings); |
| 604 | } |
| 605 | delete node; |
| 606 | } |
| 607 | |
| 608 | /* |
| 609 | * Shrink a mapping (if possible). |
no test coverage detected