gatb.core-API-0.0.0
|
Iterator that notifies some listener during iteration. More...
#include <IteratorHelpers.hpp>
Public Member Functions | |
SubjectIterator (Iterator< Item > *ref, u_int32_t modulo, IteratorListener *listener=0) | |
~SubjectIterator () | |
void | first () |
bool | isDone () |
void | next () |
Item & | item () |
void | setItem (Item ¤t) |
void | reset () |
std::vector< Iterator< Item > * > | getComposition () |
Public Member Functions inherited from Iterator< Item > | |
Item * | operator-> () |
Item & | operator* () |
template<typename Functor > | |
void | iterate (const Functor &f) |
bool | get (std::vector< Item > ¤t) |
virtual void | finalize () |
Public Member Functions inherited from SmartPointer | |
void | use () |
void | forget () |
Public Member Functions inherited from ISmartPointer | |
virtual | ~ISmartPointer () |
Public Member Functions inherited from AbstractSubjectIterator | |
AbstractSubjectIterator () | |
~AbstractSubjectIterator () | |
void | addObserver (IteratorListener *f) |
void | removeObserver (IteratorListener *f) |
void | setMessage (const std::string &message) |
Additional Inherited Members | |
Protected Member Functions inherited from SmartPointer | |
SmartPointer () | |
virtual | ~SmartPointer () |
Protected Member Functions inherited from AbstractSubjectIterator | |
void | notifyInc (u_int64_t current) |
void | notifyInit () |
void | notifyFinish () |
Iterator that notifies some listener during iteration.
Implementation note: we have to keep reference (through pointers) on functors because we want them to be notified and not a copy of them.
Note also that we don't allow to have twice the same observer (we use a set as observers container).
|
inline |
Constructor
[in] | ref | : the referred iterator |
[in] | modulo | : notifies every 'modulo' time |
[in] | listener | : default listener attached to this subject (default value is 0) |
|
inline |
Destructor.
|
inlinevirtual |
Method that initializes the iteration.
Implements Iterator< Item >.
|
inlinevirtual |
Get a vector holding the composite structure of the iterator.
Reimplemented from Iterator< Item >.
|
inlinevirtual |
Method telling whether the iteration is finished or not.
Implements Iterator< Item >.
|
inlinevirtual |
Method that returns the current iterated item. Note that the returned type is the template type.
Implements Iterator< Item >.
|
inlinevirtual |
Method that goes to the next item in the iteration.
Implements Iterator< Item >.
|
inlinevirtual |
Reset the iterator.
Reimplemented from Iterator< Item >.
|
inlinevirtual |
Get a reference on the object to be configured as the currently iterated item.
[in] | i | : object to be referred. |
Reimplemented from Iterator< Item >.