ATLAS Offline Software
|
Abstract interface for iterating over a set of things. More...
#include <IIteration.h>
Public Member Functions | |
virtual | ~IIteration () |
This is a polymorphic class. More... | |
virtual const std::type_info & | elementTypeinfo () const =0 |
Return the element type of the collection. More... | |
virtual const void * | nextUntyped ()=0 |
Return a pointer to the next element in the iteration. More... | |
virtual void | releaseElementUntyped (const void *p) |
Release an object retrieved from the getter. More... | |
Abstract interface for iterating over a set of things.
There are a couple places where we provide an interface for iterating over a set of objects; ICollectionGetterTool and IMultiAssociationTool are two. This interface collects from these the methods that are common to the actual iteration. Some of the core code involved in iteration is non-trivial (such as wrapping variables in vectors) and we'd like to use the same code for getters and associators.
Note that generally the iteration must be initialized before starting to call next*. That's not covered by this interface; it should be specified in a derived interface.
Once you're done with an object, you should call releaseElement(). This will usually be a no-op, but it allows the getter to return a dynamically-allocated object.
Definition at line 40 of file IIteration.h.
|
inlinevirtual |
|
pure virtual |
Return the element type of the collection.
I.e., nextUntyped
returns a pointer to this type.
|
pure virtual |
Return a pointer to the next element in the iteration.
Return 0 when the collection has been exhausted.
|
virtual |
Release an object retrieved from the getter.
p | The object to release. |
Call this when you are done with the object returned by nextUntyped()
. The default implementation is a no-op, but if the getter dynamically allocated the object which it returned, this gives it a chance to free it.