Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
ObjectIterator Class Referenceabstract

#include <ObjectIter.h>

Inherits MemoryPoolObject.

Inherited by SimpleObjectIterator.

Public Member Functions

virtual Objectfirst ()=0
 reset iterator and return first item (or null if iter is empty)
 
virtual Objectnext ()=0
 advance and return next item (or null if no more to iterate)
 
- Public Member Functions inherited from MemoryPoolObject
void deleteInstance ()
 

Additional Inherited Members

- Protected Member Functions inherited from MemoryPoolObject
virtual ~MemoryPoolObject ()
 
void * operator new (size_t s)
 
void operator delete (void *p)
 
virtual MemoryPoolgetObjectMemoryPool ()=0
 

Detailed Description

ObjectIterator is an ABC that's used to iterate over an arbitrary list of Objects. (duh!)

As of this writing, only PartitionManager actually provides an instance of this, but it seems fairly likely that other folks might want to in the future, so here it is.

typical usage:

iter = ThePartitionManager->iterateInRange(...); for (Object *otherObject = iter->first(); otherObject; otherObject = iter->next()) { do something with other } iter->deleteInstance(); // you own it, so you must delete it

note that the iterator is required to deal intelligently with deleted objects; in particular, next() will check if an obj has been killed and simply skip it.

Definition at line 75 of file ObjectIter.h.

Member Function Documentation

◆ first()

virtual Object * ObjectIterator::first ( )
pure virtual

reset iterator and return first item (or null if iter is empty)

Implemented in SimpleObjectIterator.

◆ next()

virtual Object * ObjectIterator::next ( )
pure virtual

advance and return next item (or null if no more to iterate)

Implemented in SimpleObjectIterator.


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