gatb.core-API-0.0.0
IterableFile< Item > Class Template Reference

Implementation of the Iterable interface as a file. More...

#include <IteratorFile.hpp>

Inheritance diagram for IterableFile< Item >:
Inheritance graph

Public Member Functions

 IterableFile (const std::string &filename, size_t cacheItemsNb=10000)
 
 ~IterableFile ()
 
dp::Iterator< Item > * iterator ()
 
int64_t getNbItems ()
 
int64_t estimateNbItems ()
 
Item * getItems (Item *&buffer)
 
size_t getItems (Item *&buffer, size_t start, size_t nb)
 
- Public Member Functions inherited from Iterable< Item >
template<typename Functor >
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 Item>
class gatb::core::tools::collections::impl::IterableFile< Item >

Implementation of the Iterable interface as a file.

This implementation uses a file as the source of the items that can be iterated.

Constructor & Destructor Documentation

IterableFile ( const std::string &  filename,
size_t  cacheItemsNb = 10000 
)
inline

Constructor

Parameters
[in]filename: name of the file to be iterated.
[in]cacheItemsNb: number of items in the cache memory
~IterableFile ( )
inline

Destructor.

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< Item >.

Item* getItems ( Item *&  buffer)
inlinevirtual

Return a buffer of items.

Parameters
[out]buffer: the buffer
Returns
the buffer

Reimplemented from Iterable< Item >.

size_t getItems ( Item *&  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< Item >.

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< Item >.

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

Create an iterator for the given Iterable instance.

Returns
the new iterator.

Implements Iterable< Item >.


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