gatb.core-API-1.4.2
ProgressIterator< Type, Listener > Class Template Reference

Iterator with progress information. More...

#include <IterableHelpers.hpp>

Inheritance diagram for ProgressIterator< Type, Listener >:
Inheritance graph

Public Member Functions

 ProgressIterator (Iterable< Type > &iterable, const char *msg="progress", size_t divide=100)
 
 ProgressIterator (tools::dp::Iterator< Type > *iterator, const char *msg, size_t nbItems)
 
- Public Member Functions inherited from SubjectIterator< Type >
 SubjectIterator (Iterator< Type > *ref, u_int32_t modulo, IteratorListener *listener=0)
 
 ~SubjectIterator ()
 
- Public Member Functions inherited from Iterator< Type >
Type * operator-> ()
 
Type & operator* ()
 
void iterate (const Functor &f)
 
bool get (std::vector< Type > &current)
 
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 ()
 

Detailed Description

template<class Type, class Listener = tools::misc::impl::ProgressDefault>
class gatb::core::tools::collections::impl::ProgressIterator< Type, Listener >

Iterator with progress information.

This Iterator implementation encapsulates a given iterator and shows progress information to end users.

The way the progress information is displayed is set through the second template argument of the class which is some IteratorListener implementation class. There is a default argument for this template, so one has often have only to give the first template type (ie the kind of items to be iterated).

This is an example of the Decorator design pattern.

Constructor & Destructor Documentation

ProgressIterator ( Iterable< Type > &  iterable,
const char *  msg = "progress",
size_t  divide = 100 
)
inline

Constructor. It uses the provided Iterable object to build the delegate Iterator instance.

Parameters
[in]iterable: used to create the delegate iterator
[in]msg: message displayed at each progression notification
[in]divide: number of notifications to be send
ProgressIterator ( tools::dp::Iterator< Type > *  iterator,
const char *  msg,
size_t  nbItems 
)
inline

Constructor. It uses the provided Iterator object as the delegate iterator

Parameters
[in]iterator: delegate iterator
[in]msg: message displayed at each progression notification
[in]nbItems: number of items to be iterated

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