Alida-C++ 0.1
|
Base class for I/O managers in Alida-C++. More...
#include <ALDDataIOManager.h>
Public Member Functions | |
void | printRegistrationTable () |
Convenience function to output the contents of the registration table. | |
virtual ALDDataIO * | registerProvider (std::string type, ALDDataIO *provider) |
Function to register a provider class for a specific data type. | |
Protected Member Functions | |
ALDDataIOManager () | |
Default constructor, hidden to guarantee singleton property. | |
virtual | ~ALDDataIOManager () |
Default destructor. | |
Protected Attributes | |
std::map< std::string, ALDDataIO * > * | registrationTable |
Hash of registered providers. |
Base class for I/O managers in Alida-C++.
This class yields the base class for all I/O managers. I/O managers are supposed to act as some kind of gateway between
generic operator runners for command line or GUI and data type specific I/O providers.
The managers allow to keep all data type specific knowledge solely inside of the corresponding provider classes without preventing generic data I/O.
To allow I/O managers to fulfill their work all data I/O providers are requested to register themselves in the corresponding I/O manager class(es) during initialization.
Each manager holds a hash of available provider class, each associated with a class type identifier string.
The hash is filled during the registration stage adopting the generic macro REGISTER_PROVIDER.
Upon I/O requests the manager can then clone appropriate provider instances from its hash and delegate the I/O request accordingly.
Note that the Alida concepts recommends I/O managers to be implemented as singletons. Thus, constructors and destructors of this class are protected.
Only instances of subclasses should be used for generic operator execution, and these should likewise be addressed as singletons.
For details on this issue and an example refer to the documentation of the class ALDIOManagerCmdline.
Definition at line 86 of file ALDDataIOManager.h.
Alida::ALDDataIOManager::ALDDataIOManager | ( | ) | [inline, protected] |
Default constructor, hidden to guarantee singleton property.
Definition at line 91 of file ALDDataIOManager.h.
virtual Alida::ALDDataIOManager::~ALDDataIOManager | ( | ) | [inline, protected, virtual] |
Default destructor.
Definition at line 94 of file ALDDataIOManager.h.
void Alida::ALDDataIOManager::printRegistrationTable | ( | ) |
Convenience function to output the contents of the registration table.
This function prints all registered providers to standard out.
Definition at line 82 of file ALDDataIOManager.cc.
Function to register a provider class for a specific data type.
By calling this function (addressed by the generic macro REGISTER_PROVIDER) data I/O providers can register themselves for specific data types. The function fills the registration map of an I/O manager, storing the data type identifier string and an associated prototype provider instance.
To ease the registration process and allow for dynamic registration during program initialization and prior to the call of the main()-function of a program dynamic initialization of static variables in C++ is used here. Therefore the method returns a pointer to the prototype instance which can be assigned to a global variable ensuring dynamic registration of the provider. The assignment to static variables is transiently handled by the REGISTER_PROVIDER macro, hence, no additional work remains for the programmer.
type | Identifier string for the registered data type. |
p | Prototype provider class instance. |
Definition at line 69 of file ALDDataIOManager.cc.
std::map<std::string, ALDDataIO*>* Alida::ALDDataIOManager::registrationTable [protected] |
Hash of registered providers.
Definition at line 94 of file ALDDataIOManager.h.