3 #include <ITreeIterator.h>
4 #include <IBinaryTreeNode.h>
42 template <
typename NodeType>
47 friend class boost::serialization::access;
54 template <
class Archive>
55 void serialize(Archive &ar,
unsigned int const version){
56 boost::serialization::base_object<
60 ar &boost::serialization::base_object<
100 inline void start(NodeType *node)
override{
116 inline NodeType *
next()
override{
123 return (NodeType *) node;
Fast breadth first iterator for binary tree like nodes.
Definition: BinaryTreeFastBreadthIterator.h:43
deque< IBinaryTreeNode * > pendingNodes
Double ended queue used as a queue to handles nodes visiting.
Definition: BinaryTreeFastBreadthIterator.h:72
BinaryTreeFastBreadthIterator(NodeType *node)
Construct a binary tree fast breadth iterator calling the start method with given node.
Definition: BinaryTreeFastBreadthIterator.h:87
void start(NodeType *node) override
Start the iterator so the first visited node will be given one. It is, when calling next,...
Definition: BinaryTreeFastBreadthIterator.h:100
void serialize(Archive &ar, unsigned int const version)
Serialize a BinaryTreeFastBreadthIterator to a stream of bytes.
Definition: BinaryTreeFastBreadthIterator.h:55
NodeType * next() override
Obtain the next node according to breadth iteration criterion.
Definition: BinaryTreeFastBreadthIterator.h:116
BinaryTreeFastBreadthIterator()=default
Default constructor for binary tree fast breadth iterator.
bool hasNext() const override
Check if the iterator has more nodes to visit (true) or not (false)
Definition: BinaryTreeFastBreadthIterator.h:110
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