Public Member Functions | Private Attributes

OA::Tree::PostOrderIterator Class Reference

#include <Tree.hpp>

Inheritance diagram for OA::Tree::PostOrderIterator:
Inheritance graph
[legend]
Collaboration diagram for OA::Tree::PostOrderIterator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PostOrderIterator (Tree &t)
virtual ~PostOrderIterator ()
void operator++ ()
void operator++ (int)
bool isValid () const
OA_ptr< Nodecurrent () const

Private Attributes

OA_ptr< Nodep

Detailed Description

Post-order iterator enumerates the nodes in post-order (a node's sub-trees are visited before the node).

If Tree is changed during iteration of nodes then the list contained within this Iterator may no longer be accurate. This iterator could also keep references to Node's no longer in the Tree.

OLD DESIGN notes (decided to use links): We don't want the Iterator to have an OA_ptr<> to the Tree itself because the Tree might have a getPostOrderIterator method and then we would have to pass this to an OA_ptr. If we did have an OA_ptr to the Tree then we could keep the current list with the Tree and it could be shared amongst various iterators. We could also do a better job of keeping the iterators up-to-date. We could also keep iterators better up-to-date if we figured out how to do the post-order links

Definition at line 428 of file Tree.hpp.


Constructor & Destructor Documentation

OA::Tree::PostOrderIterator::PostOrderIterator ( Tree t  ) 

PostOrderIterator creates an iterator to enumerate the tree nodes in post-order. If this is the first time a post-order traversal has been demanded for this tree, or the tree has changed since the last post-order traversal, a post-order walk is carried out using the recursive method create_postorder_links. This links up the nodes in post-order and subsequent post-order traversals simply follow the links.

Reimplemented in OA::ExprTree::PostOrderIterator, OA::ExprTree::PostOrderIterator, and OA::NewExprTree::PostOrderIterator.

Definition at line 128 of file Tree.cpp.

virtual OA::Tree::PostOrderIterator::~PostOrderIterator (  )  [inline, virtual]

Member Function Documentation

OA_ptr<Node> OA::Tree::PostOrderIterator::current (  )  const [inline]
bool OA::Tree::PostOrderIterator::isValid (  )  const [inline, virtual]

Implements OA::Iterator.

Definition at line 434 of file Tree.hpp.

References p, and OA::OA_ptr< T >::ptrEqual().

Referenced by operator++().

Here is the call graph for this function:

void OA::Tree::PostOrderIterator::operator++ (  )  [inline, virtual]

Implements OA::Iterator.

Definition at line 432 of file Tree.hpp.

References isValid(), and p.

Here is the call graph for this function:

void OA::Tree::PostOrderIterator::operator++ ( int   )  [inline]

Reimplemented from OA::Iterator.

Definition at line 433 of file Tree.hpp.


Member Data Documentation

Definition at line 438 of file Tree.hpp.

Referenced by current(), isValid(), and operator++().


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