Skip to content

Commit

Permalink
Begin outlining a new potential solution for working with walker methods
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonCampolattaro committed Jul 3, 2020
1 parent d6da421 commit ec7b4a8
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Octree/include/CGAL/Octree.h
Expand Up @@ -290,6 +290,13 @@ namespace CGAL {
Walker_iterator<const Node>());
}

template<class Walker>
Node_range nodes() const {
Node_walker first = Walker::first;
Node_walker next = Walker::next;
return nodes(first(m_root), next);
}

/// @}

/// \name Operators
Expand Down
34 changes: 34 additions & 0 deletions Octree/include/CGAL/Octree/Walker_criterion.h
Expand Up @@ -3,6 +3,7 @@

#include <iostream>
#include "Node.h"
#include "Walker_iterator.h"

namespace CGAL {

Expand Down Expand Up @@ -64,6 +65,39 @@ namespace CGAL {
return first;
}

class _Preorder {

public:

template<class Value>
static const Node::Node<Value> *first(const Node::Node<Value> *root) {
return root;
}

template<class Value>
static const Node::Node<Value> *next(const Node::Node<Value> *n) {

if (n->is_leaf()) {

auto next = next_sibling(n);

if (nullptr == next) {

return next_sibling_up(n);
}

return next;

} else {

// Return the first child of this node
return &(*n)[0];
}

}
};


struct Preorder {

template<class Value>
Expand Down

0 comments on commit ec7b4a8

Please sign in to comment.