afl::FunctionIterator Class Reference

#include <functioniterator.h>

List of all members.

Public Types

typedef Functionpointer
typedef Functionreference

Public Member Functions

 FunctionIterator (Function *begin)
FunctionIterator operator++ (int)
FunctionIterator operator-- (int)
FunctionIteratoroperator++ ()
FunctionIteratoroperator-- ()
bool operator== (const FunctionIterator &toCompare) const
bool operator!= (const FunctionIterator &toCompare) const
reference operator * ()
pointer operator-> ()


Detailed Description

an iterator to traverse a function tree. This is a pre-order iterator which means that if a function X has an argument function Y, then X is traversed before Y, and that Y will immediately follow X in a depth-first fashion.

For example the function tree ((X + Y) * Z):

/ \ + Z / \ X Y

i = begin() --> i points at Multiply (internally: _curFn = [Multiply], _curArg = []) ++i; --> i points at Sum (internally: _curFn = [Multiply, Sum], _curArg = [0]) ++i; --> i points at Argument (X) (internally: _curFn = [Multiply, Sum, X], _curArg = [0,0]) ++i; --> i points at Argument (Y) (internally: _curFn = [Multiply, Sum, Y], _curArg = [0,1]) ++i; --> i points at Argument (Z) (internally: _curFn = [Multiply, Z], _curArg = [1]) ++i; --> i == end() is true (internally: _curFn = [], _curArg = [])


Member Typedef Documentation

typedef Function* afl::FunctionIterator::pointer
 

a pointer to a function

typedef Function& afl::FunctionIterator::reference
 

a function reference


Constructor & Destructor Documentation

afl::FunctionIterator::FunctionIterator Function begin  ) 
 

creates a new iterator for a subtree of a function tree with a root at begin. This iterator would never be able to traverse any functions outside this subtree (unless a different iterator is assigned to it.

Parameters:
begin the subtree to start with.


Member Function Documentation

reference afl::FunctionIterator::operator *  ) 
 

Returns:
a reference to the function this iterator is pointing at

bool afl::FunctionIterator::operator!= const FunctionIterator toCompare  )  const [inline]
 

compare whether two iterators are pointing at the same function

Parameters:
toCompare another iterator to compare to this one
Returns:
false both this and toCompare point at the same function even if they travesed different trees to get there or if both iterators are end iterators; true otherwise.

FunctionIterator& afl::FunctionIterator::operator++  ) 
 

point to the next Function in the serialised tree

Returns:
the function pointer to after the increment

FunctionIterator afl::FunctionIterator::operator++ int   ) 
 

point to the next Function in the serialised tree but return a pointer to the Function we were pointing at before the call

Returns:
the function pointer to before the increment

FunctionIterator& afl::FunctionIterator::operator--  ) 
 

point to the previous Function in the serialised tree

Returns:
the function pointer to after the decrement

FunctionIterator afl::FunctionIterator::operator-- int   ) 
 

point to the previous Function in the serialised tree but return a pointer to the Function we were pointing at before the call

Returns:
the function pointer to before the decrement

pointer afl::FunctionIterator::operator->  ) 
 

Returns:
a pointer to the function this iterator is pointing at

bool afl::FunctionIterator::operator== const FunctionIterator toCompare  )  const [inline]
 

compare whether two iterators are pointing at the same function

Parameters:
toCompare another iterator to compare to this one
Returns:
true both this and toCompare point at the same function even if they travesed different trees to get there or if both iterators are end iterators; false otherwise.


The documentation for this class was generated from the following file:
Generated on Fri Dec 22 07:17:51 2006 for afl by  doxygen 1.4.6