Helios++
Helios software for LiDAR simulations
BinaryTreeBreadthIterator< NodeType > Class Template Reference

Like fast breadth first iterator but wrapping tree nodes inside a IterableTreeNode instance. More...

#include <BinaryTreeBreadthIterator.h>

Inheritance diagram for BinaryTreeBreadthIterator< NodeType >:
Collaboration diagram for BinaryTreeBreadthIterator< NodeType >:

Public Member Functions

 BinaryTreeBreadthIterator ()=default
 Default constructor for binary tree breadth iterator.
 
 BinaryTreeBreadthIterator (NodeType *node, int const depth=0)
 Construct a binary tree breadth iterator calling the start method with given node. More...
 
 BinaryTreeBreadthIterator (IterableTreeNode< IBinaryTreeNode > node)
 Construct a binary tree breadth iterator calling the start method with given iterable tree node. More...
 
void start (NodeType *node, int const depth=0)
 
void start (IterableTreeNode< IBinaryTreeNode > node) override
 Start the iterator so the first visited node will be given one. It is, when calling next, given node will be returned. More...
 
bool hasNext () const override
 Check if the iterator has more nodes to visit (true) or not (false) More...
 
IterableTreeNode< IBinaryTreeNodenext () override
 Obtain the next node according to breadth iteration criterion. More...
 
- Public Member Functions inherited from ITreeIterator< IterableTreeNode< IBinaryTreeNode > >
 ITreeIterator ()=default
 Default constructor for tree iterator.
 

Protected Attributes

deque< IterableTreeNode< IBinaryTreeNode > > pendingNodes
 Double ended queue used as a queue to handle nodes visiting.
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, unsigned int const version)
 Serialize a BinaryTreeBreadthIterator to a stream of bytes. More...
 

Friends

class boost::serialization::access
 

Detailed Description

template<typename NodeType>
class BinaryTreeBreadthIterator< NodeType >

Like fast breadth first iterator but wrapping tree nodes inside a IterableTreeNode instance.

Author
Alberto M. Esmoris Pena
Version
1.0
Template Parameters
NodeTypeType of binary tree node. It must correspond to a class which extends IBinaryTreeNode interface
See also
BinaryTreeFastBreadthIterator
IterableTreeNode
IBinaryTreeNode

Constructor & Destructor Documentation

◆ BinaryTreeBreadthIterator() [1/2]

template<typename NodeType >
BinaryTreeBreadthIterator< NodeType >::BinaryTreeBreadthIterator ( NodeType *  node,
int const  depth = 0 
)
inline

Construct a binary tree breadth iterator calling the start method with given node.

Parameters
nodeNode to start breadth iterating from
depthThe depth at which given node is said to be located
See also
BinaryTreeBreadthIterator::start

◆ BinaryTreeBreadthIterator() [2/2]

template<typename NodeType >
BinaryTreeBreadthIterator< NodeType >::BinaryTreeBreadthIterator ( IterableTreeNode< IBinaryTreeNode node)
inline

Construct a binary tree breadth iterator calling the start method with given iterable tree node.

Parameters
nodeIterable tree node to start breadth iterating from
See also
BinaryTreeBreadthIterator::start

Member Function Documentation

◆ hasNext()

template<typename NodeType >
bool BinaryTreeBreadthIterator< NodeType >::hasNext ( ) const
inlineoverridevirtual

Check if the iterator has more nodes to visit (true) or not (false)

Returns
True if there are nodes left to be visited, false otherwise
See also
ITreeIterator::hasNext

Implements ITreeIterator< IterableTreeNode< IBinaryTreeNode > >.

◆ next()

template<typename NodeType >
IterableTreeNode<IBinaryTreeNode> BinaryTreeBreadthIterator< NodeType >::next ( )
inlineoverridevirtual

Obtain the next node according to breadth iteration criterion.

Returns
Next node according to breadth iteration criterion
See also
ITreeIterator::next

Implements ITreeIterator< IterableTreeNode< IBinaryTreeNode > >.

◆ serialize()

template<typename NodeType >
template<class Archive >
void BinaryTreeBreadthIterator< NodeType >::serialize ( Archive &  ar,
unsigned int const  version 
)
inlineprivate

Serialize a BinaryTreeBreadthIterator to a stream of bytes.

Template Parameters
ArchiveType of rendering
Parameters
arSpecific rendering for the stream of bytes
versionVersion number for the BinaryTreeBreadthIterator

◆ start() [1/2]

template<typename NodeType >
void BinaryTreeBreadthIterator< NodeType >::start ( IterableTreeNode< IBinaryTreeNode node)
inlineoverridevirtual

Start the iterator so the first visited node will be given one. It is, when calling next, given node will be returned.

Parameters
nodeNode to start depth iterating from
See also
ITreeIterator::start

Implements ITreeIterator< IterableTreeNode< IBinaryTreeNode > >.

◆ start() [2/2]

template<typename NodeType >
void BinaryTreeBreadthIterator< NodeType >::start ( NodeType *  node,
int const  depth = 0 
)
inline
Parameters
depthThe depth at which given node is said to be located
See also
start(IterableTreeNode<IBinaryTreeNode>)

The documentation for this class was generated from the following file: