MCPcopy Create free account
hub / github.com/KLayout/klayout / print_tree_node

Function print_tree_node

src/db/unit_tests/dbBoxTreeTests.cc:47–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46template <class Box, class Tree>
47void print_tree_node (const Tree *tree, const Box &bbox, size_t pos, db::box_tree_node<Tree> *node, const std::string &in)
48{
49 std::cout << in << "x [\n";
50 if (! node) {
51 for (size_t i = pos; i < pos + tree->size (); ++i) {
52 std::cout << in << " " << tree->elements ()[i]->to_string () << "\n";
53 }
54 } else {
55 for (size_t i = pos; i < pos + node->lenq (-1); ++i) {
56 std::cout << in << " " << tree->elements ()[i]->to_string () << "\n";
57 }
58 }
59 std::cout << in << "]\n";
60 if (node) {
61 pos += node->lenq (-1);
62 for (int q = 0; q < 4; ++q) {
63 Box qb (qbox (q, bbox));
64 if (node->child (q)) {
65 std::cout << in << q << " (" << qb.to_string () << ") [\n";
66 print_tree_node (tree, qb, pos, node->child (q), in + " ");
67 std::cout << in << "]\n";
68 } else {
69 std::cout << in << q << " (" << qb.to_string () << ") [\n";
70 for (size_t i = pos; i < pos + node->lenq (q); ++i) {
71 std::cout << in << " " << tree->elements ()[i]->to_string () << " #" << i << "\n";
72 }
73 std::cout << in << "]\n";
74 }
75 pos += node->lenq (q);
76 }
77 }
78}
79
80template <class Tree>
81void print_tree (const Tree &t, db::Box bbox)

Callers 1

print_treeFunction · 0.85

Calls 5

qboxFunction · 0.85
lenqMethod · 0.80
sizeMethod · 0.45
to_stringMethod · 0.45
childMethod · 0.45

Tested by

no test coverage detected