proj home

Files   Classes   Functions   Hierarchy  

treeindexedD2iter< T > Class Template Reference

Iterate over the nodes of the tree. More...

#include <treeindexedD2iter.h>

Inheritance diagram for treeindexedD2iter< T >:
Collaboration diagram for treeindexedD2iter< T >:

List of all members.

Public Member Functions

 treeindexedD2iter (treeindexedD2< T > &tree_, boolc setreset=true)
 Pass in the tree.
void reset ()
 Reset the iterator.
void movedown ()
 From the current node as defined by path, fall down left first, then right.
void operator++ ()
 Move to the next node in the tree.
boolc operator! () const
 Is the iterator valid?
treeindexedD2node< T > * operator() () const
 Get the current node.
 treeindexedD2iter (treeindexedD2< T > &tree_, boolc setreset=true)
 Pass in the tree.
void reset ()
 Reset the iterator.
void movedown ()
 From the current node as defined by path, fall down left first, then right.
void operator++ ()
 Move to the next node in the tree.
boolc operator! () const
 Is the iterator valid?
treeindexedD2node< T > * operator() () const
 Get the current node.

Public Attributes

vector< treeindexedD2node< T > * > path
 List of nodes defining the current path.
treeindexedD2< T > & tree
 The tree this iterator is iterating over.


Detailed Description

template<typename T>
class treeindexedD2iter< T >

Iterate over the nodes of the tree.

Example 1
  cout << "Iterating over every node." << endl;
  treeindexedD2iter<uint> i1(t1,false);
  for ( i1.reset(); !i1; ++i1)
    cout << i1()->index << " ";
Example 2
  cout << "Iterating over every node." << endl;
  for ( treeindexedD2iter<uint> i1(t1); !i1; ++i1)
    cout << i1()->index << " ";

Definition at line 24 of file treeindexedD2iter.h.


Constructor & Destructor Documentation

template<typename T>
treeindexedD2iter< T >::treeindexedD2iter ( treeindexedD2< T > &  tree_,
boolc  setreset = true 
) [inline]

Pass in the tree.

Definition at line 36 of file treeindexedD2iter.h.

00037     : tree(tree_) { if (setreset) reset(); }

template<typename T>
treeindexedD2iter< T >::treeindexedD2iter ( treeindexedD2< T > &  tree_,
boolc  setreset = true 
) [inline]

Pass in the tree.

Definition at line 36 of file treeindexediter.h.

00037     : tree(tree_) { if (setreset) reset(); }


Member Function Documentation

template<typename T>
void treeindexedD2iter< T >::movedown (  ) 

From the current node as defined by path, fall down left first, then right.

The path is changed.

template<typename T>
void treeindexedD2iter< T >::movedown (  ) 

From the current node as defined by path, fall down left first, then right.

The path is changed.

Referenced by treeindexedD2iter< T >::operator++(), and treeindexedD2iter< T >::reset().

template<typename T>
boolc treeindexedD2iter< T >::operator! (  )  const [inline]

Is the iterator valid?

Definition at line 50 of file treeindexediter.h.

00051     { return !path.empty(); }

template<typename T>
boolc treeindexedD2iter< T >::operator! (  )  const [inline]

Is the iterator valid?

Definition at line 50 of file treeindexedD2iter.h.

00051     { return !path.empty(); }

template<typename T>
treeindexedD2node<T>* treeindexedD2iter< T >::operator() (  )  const [inline]

Get the current node.

Definition at line 54 of file treeindexediter.h.

00055     { assert(path.size()>0); return path[path.size()-1]; }

template<typename T>
treeindexedD2node<T>* treeindexedD2iter< T >::operator() (  )  const [inline]

Get the current node.

Definition at line 54 of file treeindexedD2iter.h.

00055     { assert(path.size()>0); return path[path.size()-1]; }

template<typename T>
void treeindexedD2iter< T >::operator++ (  ) 

template<typename T>
void treeindexedD2iter< T >::operator++ (  ) 

template<typename T>
void treeindexedD2iter< T >::reset (  ) 

Reset the iterator.

Reimplemented in treeindexedD2iterinternal< T >, and treeindexedD2iterinternal< T >.

template<typename T>
void treeindexedD2iter< T >::reset (  ) 


Member Data Documentation

template<typename T>
vector< treeindexedD2node< T > * > treeindexedD2iter< T >::path

List of nodes defining the current path.

The last node is the current node.

Definition at line 30 of file treeindexedD2iter.h.

Referenced by treeindexedD2iter< T >::movedown(), treeindexedD2iter< T >::operator!(), treeindexedD2iter< T >::operator()(), treeindexedD2iter< T >::operator++(), and treeindexedD2iter< T >::reset().

template<typename T>
treeindexedD2< T > & treeindexedD2iter< T >::tree

The tree this iterator is iterating over.

Definition at line 33 of file treeindexedD2iter.h.

Referenced by treeindexedD2iter< T >::reset().


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

Generated on Fri Mar 4 00:50:20 2011 for Chelton Evans Source by  doxygen 1.5.8