gatb.core-API-0.0.0
BankComposite Class Reference

IBank implementation for composite banks. More...

#include <BankComposite.hpp>

Inheritance diagram for BankComposite:
Inheritance graph

Public Member Functions

 BankComposite ()
 
 BankComposite (const std::vector< IBank * > &banks)
 
virtual ~BankComposite ()
 
std::string getId ()
 
std::string getIdNb (int i)
 
int64_t estimateNbItemsBanki (int i)
 
void addBank (IBank *bank)
 
tools::dp::Iterator< Sequence > * iterator ()
 
int64_t getNbItems ()
 
void insert (const Sequence &item)
 
void flush ()
 
u_int64_t getSize ()
 
void estimate (u_int64_t &number, u_int64_t &totalSize, u_int64_t &maxSize)
 
size_t getCompositionNb ()
 
const std::vector< IBank * > getBanks () const
 
size_t getNbBanks () const
 
template<typename Functor >
void iterateBanks (Functor fct)
 
tools::dp::Iterator< IBank * > * iteratorBanks ()
 
void remove ()
 
- Public Member Functions inherited from AbstractBank
 AbstractBank ()
 
int64_t estimateNbItems ()
 
u_int64_t estimateSequencesSize ()
 
u_int64_t getEstimateThreshold ()
 
void setEstimateThreshold (u_int64_t nbSeq)
 
void finalize ()
 
- Public Member Functions inherited from Iterable< Sequence >
void iterate (Functor f)
 
virtual Sequence * getItems (Sequence *&buffer)
 
virtual size_t getItems (Sequence *&buffer, size_t start, size_t nb)
 
- Public Member Functions inherited from ISmartPointer
virtual ~ISmartPointer ()
 
- Public Member Functions inherited from Bag< Sequence >
virtual void insert (const Sequence &item)=0
 
virtual void insert (const std::vector< Sequence > &items, size_t length=0)
 
virtual void insert (const Sequence *items, size_t length)
 
- Public Member Functions inherited from SmartPointer
void use ()
 
void forget ()
 

Static Public Member Functions

static const char * name ()
 
static const size_t getMaxNbFiles ()
 

Protected Attributes

std::vector< IBank * > _banks
 

Additional Inherited Members

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

Detailed Description

IBank implementation for composite banks.

This class implements the Composite design pattern and allows to handle compound banks the same way as a single one.

This is mainly a base class for other subclasses (see BankAlbum) and is not often instantiated directly.

Most of the methods of IBank are implemented by iterating the list of referred banks.

A BankComposite can be created with a vector of IBank instances to be referred.

Constructor & Destructor Documentation

BankComposite ( )
inline

Default constructor (no referred bank).

BankComposite ( const std::vector< IBank * > &  banks)
inline

Constructor.

Parameters
[in]banks: list of banks to be associated to the album.
virtual ~BankComposite ( )
inlinevirtual

Destructor.

Member Function Documentation

void addBank ( IBank bank)
inline

Add a bank into the composite

Parameters
[in]bank: the bank to be added.
void estimate ( u_int64_t &  number,
u_int64_t &  totalSize,
u_int64_t &  maxSize 
)
inlinevirtual

Give an estimation of sequences information in the bank.

Parameters
[out]number: sequences number
[out]totalSize: sequences size (in bytes)
[out]maxSize: max size size (in bytes)

Implements IBank.

int64_t estimateNbItemsBanki ( int  i)
inlinevirtual

In case of a composite bank,

Returns
estimation of the number of sequences of sub bank i

Reimplemented from AbstractBank.

void flush ( )
inlinevirtual

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

Implements Bag< Sequence >.

const std::vector<IBank*> getBanks ( ) const
inlinevirtual

Return the vector of IBank objects.

Returns
the IBank objects.

Reimplemented from AbstractBank.

size_t getCompositionNb ( )
inlinevirtual

In case of a composite bank, return the number of sub banks.

Returns
number of sub banks.

Reimplemented from AbstractBank.

std::string getId ( )
inlinevirtual

Implements IBank.

std::string getIdNb ( int  i)
inlinevirtual

In case of a composite bank, return the id of bank i

Returns
id of sub bank i

Reimplemented from AbstractBank.

static const size_t getMaxNbFiles ( )
inlinestatic
Returns
maximum number of files.
size_t getNbBanks ( ) const
inline

Get the number of referred banks.

Returns
the number of referred banks
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< Sequence >.

u_int64_t getSize ( )
inlinevirtual

Return the size of the bank (comments + data)

The returned value may be an approximation in some case. For instance, if we use a zipped bank, an implementation may be not able to give accurate answer to the size of the original file.

Returns
the bank size in bytes.

Implements IBank.

void insert ( const Sequence item)
inlinevirtual

Insert an item into the bag.

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

Implements IBank.

void iterateBanks ( Functor  fct)
inline

Direct iteration of the IBank instances.

Parameters
[in]fct: functor that will be called with each referred IBank object.
tools::dp::Iterator<Sequence>* iterator ( )
inlinevirtual

Create an iterator for the given Iterable instance.

Returns
the new iterator.

Implements IBank.

tools::dp::Iterator<IBank*>* iteratorBanks ( )
inline

Returns an iterator on the IBank objects (heap allocation)

Returns
the IBank iterator.
static const char* name ( )
inlinestatic

Returns the name of the bank format.

void remove ( )
inlinevirtual

Reimplemented from AbstractBank.

Member Data Documentation

std::vector<IBank*> _banks
protected

List of the banks.


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