Abstract implementation of the Collection interface.
More...
#include <CollectionAbstract.hpp>
template<class Item>
class gatb::core::tools::collections::impl::CollectionAbstract< Item >
Abstract implementation of the Collection interface.
This class implements the Collection interface by delegating the job to an instance of Bag and an instance of Iterable.
All the methods are delegated to one of these two instances.
Constructor.
- Parameters
-
bag | : reference on the bag delegate. |
iterable | : reference on the iterable delegate |
void addProperty |
( |
const std::string & |
key, |
|
|
const std::string |
value |
|
) |
| |
|
inlinevirtual |
void addProperty |
( |
const std::string & |
key, |
|
|
const char * |
format... |
|
) |
| |
|
inline |
Add a property to the collection.
- Parameters
-
[in] | key | : key of the property |
[in] | value | : value of the property. |
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 >.
Flush the current content. May be useful for implementation that uses a cache.
Implements Bag< Item >.
Item* getItems |
( |
Item *& |
buffer | ) |
|
|
inlinevirtual |
Return a buffer of items.
- Parameters
-
- 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 >.
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 >.
std::string getProperty |
( |
const std::string & |
key | ) |
|
|
inlinevirtual |
void insert |
( |
const Item & |
item | ) |
|
|
inlinevirtual |
Insert an item into the bag.
- Parameters
-
[in] | item | : the item to be inserted. |
Implements Bag< Item >.
void insert |
( |
const std::vector< Item > & |
items, |
|
|
size_t |
length |
|
) |
| |
|
inlinevirtual |
Insert items into the bag.
- Parameters
-
[in] | items | : items to be inserted. |
[in] | length | : the number of items to be inserted. If 0 (default value), all the items of the vector are inserted. |
Reimplemented from Bag< Item >.
void insert |
( |
const Item * |
items, |
|
|
size_t |
length |
|
) |
| |
|
inlinevirtual |
Insert items into the bag.
- Parameters
-
[in] | items | : items to be inserted. |
[in] | length | : number of items to be inserted. |
Reimplemented from Bag< Item >.
The documentation for this class was generated from the following file: