gatb.core-API-0.0.0
|
Front end for managing IBank objects. More...
#include <Bank.hpp>
Static Public Member Functions | |
static IBank * | open (const std::string &uri) |
static size_t | getCompositionNb (const std::string &uri) |
static std::string | getType (const std::string &uri) |
static void | registerFactory (const std::string &name, IBankFactory *instance, bool beginning) |
static bool | unregisterFactory (const std::string &name) |
static IBankFactory * | getFactory (const std::string &name) |
Front end for managing IBank objects.
The Bank class can be used as a front end for banks management in GATB.
Actually, its main purpose is to provide IBank instances from a given URI (likely to be a FASTA file for instance).
By using this class, clients can open genomic banks without knowing their actual type: they only rely on the IBank interface. This means that developing tools this way make them independent of the format of the input bank (at least for the supported input format by GATB).
Today, the following factories are registered: 1) BankAlbumFactory 2) BankFastaFactory 3) BankBinaryFactory
During a call to 'open', each factory is tried (in the order of registration) until a correct IBank object is returned; if no valid IBank is found, an exception is thrown.
Example of use:
NOTE : In case of a brand new bank creation, there is no corresponding method to 'open' because one has to know exactly the format of the bank (it is not possible in general to deduce the format only by analyzing the URI string and not the content).
This class is a Singleton (private constructor) and its static public members are accessed to this singleton.
For developers adding new implementations of the IBank interface, they should register a IBankFactory instance for their new class. Doing so make their new bank format available through the Bank::open method.
|
inlinestatic |
In case of a composite bank, return the number of sub banks.
|
inlinestatic |
Get a factory for a given name.
|
inlinestatic |
Get the type of the bank as a string
[in] | uri | : uri of the bank. |
|
inlinestatic |
|
inlinestatic |
Register a new factory, associated with a name. Note that the position of the registered factory in the list of factories may be important; for instance, if we want to add a custom fasta file factory, we should add it at the beginning in order to be sure that our custom data format will be used by default.
[in] | name | : name of the factory |
[in] | instance | : IBank factory |
[in] | beginning | : if true add the factory in the first position of the factories list, if false in the last position. |
|
inlinestatic |
Unregister a factory given its name.
[in] | name | : name of the factory to be unregistered. |