gatb.core-API-0.0.0
StorageFactory Class Reference

Factory that creates instances related to the storage feature. More...

#include <Storage.hpp>

Inheritance diagram for StorageFactory:
Inheritance graph

Public Member Functions

 StorageFactory (StorageMode_e mode)
 
Storagecreate (const std::string &name, bool deleteIfExist, bool autoRemove, bool dont_add_extension=false, bool append=false)
 
bool exists (const std::string &name)
 
Storageload (const std::string &name)
 
GroupcreateGroup (ICell *parent, const std::string &name)
 
template<typename Type >
Partition< Type > * createPartition (ICell *parent, const std::string &name, size_t nb)
 
template<typename Type >
CollectionNode< Type > * createCollection (ICell *parent, const std::string &name, system::ISynchronizer *synchro)
 
- Public Member Functions inherited from SmartPointer
void use ()
 
void forget ()
 
- Public Member Functions inherited from ISmartPointer
virtual ~ISmartPointer ()
 

Additional Inherited Members

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

Detailed Description

Factory that creates instances related to the storage feature.

This class provides some createXXX methods for instantiations.

It also provides a few general methods like exists and load, so the name 'factory' may be not well choosen...

Example 1:

// We create a Storage product "foo" in HDF5 format
Storage* storage = StorageFactory(STORAGE_HDF5).create ("foo", true, false);

Example 2:

Storage* storage = StorageFactory(STORAGE_HDF5).load ("foo");

Constructor & Destructor Documentation

StorageFactory ( StorageMode_e  mode)
inline

Constructor

Parameters
[in]mode: kind of storage to be used (HDF5 for instance)

Member Function Documentation

Storage* create ( const std::string &  name,
bool  deleteIfExist,
bool  autoRemove,
bool  dont_add_extension = false,
bool  append = false 
)

Create a Storage instance. This function is a bit of a misnomer: it can create a new storage instance and is also used to load an existing one.

Parameters
[in]name: name of the instance to be created
[in]deleteIfExist: if the storage exits in file system, delete it if true.
[in]autoRemove: auto delete the storage from file system during Storage destructor.
Returns
the created Storage instance
CollectionNode<Type>* createCollection ( ICell parent,
const std::string &  name,
system::ISynchronizer synchro 
)

Create a Collection instance and attach it to a cell in a storage.

Parameters
[in]parent: parent of the collection to be created
[in]name: name of the collection to be created
[in]synchro: synchronizer instance if needed
Returns
the created Collection instance.
Group* createGroup ( ICell parent,
const std::string &  name 
)

Create a Group instance and attach it to a cell in a storage.

Parameters
[in]parent: parent of the group to be created
[in]name: name of the group to be created
Returns
the created Group instance.
Partition<Type>* createPartition ( ICell parent,
const std::string &  name,
size_t  nb 
)

Create a Partition instance and attach it to a cell in a storage.

Parameters
[in]parent: parent of the partition to be created
[in]name: name of the partition to be created
[in]nb: number of collections of the partition
Returns
the created Partition instance.
bool exists ( const std::string &  name)

Tells whether or not a Storage exists in file system given a name

Parameters
[in]name: name of the storage to be checked
Returns
true if the storage exists in file system, false otherwise.
Storage* load ( const std::string &  name)
inline

Create a Storage instance from an existing storage in file system.

Parameters
[in]name: name of the file in file system
Returns
the created Storage instance

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