Template Class iterator_base

Nested Relationships

Nested Types

Inheritance Relationships

Derived Types

Class Documentation

template<class NodeType>
class iterator_base

Base class for OcTree iterators. So far, all iterator’s are const with respect to the tree. This file is included within OcTreeBaseImpl.h, you should probably not include this directly.

Subclassed by leaf_bbx_iterator, leaf_iterator, tree_iterator

Public Types

using iterator_category = std::forward_iterator_tag
using value_type = NodeType
using difference_type = NodeType
using pointer = NodeType*
using reference = NodeType&

Public Functions

inline iterator_base()

Default ctor, only used for the end-iterator.

inline iterator_base(OcTreeBaseImpl<NodeType, INTERFACE> const *ptree, uint8_t depth = 0)

Constructor of the iterator. Initializes the iterator with the default constructor (= end() iterator) if tree is empty or NULL.

Parameters:
  • ptree – OcTreeBaseImpl on which the iterator is used on

  • depth – Maximum depth to traverse the tree. 0 (default): unlimited

inline iterator_base(const iterator_base &other)

Copy constructor of the iterator.

inline bool operator==(const iterator_base &other) const

Comparison between iterators. First compares the tree, then stack size and top element of stack.

inline bool operator!=(const iterator_base &other) const

Comparison between iterators. First compares the tree, then stack size and top element of stack.

inline iterator_base &operator=(const iterator_base &other)
inline NodeType const *operator->() const

Ptr operator will return the current node in the octree which the iterator is referring to

inline NodeType *operator->()

Ptr operator will return the current node in the octree which the iterator is referring to

inline const NodeType &operator*() const

Return the current node in the octree which the iterator is referring to

inline NodeType &operator*()

Return the current node in the octree which the iterator is referring to

inline point3d getCoordinate() const

return the center coordinate of the current node

inline double getX() const
Returns:

single coordinate of the current node

inline double getY() const
Returns:

single coordinate of the current node

inline double getZ() const
Returns:

single coordinate of the current node

inline double getSize() const
Returns:

the side of the volume occupied by the current node

inline unsigned getDepth() const

return depth of the current node

inline const OcTreeKey &getKey() const
Returns:

the OcTreeKey of the current node

inline OcTreeKey getIndexKey() const
Returns:

the OcTreeKey of the current node, for nodes with depth != maxDepth

Protected Functions

inline void singleIncrement()

One step of depth-first tree traversal. How this is used depends on the actual iterator.

Protected Attributes

OcTreeBaseImpl<NodeType, INTERFACE> const *tree

Octree this iterator is working on.

uint8_t maxDepth

Maximum depth for depth-limited queries.

std::stack<StackElement, std::vector<StackElement>> stack

Internal recursion stack. Apparently a stack of vector works fastest here.

struct StackElement

Element on the internal recursion stack of the iterator.

Public Members

NodeType *node
OcTreeKey key
uint8_t depth