Orxonox  0.0.5 Codename: Arcturus
Classes | Namespaces

Definition of the Iterator class, used to iterate through object-lists. More...

#include "core/CorePrereqs.h"
#include "ObjectListBase.h"
#include "IteratorBase.h"

Go to the source code of this file.

Classes

class  orxonox::Iterator< T >
 The Iterator allows to iterate through a given ObjectList. More...
 

Namespaces

 orxonox
 Die Wagnis Klasse hat die folgenden Aufgaben:
 

Detailed Description

Definition of the Iterator class, used to iterate through object-lists.

Iterator allows to iterate through an ObjectListBase. Objects in this list are cast to the template argument T of Iterator<T> using dynamic_cast. In contrast to ObjectListIterator<T>, Iterator<T> can iterate through every object-list. In practice though it is limited to objects of type T and its subclasses. Because of the dynamic_cast, this iterator is much slower than ObjectListIterator.

Usage:

for (Iterator<myClass> it = anyidentifier->getObjects()->begin(); it != anyidentifier->getObjects()->end(); ++it)
{
it->someFunction(...);
myClass* myObject = *it;
}