OOF2: The Manual

Name

ComponentIterator — Base class for iterators that loop over Components objects

Synopses

C++ Synopsis

#include "engine/fieldindex.h" 
class ComponentIterator {
  virtual bool operator!=(const ComponentIterator& other) const;
  virtual ComponentIterator& operator++();
  virtual FieldIndex* fieldindex() const;
  IndexP operator*() const;
}

Source Files

  • SRC/engine/fieldindex.h: C++ header
  • SRC/engine/fieldindex.C: C++ source code
  • SRC/engine/fieldindex.swg: SWIG source code

Description

ComponentIterator is the base class for objects that iterate over Components objects. They are created and returned by the begin() and end() methods in the Components class, and should never be created explicitly. Different subclasses of ComponentIterator iterate over different subclasses of Components.

The ComponentIterator class and its subclasses are not directly available in Python. Iteration in Python is handled by the ComponentIteratorP class.

Methods

virtual bool operator!=(const ComponentIterator& other) const

Do this ComponentIterator and the other one point to the same FieldIndex? It is assumed that they are iterating over the same subclass of Components. Comparing different types of ComponentIterator is an error. Fortunately this should be difficult to do.

virtual ComponentIterator& operator++()

Increment the iterator to point to the next FieldIndex.

virtual FieldIndex* fieldindex() const

Return a pointer to a newly allocated FieldIndex. The value of the index is determined by the state of the iterator.

IndexP operator*() const

Dereference the iterator, returning an IndexP. The IndexP wraps the pointer returned by fieldindex().