gatb.core-API-1.4.2
BagCache< Item > Class Template Reference

Bag implementation as a cache to a referred Bag instance. More...

#include <BagCache.hpp>

Inheritance diagram for BagCache< Item >:
Inheritance graph

Public Member Functions

 BagCache ()
 
 BagCache (Bag< Item > *ref, size_t cacheSize, system::ISynchronizer *synchro=0)
 
virtual ~BagCache ()
 
void insert (const Item &item)
 
void flush ()
 
- Public Member Functions inherited from Bag< Item >
virtual void insert (const std::vector< Item > &items, size_t length=0)
 
virtual void insert (const Item *items, size_t length)
 
- 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<typename Item>
class gatb::core::tools::collections::impl::BagCache< Item >

Bag implementation as a cache to a referred Bag instance.

This implementation is a proxy to a Bag instance. One can insert items into such a bag, it will just put them into a cache. When the cache is full, all the cached items are inserted into the delegate; this operation may be protected by a synchronizer in case several threads use different BagCache on the same delegate.

Constructor & Destructor Documentation

BagCache ( )
inline

Constructor

BagCache ( Bag< Item > *  ref,
size_t  cacheSize,
system::ISynchronizer synchro = 0 
)
inline

Constructor. Cache size is in terms of number of items (I think)

virtual ~BagCache ( )
inlinevirtual

Destructor.

Member Function Documentation

void flush ( )
inlinevirtual

Flush the current content. May be useful for implementation that uses a cache.

Implements Bag< Item >.

Reimplemented in BagCacheSorted< Item >, and BagCacheSortedBuffered< Item >.

void insert ( const Item &  item)
inlinevirtual

Insert an item into the bag.

Parameters
[in]item: the item to be inserted.

Implements Bag< Item >.

Reimplemented in BagCacheSorted< Item >, and BagCacheSortedBuffered< Item >.


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