LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::tree< T >::iterator Class Reference

Iterator type (allows read and write operations). More...

#include <ltiTree.h>

Collaboration diagram for lti::tree< T >::iterator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 iterator ()
 iterator (const iterator &other)
iteratoroperator++ ()
bool operator== (const iterator &other) const
bool operator!= (const iterator &other) const
nodeoperator* ()
iteratoroperator= (const iterator &other)

Protected Member Functions

 iterator (node &theNode, nodeManager &owner)

Protected Attributes

std::list< int > stack
nodepointedNode
nodeManagertheOwner

Detailed Description

template<class T>
class lti::tree< T >::iterator

Iterator type (allows read and write operations).

The use of the iterator classes is similar to the iterators of the STL (Standard Template Library). See lti::tree::begin() for an example

CAUTION: Try to use the prefix incremental operator (i.e. ++it) instead of the postfix operator (i.e. it++) to allow efficient code!

CAUTION: Do not delete sibling nodes of already iterated nodes: the iterator keeps track of them, and if you delete them invalid references to unexistent nodes could be returned by late iterations. It IS save to insert or delete children of the nodes pointed by the iterator (but this could invalidate other iterators on the same tree). If you really really need to do things like that, you should use your own node pointers and iteration mechanisms :-(

The iterators will traverse the tree in a prefix form (first the node and then the children)


Constructor & Destructor Documentation

template<class T>
lti::tree< T >::iterator::iterator ( node theNode,
nodeManager owner 
) [inline, explicit, protected]

Create an iterator initialized with the given pointer to a node.

template<class T>
lti::tree< T >::iterator::iterator (  )  [inline]

Default constructor.

template<class T>
lti::tree< T >::iterator::iterator ( const iterator other  )  [inline]

Copy constructor.


Member Function Documentation

template<class T>
bool lti::tree< T >::iterator::operator!= ( const iterator other  )  const [inline]

Compare this iterator with the other one.

References lti::tree< T >::iterator::pointedNode.

template<class T>
node& lti::tree< T >::iterator::operator* (  )  [inline]

Get pointed data.

References lti::tree< T >::iterator::pointedNode.

template<class T>
iterator& lti::tree< T >::iterator::operator++ (  )  [inline]
template<class T>
iterator& lti::tree< T >::iterator::operator= ( const iterator other  )  [inline]
template<class T>
bool lti::tree< T >::iterator::operator== ( const iterator other  )  const [inline]

Compare this iterator with the other one.

References lti::tree< T >::iterator::pointedNode.


Member Data Documentation

template<class T>
node* lti::tree< T >::iterator::pointedNode [protected]
template<class T>
std::list<int> lti::tree< T >::iterator::stack [protected]
template<class T>
nodeManager* lti::tree< T >::iterator::theOwner [protected]

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

Generated on Sat Apr 10 15:28:48 2010 for LTI-Lib by Doxygen 1.6.1