#include <src/core/ClassTreeMask.h>
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. | |
ClassTreeMaskNode * | operator* () const |
Returns a pointer to the ClassTreeMaskNode whereon the iterator points. | |
const ClassTreeMaskIterator & | operator++ () |
Iterates through the rule-tree. | |
ClassTreeMaskNode * | operator-> () 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). |
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.
orxonox::ClassTreeMaskIterator::ClassTreeMaskIterator | ( | ClassTreeMaskNode * | node | ) |
orxonox::ClassTreeMaskIterator::~ClassTreeMaskIterator | ( | ) |
Destructor: Does nothing.
orxonox::ClassTreeMaskIterator::operator bool | ( | ) | const |
Returns true if the stack is empty, meaning 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.
compare | The node to compare with |
References nodes_.
ClassTreeMaskNode * orxonox::ClassTreeMaskIterator::operator* | ( | ) | const |
Returns a pointer to the ClassTreeMaskNode whereon the iterator points.
References nodes_.
const ClassTreeMaskIterator & orxonox::ClassTreeMaskIterator::operator++ | ( | ) |
ClassTreeMaskNode * orxonox::ClassTreeMaskIterator::operator-> | ( | ) | const |
Returns a pointer to the ClassTreeMaskNode whereon the iterator points.
References nodes_.
bool orxonox::ClassTreeMaskIterator::operator== | ( | ClassTreeMaskNode * | compare | ) | const |
Compares the current node with the given one and returns true if they match.
compare | The node to compare with |
References nodes_.
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==().
std::list<ClassTreeMaskNode*> orxonox::ClassTreeMaskIterator::rootlist_ [private] |