21 #ifndef CONVERSIONITERATOR_H
22 #define CONVERSIONITERATOR_H
23 #include <tulip/Iterator.h>
24 #include <tulip/memorypool.h>
43 template <
typename TYPEIN,
typename TYPEOUT,
typename CONVERSIONFUNCTOR>
44 class ConversionIterator :
public Iterator<TYPEOUT> {
46 ConversionIterator(Iterator<TYPEIN> *it, CONVERSIONFUNCTOR convFunctor):_it(it), _convFunctor(convFunctor) {
48 ~ConversionIterator() {
51 inline bool hasNext() {
52 return _it->hasNext();
54 inline TYPEOUT next() {
55 return _convFunctor(_it->next());
58 tlp::Iterator<TYPEIN> *_it;
59 CONVERSIONFUNCTOR _convFunctor;
68 template <
typename TYPEIN,
typename TYPEOUT,
typename CONVERSIONFUNCTOR>
69 class MPConversionIterator :
public ConversionIterator<TYPEIN, TYPEOUT, CONVERSIONFUNCTOR>,
public MemoryPool<MPConversionIterator<TYPEIN, TYPEOUT, CONVERSIONFUNCTOR> > {
71 MPConversionIterator(Iterator<TYPEIN> *it, CONVERSIONFUNCTOR convFunctor):
72 ConversionIterator<TYPEIN, TYPEOUT, CONVERSIONFUNCTOR>(it, convFunctor) {
77 #endif // CONVERSIONITERATOR_H