Replace `Preorder_tree_walker` with `Preorder`

This commit is contained in:
Jackson Campolattaro 2020-07-09 10:46:47 -04:00
parent 167b5e20bc
commit d701daf93d
3 changed files with 9 additions and 41 deletions

View File

@ -17,7 +17,7 @@ template<class PointRange,
ostream &operator<<(ostream &os, const CGAL::Octree::Octree<PointRange, PointMap> &octree) {
// Create a range of nodes
auto nodes = octree.template walk<CGAL::Octree::Walker::Preorder_tree_walker>();
auto nodes = octree.template walk<CGAL::Octree::Walker::Preorder>();
// Iterate over the range and print each node
for (auto &n : nodes)

View File

@ -75,7 +75,7 @@ struct Preorder {
}
template<class Value>
const Node::Node <Value> *operator()(const Node::Node <Value> *n) const {
const Node::Node <Value> *next(const Node::Node <Value> *n) const {
if (n->is_leaf()) {
@ -100,13 +100,13 @@ struct Preorder {
struct Postorder {
template<class Value>
const Node::Node <Value> *first(const Node::Node <Value> *root) {
const Node::Node <Value> *first(const Node::Node <Value> *root) const {
return deepest_first_child(root);
}
template<class Value>
const Node::Node <Value> *operator()(const Node::Node <Value> *n) {
const Node::Node <Value> *next(const Node::Node <Value> *n) const {
auto next = deepest_first_child(next_sibling(n));
@ -120,13 +120,13 @@ struct Postorder {
struct Leaves {
template<class Value>
const Node::Node <Value> *first(const Node::Node <Value> *root) {
const Node::Node <Value> *first(const Node::Node <Value> *root) const {
return deepest_first_child(root);
}
template<class Value>
const Node::Node <Value> *operator()(const Node::Node <Value> *n) {
const Node::Node <Value> *next(const Node::Node <Value> *n) const {
auto next = deepest_first_child(next_sibling(n));
@ -137,38 +137,6 @@ struct Leaves {
}
};
class Preorder_tree_walker {
public:
template<class Value>
const Node::Node <Value> *first(const Node::Node <Value> *root) const {
return root;
}
template<class Value>
const Node::Node <Value> *next(const Node::Node <Value> *n) const {
if (n->is_leaf()) {
auto next = next_sibling(n);
if (nullptr == next) {
return next_sibling_up(n);
}
return next;
} else {
return &(*n)[0];
}
}
};
}
}

View File

@ -28,7 +28,7 @@ bool test_preorder_1_node() {
octree.refine(10, 1);
// Create the range
auto nodes = octree.walk<CGAL::Octree::Walker::Preorder_tree_walker>();
auto nodes = octree.walk<CGAL::Octree::Walker::Preorder>();
// Check each item in the range
auto iter = nodes.begin();
@ -50,7 +50,7 @@ bool test_preorder_9_nodes() {
octree.refine(10, 1);
// Create the range
auto nodes = octree.walk<CGAL::Octree::Walker::Preorder_tree_walker>();
auto nodes = octree.walk<CGAL::Octree::Walker::Preorder>();
// Check each item in the range
auto iter = nodes.begin();
@ -78,7 +78,7 @@ bool test_preorder_25_nodes() {
octree.refine(10, 1);
// Create the range
auto nodes = octree.walk<CGAL::Octree::Walker::Preorder_tree_walker>();
auto nodes = octree.walk<CGAL::Octree::Walker::Preorder>();
// Check each item in the range
auto iter = nodes.begin();