3 #include <ITreeIterator.h>
4 #include <IBinaryTreeNode.h>
46 template <
typename NodeType>
51 friend class boost::serialization::access;
58 template<
class Archive>
59 void serialize(Archive &ar,
const unsigned int version){
60 boost::serialization::base_object<
64 ar &boost::serialization::base_object<
103 inline void start(NodeType *node)
override{
119 inline NodeType *
next()
override {
126 return (NodeType *) node;
Fast depth first iterator for binary tree like nodes.
Definition: BinaryTreeFastDepthIterator.h:47
void start(NodeType *node) override
Start the iterator so the first visited node will be given one. It is, when calling next,...
Definition: BinaryTreeFastDepthIterator.h:103
BinaryTreeFastDepthIterator()=default
Default constructor for binary tree fast depth iterator.
void serialize(Archive &ar, const unsigned int version)
Serialize a BinaryTreeFastDepthIterator to a stream of bytes.
Definition: BinaryTreeFastDepthIterator.h:59
deque< IBinaryTreeNode * > pendingNodes
Double ended queue used as a stack to handle nodes visiting.
Definition: BinaryTreeFastDepthIterator.h:76
BinaryTreeFastDepthIterator(NodeType *node)
Construct a binary tree fast depth iterator calling the start method with given node.
Definition: BinaryTreeFastDepthIterator.h:91
NodeType * next() override
Obtain the next node according to depth iteration criterion.
Definition: BinaryTreeFastDepthIterator.h:119
bool hasNext() const override
Check if the iterator has more nodes to visit (true) or not (false)
Definition: BinaryTreeFastDepthIterator.h:113
Binary tree node interface that must be implemented by any class providing binary tree node based fun...
Definition: IBinaryTreeNode.h:10
virtual IBinaryTreeNode * getLeftChild() const =0
Obtain the left child of current node.
virtual IBinaryTreeNode * getRightChild() const =0
Obtain the right child of current node.
Interface defining core mechanisms that must be provided by any tree iterator.
Definition: ITreeIterator.h:13