gatb.core-API-1.4.2
IterableAdaptor< T1, T2, Adaptor > Class Template Reference

Adaptor of an Iterable<T1> into an Iterable<T2> More...

#include <IterableHelpers.hpp>

Inheritance diagram for IterableAdaptor< T1, T2, Adaptor >:
Inheritance graph

Public Member Functions

dp::Iterator< T2 > * iterator ()
 
int64_t getNbItems ()
 
int64_t estimateNbItems ()
 
T2 * getItems (T2 *&buffer)
 
size_t getItems (T2 *&buffer, size_t start, size_t nb)
 
- Public Member Functions inherited from Iterable< T2 >
void iterate (Functor f)
 
- Public Member Functions inherited from ISmartPointer
virtual ~ISmartPointer ()
 
- Public Member Functions inherited from SmartPointer
void use ()
 
void forget ()
 

Additional Inherited Members

- Protected Member Functions inherited from SmartPointer
 SmartPointer ()
 
virtual ~SmartPointer ()
 

Detailed Description

template<class T1, class T2, class Adaptor>
class gatb::core::tools::collections::impl::IterableAdaptor< T1, T2, Adaptor >

Adaptor of an Iterable<T1> into an Iterable<T2>

This class converts the type T1 of an iterable into another iterable of type T2.

A functor must be provided in order to convert one item of T1 into T2.

Member Function Documentation

int64_t estimateNbItems ( )
inlinevirtual

Return the (approximate) number of items. If a specific implementation doesn't know the value, it should return -1 by convention.

Returns
the number of items if known, -1 otherwise.

Implements Iterable< T2 >.

T2* getItems ( T2 *&  buffer)
inlinevirtual

Return a buffer of items.

Parameters
[out]buffer: the buffer
Returns
the buffer

Reimplemented from Iterable< T2 >.

size_t getItems ( T2 *&  buffer,
size_t  start,
size_t  nb 
)
inlinevirtual

Return a buffer of items.

Parameters
[out]buffer: the buffer
[in]start: index where to start in the buffer
[in]nb: number of items to be retrieved
Returns
the number of items retrieved

Reimplemented from Iterable< T2 >.

int64_t getNbItems ( )
inlinevirtual

Return the number of items. If a specific implementation doesn't know the value, it should return -1 by convention.

Returns
the number of items if known, -1 otherwise.

Implements Iterable< T2 >.

dp::Iterator<T2>* iterator ( )
inlinevirtual

Create an iterator for the given Iterable instance.

Returns
the new iterator.

Implements Iterable< T2 >.


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