orxonox::ClassTreeMaskIterator Class Reference

The ClassTreeMaskIterator moves through all ClassTreeMaskNodes of the internal tree of a ClassTreeMask, containing the rules. More...

#include <src/core/ClassTreeMask.h>

List of all members.

Public Member Functions

 ClassTreeMaskIterator (ClassTreeMaskNode *node)
 Constructor: Initializes the iterator by creating a helper-list with the root-node and putting it to the stack.
 operator bool () const
 Returns true if the stack is empty, meaning we've reached the end of the tree.
bool operator!= (ClassTreeMaskNode *compare) const
 Compares the current node with the given one and returns true if they don't match.
ClassTreeMaskNodeoperator* () const
 Returns a pointer to the ClassTreeMaskNode whereon the iterator points.
const ClassTreeMaskIteratoroperator++ ()
 Iterates through the rule-tree.
ClassTreeMaskNodeoperator-> () const
 Returns a pointer to the ClassTreeMaskNode whereon the iterator points.
bool operator== (ClassTreeMaskNode *compare) const
 Compares the current node with the given one and returns true if they match.
 ~ClassTreeMaskIterator ()
 Destructor: Does nothing.

Private Attributes

std::stack< std::pair
< std::list< ClassTreeMaskNode * >
::iterator, std::list
< ClassTreeMaskNode * >
::iterator > > 
nodes_
 A stack to store list-iterators.
std::list< ClassTreeMaskNode * > rootlist_
 A list for internal use (it only stores the root-node).


Detailed Description

The ClassTreeMaskIterator moves through all ClassTreeMaskNodes of the internal tree of a ClassTreeMask, containing the rules.

Because of the complicated shape of the internal rule-tree of ClassTreeMask, an iterator is used to move through all nodes of the tree. It starts with the BaseObject and moves on to the first subclass until it reaches a leaf of the tree. Then the iterator moves one step back and iterates to the second subclass. If there are no more subclasses, it steps another step back, and so on.


Constructor & Destructor Documentation

orxonox::ClassTreeMaskIterator::ClassTreeMaskIterator ( ClassTreeMaskNode node  ) 

Constructor: Initializes the iterator by creating a helper-list with the root-node and putting it to the stack.

Parameters:
node The root-node

References nodes_, and rootlist_.

orxonox::ClassTreeMaskIterator::~ClassTreeMaskIterator (  ) 

Destructor: Does nothing.


Member Function Documentation

orxonox::ClassTreeMaskIterator::operator bool (  )  const

Returns true if the stack is empty, meaning we've reached the end of the tree.

Returns:
True if we've reached the end of the tree

References nodes_.

bool orxonox::ClassTreeMaskIterator::operator!= ( ClassTreeMaskNode compare  )  const

Compares the current node with the given one and returns true if they don't match.

Parameters:
compare The node to compare with
Returns:
The result of the comparison (true if they don't match)

References nodes_.

ClassTreeMaskNode * orxonox::ClassTreeMaskIterator::operator* (  )  const

Returns a pointer to the ClassTreeMaskNode whereon the iterator points.

Returns:
The pointer to the node

References nodes_.

const ClassTreeMaskIterator & orxonox::ClassTreeMaskIterator::operator++ (  ) 

Iterates through the rule-tree.

Returns:
A reference to the iterator itself

References nodes_.

ClassTreeMaskNode * orxonox::ClassTreeMaskIterator::operator-> (  )  const

Returns a pointer to the ClassTreeMaskNode whereon the iterator points.

Returns:
The pointer to the node

References nodes_.

bool orxonox::ClassTreeMaskIterator::operator== ( ClassTreeMaskNode compare  )  const

Compares the current node with the given one and returns true if they match.

Parameters:
compare The node to compare with
Returns:
The result of the comparison (true if they match)

References nodes_.


Member Data Documentation

std::stack<std::pair<std::list<ClassTreeMaskNode*>::iterator, std::list<ClassTreeMaskNode*>::iterator> > orxonox::ClassTreeMaskIterator::nodes_ [private]

A stack to store list-iterators.

Referenced by ClassTreeMaskIterator(), operator bool(), operator!=(), operator*(), operator++(), operator->(), and operator==().

A list for internal use (it only stores the root-node).

Referenced by ClassTreeMaskIterator().


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

Generated on Tue Jul 28 16:22:23 2009 for Orxonox by  doxygen 1.5.6