Orxonox: orxonox::ClassTreeMaskObjectIterator Class Reference

# orxonox::ClassTreeMaskObjectIterator Class Reference

The ClassTreeMaskObjectIterator iterates through all objects of all classes, included by a ClassTreeMask. More...

`#include <src/core/ClassTreeMask.h>`

List of all members.

## Public Member Functions

| ClassTreeMaskObjectIterator (const ClassTreeMask &mask)
| Constructor: Initializes the iterator from a given ClassTreeMask.
| ClassTreeMaskObjectIterator ()
| Defaultconstructor: Does nothing.
| operator bool () const
| Returns true if the ClassTreeMaskObjectIterator hasn't already reached the end.
bool | operator!= (BaseObject *pointer) const
| Returns true if the ClassTreeMaskObjectIterator doesn't point at the given object.
BaseObject * | operator* () const
| Returns the object the ClassTreeMaskObjectIterator currently points at.
const ClassTreeMaskObjectIterator & | operator++ ()
| Iterate to the next object (if any).
BaseObject * | operator-> () const
| Returns the object the ClassTreeMaskObjectIterator currently points at.
const ClassTreeMaskObjectIterator & | operator= (const ClassTreeMask &mask)
| Initializes the iterator from a given ClassTreeMask.
bool | operator== (BaseObject *pointer) const
| Returns true if the ClassTreeMaskObjectIterator points at the given object.

## Private Member Functions

void | create (ClassTreeMaskNode *node)
| Recursive function to create the Iterators subclass-list by going through the node-tree of the mask.

## Private Attributes

Iterator< BaseObject > | objectIterator_
| The current object of the iterator.
std::list< std::pair< const Identifier *, bool > > | subclasses_
| A list of all Identifiers through which objects the iterator should iterate.
std::list< std::pair< const Identifier *, bool > >::iterator | subclassIterator_
| The current class of the iterator.

## Detailed Description

The ClassTreeMaskObjectIterator iterates through all objects of all classes, included by a ClassTreeMask.

The ClassTreeMaskObjectIterator iterates through all objects of all classes, included by a ClassTreeMask. This is done the following way:

ClassTreeMask mask; for (ClassTreeMaskObjectIterator it = mask.begin(); it != mask.end(); ++it) it->doSomething();

Note: The ClassTreeMaskObjectIterator handles all objects as BaseObjects. If you want to use another class, you should use a dynamic_cast.

Performance of ClassTreeMaskObjectIterator is good as long as you don't exclude subclasses of included classes. Of course you can still exlucde subclasses, but if this is done more often, we need a new implementation using a second ObjectList in the Identifier, containing all objects of exactly one class.

## Constructor & Destructor Documentation

orxonox::ClassTreeMaskObjectIterator::ClassTreeMaskObjectIterator | ( |  | ) | `[inline]`

Defaultconstructor: Does nothing.

orxonox::ClassTreeMaskObjectIterator::ClassTreeMaskObjectIterator | ( | const ClassTreeMask & | mask | ) | `[inline]`

Constructor: Initializes the iterator from a given ClassTreeMask.

Parameters:

  | mask | The mask

## Member Function Documentation

void orxonox::ClassTreeMaskObjectIterator::create | ( | ClassTreeMaskNode * | node | ) | `[private]`

Recursive function to create the Iterators subclass-list by going through the node-tree of the mask.

Parameters:

  | node | The current node

References orxonox::ClassTreeMaskNode::getClass(), orxonox::Identifier::getDirectChildren(), orxonox::ClassTreeMaskNode::hasSubnodes(), orxonox::ClassTreeMaskNode::isIncluded(), subclasses_, and orxonox::ClassTreeMaskNode::subnodes_.

Referenced by operator=().

orxonox::ClassTreeMaskObjectIterator::operator bool | ( |  | ) | const`[inline]`

Returns true if the ClassTreeMaskObjectIterator hasn't already reached the end.

bool orxonox::ClassTreeMaskObjectIterator::operator!= | ( | BaseObject * | pointer | ) | const`[inline]`

Returns true if the ClassTreeMaskObjectIterator doesn't point at the given object.

Parameters:

  | pointer | The pointer of the object

BaseObject* orxonox::ClassTreeMaskObjectIterator::operator* | ( |  | ) | const`[inline]`

Returns the object the ClassTreeMaskObjectIterator currently points at.

const ClassTreeMaskObjectIterator & orxonox::ClassTreeMaskObjectIterator::operator++ | ( |  | ) |

Iterate to the next object (if any).

Returns:
  The iterator itself

References objectIterator_, subclasses_, and subclassIterator_.

Referenced by operator=().

BaseObject* orxonox::ClassTreeMaskObjectIterator::operator-> | ( |  | ) | const`[inline]`

Returns the object the ClassTreeMaskObjectIterator currently points at.

const ClassTreeMaskObjectIterator & orxonox::ClassTreeMaskObjectIterator::operator= | ( | const ClassTreeMask & | mask | ) |

Initializes the iterator from a given ClassTreeMask.

Parameters:

  | mask | The mask

References orxonox::ClassTreeMask::clean(), create(), objectIterator_, operator++(), orxonox::ClassTreeMask::root_, subclasses_, and subclassIterator_.

bool orxonox::ClassTreeMaskObjectIterator::operator== | ( | BaseObject * | pointer | ) | const`[inline]`

Returns true if the ClassTreeMaskObjectIterator points at the given object.

Parameters:

  | pointer | The pointer of the object

## Member Data Documentation

Iterator<BaseObject> orxonox::ClassTreeMaskObjectIterator::objectIterator_`[private]`

The current object of the iterator.

Referenced by operator++(), and operator=().

std::list<std::pair<const Identifier*, bool> > orxonox::ClassTreeMaskObjectIterator::subclasses_`[private]`

A list of all Identifiers through which objects the iterator should iterate.

Referenced by create(), operator++(), and operator=().

std::list<std::pair<const Identifier*, bool> >::iterator orxonox::ClassTreeMaskObjectIterator::subclassIterator_`[private]`

The current class of the iterator.

Referenced by operator++(), and operator=().

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

- src/core/ClassTreeMask.h
- src/core/ClassTreeMask.cc