Chemical Data Processing Library C++ API - Version 1.2.0
|
A singleton class that serves as a global registry for Base::DataInputHandler and Base::DataOutputHandler implementation instances. More...
#include <DataIOManager.hpp>
Public Types | |
typedef DataInputHandler< T > | InputHandlerType |
typedef DataOutputHandler< T > | OutputHandlerType |
typedef InputHandlerType::SharedPointer | InputHandlerPointer |
typedef OutputHandlerType::SharedPointer | OutputHandlerPointer |
typedef InputHandlerList::iterator | InputHandlerIterator |
An iterator used to iterate over the list of registered input handlers. More... | |
typedef OutputHandlerList::iterator | OutputHandlerIterator |
An iterator used to iterate over the list of registered output handlers. More... | |
Static Public Member Functions | |
static void | registerInputHandler (const InputHandlerPointer &handler) |
Registers the specified Base::DataInputHandler implementation instance. More... | |
static void | registerOutputHandler (const OutputHandlerPointer &handler) |
Registers the specified Base::DataOutputHandler implementation instance. More... | |
static bool | unregisterInputHandler (const DataFormat &fmt) |
Unregisters the Base::DataInputHandler implementation instance for the specified data format. More... | |
static bool | unregisterOutputHandler (const DataFormat &fmt) |
Unregisters the Base::DataOutputHandler implementation instance for the specified data format. More... | |
static bool | unregisterInputHandler (const InputHandlerPointer &handler) |
Unregisters the specified Base::DataInputHandler implementation instance. More... | |
static bool | unregisterOutputHandler (const OutputHandlerPointer &handler) |
Unregisters the specified Base::DataOutputHandler implementation instance. More... | |
static void | unregisterInputHandler (std::size_t idx) |
Unregisters the Base::DataInputHandler implementation instance with the specified index. More... | |
static void | unregisterOutputHandler (std::size_t idx) |
Unregisters the Base::DataOutputHandler implementation instance with the specified index. More... | |
static InputHandlerIterator | unregisterInputHandler (const InputHandlerIterator &it) |
Unregisters the Base::DataInputHandler implementation instance pointed to by the iterator it. More... | |
static OutputHandlerIterator | unregisterOutputHandler (const OutputHandlerIterator &it) |
Unregisters the Base::DataOutputHandler implementation instance implementation instance pointed to by the iterator it. More... | |
static std::size_t | getNumInputHandlers () |
Returns the number of registered Base::DataInputHandler implementation instances. More... | |
static std::size_t | getNumOutputHandlers () |
Returns the number of registered Base::DataOutputHandler implementation instances. More... | |
static const InputHandlerPointer & | getInputHandler (std::size_t idx) |
Returns a reference to the registered Base::DataInputHandler implementation instance with the specified index. More... | |
static const OutputHandlerPointer & | getOutputHandler (std::size_t idx) |
Returns a reference to the registered Base::DataOutputHandler implementation instance with the specified index. More... | |
static InputHandlerIterator | getInputHandlersBegin () |
Returns an iterator pointing to the beginning of the list of registered Base::DataInputHandler implementation instances. More... | |
static InputHandlerIterator | getInputHandlersEnd () |
Returns an iterator pointing to the end of the list of registered Base::DataInputHandler implementation instances. More... | |
static OutputHandlerIterator | getOutputHandlersBegin () |
Returns an iterator pointing to the beginning of the list of registered Base::DataOutputHandler implementation instances. More... | |
static OutputHandlerIterator | getOutputHandlersEnd () |
Returns an iterator pointing to the end of the list of registered Base::DataOutputHandler implementation instances. More... | |
static InputHandlerPointer | getInputHandlerByFormat (const DataFormat &fmt) |
Returns a pointer to a Base::DataInputHandler implementation instance registered for the specified data format. More... | |
static InputHandlerPointer | getInputHandlerByName (const std::string &name) |
Returns a pointer to a Base::DataInputHandler implementation instance registered for the data format with the specified name. More... | |
static InputHandlerPointer | getInputHandlerByFileExtension (const std::string &file_ext) |
Returns a pointer to a Base::DataInputHandler implementation instance registered for the data format with the specified file extension. More... | |
static InputHandlerPointer | getInputHandlerByFileName (const std::string &file_name) |
Returns a pointer to a Base::DataInputHandler implementation instance registered for the data format matching the extension of file_name. More... | |
static InputHandlerPointer | getInputHandlerByMimeType (const std::string &mime_type) |
Returns a pointer to a Base::DataInputHandler implementation instance registered for the data format with the specified mime-type. More... | |
static OutputHandlerPointer | getOutputHandlerByFormat (const DataFormat &fmt) |
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the specified data format. More... | |
static OutputHandlerPointer | getOutputHandlerByName (const std::string &name) |
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the data format with the specified name. More... | |
static OutputHandlerPointer | getOutputHandlerByFileExtension (const std::string &file_ext) |
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the data format with the specified file extension. More... | |
static OutputHandlerPointer | getOutputHandlerByFileName (const std::string &file_name) |
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the data format matching the extension of file_name. More... | |
static OutputHandlerPointer | getOutputHandlerByMimeType (const std::string &mime_type) |
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the data format with the specified mime-type. More... | |
A singleton class that serves as a global registry for Base::DataInputHandler and Base::DataOutputHandler implementation instances.
DataIOManager
provides static methods for the registration and lookup of Base::DataInputHandler and Base::DataOutputHandler implementation instances that handle different input and output storage formats for a specific object type (specified by the template parameter T).
Input and output handlers are registered by the methods registerInputHandler() and registerOutputHandler(). These methods expect a reference to an instance of the respective handler implementation as an argument (please note that the registered instance must not be destroyed as long as it is accessible via the DataIOManager
interface!).
For the removal of registered handlers the unregisterInputHandler() and unregisterOutputHandler() family of overloaded methods is provided. These methods accept a reference to the registered handler instance, the handler index, the handled data format or an iterator pointing to the handler as an argument.
Registered input handlers can be queried by the methods getInputHandlerByFormat(), getInputHandlerByName(), getInputHandlerByFileExtension() and getInputHandlerByMimeType(), which allow to find a suitable handler for a given data format, data format name, file extension or mime-type. For the registered output handlers similar methods are provided.
I/O handlers for data formats and object types supported by the CDPL are registered in the static library initialization code. These built-in handlers are accessible by the linking client code as soon as the library initialization has finished.
T | The type of the data objects for which the registered input and output handlers are parameterized. |
typedef DataInputHandler<T> CDPL::Base::DataIOManager< T >::InputHandlerType |
typedef DataOutputHandler<T> CDPL::Base::DataIOManager< T >::OutputHandlerType |
typedef InputHandlerType::SharedPointer CDPL::Base::DataIOManager< T >::InputHandlerPointer |
typedef OutputHandlerType::SharedPointer CDPL::Base::DataIOManager< T >::OutputHandlerPointer |
typedef InputHandlerList::iterator CDPL::Base::DataIOManager< T >::InputHandlerIterator |
An iterator used to iterate over the list of registered input handlers.
typedef OutputHandlerList::iterator CDPL::Base::DataIOManager< T >::OutputHandlerIterator |
An iterator used to iterate over the list of registered output handlers.
|
static |
Registers the specified Base::DataInputHandler implementation instance.
handler | The Base::DataInputHandler implementation instance to register. |
|
static |
Registers the specified Base::DataOutputHandler implementation instance.
handler | The Base::DataOutputHandler implementation instance to register. |
|
static |
Unregisters the Base::DataInputHandler implementation instance for the specified data format.
Only one handler instance at a time will be unregistered (in a first in - first out manner). If more than one handler instance has been registered for the given data format, the method has to be called multiple times to unregister all instances.
fmt | Specifies the data format that is associated with the handler instance to unregister. |
true
if a handler instance for the specified data format was found and has been unregistered, and false
otherwise.
|
static |
Unregisters the Base::DataOutputHandler implementation instance for the specified data format.
Only one handler instance at a time will be unregistered (in a first in - first out manner). If more than one handler instance has been registered for the given data format, the method has to be called multiple times to unregister all instances.
fmt | Specifies the data format that is associated with the handler instance to unregister. |
true
if a handler instance for the specified data format was found and has been unregistered, and false
otherwise.
|
static |
Unregisters the specified Base::DataInputHandler implementation instance.
handler | The Base::DataInputHandler implementation instance to unregister. |
true
if the handler instance was found and has been unregistered, and false
otherwise.
|
static |
Unregisters the specified Base::DataOutputHandler implementation instance.
handler | The Base::DataOutputHandler implementation instance to unregister. |
true
if the handler instance was found and has been unregistered, and false
otherwise.
|
static |
Unregisters the Base::DataInputHandler implementation instance with the specified index.
idx | The zero-based index of the Base::DataInputHandler implementation instance to unregister. |
Base::IndexError | if idx is out of bounds. |
|
static |
Unregisters the Base::DataOutputHandler implementation instance with the specified index.
idx | The zero-based index of the Base::DataOutputHandler implementation instance to unregister. |
Base::IndexError | if idx is out of bounds. |
|
static |
Unregisters the Base::DataInputHandler implementation instance pointed to by the iterator it.
it | An iterator pointing to the Base::DataInputHandler implementation instance to unregister. |
Base::RangeError | if it is not in the range [getInputHandlersBegin(), getInputHandlersEnd() - 1]. |
|
static |
Unregisters the Base::DataOutputHandler implementation instance implementation instance pointed to by the iterator it.
it | An iterator pointing to the Base::DataOutputHandler implementation instance to unregister. |
Base::RangeError | if it is not in the range [getOutputHandlersBegin(), getOutputHandlersEnd() - 1]. |
|
static |
Returns the number of registered Base::DataInputHandler implementation instances.
|
static |
Returns the number of registered Base::DataOutputHandler implementation instances.
|
static |
Returns a reference to the registered Base::DataInputHandler implementation instance with the specified index.
idx | The zero-based index of the Base::DataInputHandler implementation instance to return. |
Base::IndexError | if idx is out of bounds. |
|
static |
Returns a reference to the registered Base::DataOutputHandler implementation instance with the specified index.
idx | The zero-based index of the Base::DataOutputHandler implementation instance to return. |
Base::IndexError | if idx is out of bounds. |
|
static |
Returns an iterator pointing to the beginning of the list of registered Base::DataInputHandler implementation instances.
|
static |
Returns an iterator pointing to the end of the list of registered Base::DataInputHandler implementation instances.
|
static |
Returns an iterator pointing to the beginning of the list of registered Base::DataOutputHandler implementation instances.
|
static |
Returns an iterator pointing to the end of the list of registered Base::DataOutputHandler implementation instances.
|
static |
Returns a pointer to a Base::DataInputHandler implementation instance registered for the specified data format.
fmt | Specifies the data format that is associated with the requested Base::DataInputHandler implementation instance. |
|
static |
Returns a pointer to a Base::DataInputHandler implementation instance registered for the data format with the specified name.
name | Specifies the name of the data format that is associated with the requested Base::DataInputHandler implementation instance. |
|
static |
Returns a pointer to a Base::DataInputHandler implementation instance registered for the data format with the specified file extension.
file_ext | Specifies the file extension of the data format that is associated with the requested Base::DataInputHandler implementation instance. |
|
static |
Returns a pointer to a Base::DataInputHandler implementation instance registered for the data format matching the extension of file_name.
file_name | Specifies the file name for which to search for a data format that matches its extension. |
|
static |
Returns a pointer to a Base::DataInputHandler implementation instance registered for the data format with the specified mime-type.
mime_type | Specifies the mime-type of the data format that is associated with the requested Base::DataInputHandler implementation instance. |
|
static |
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the specified data format.
fmt | Specifies the data format that is associated with the requested Base::DataOutputHandler implementation instance. |
|
static |
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the data format with the specified name.
name | Specifies the name of the data format that is associated with the requested Base::DataOutputHandler implementation instance. |
|
static |
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the data format with the specified file extension.
file_ext | Specifies the file extension of the data format that is associated with the requested Base::DataOutputHandler implementation instance. |
|
static |
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the data format matching the extension of file_name.
file_name | Specifies the file name for which to search for a data format that matches its extension. |
|
static |
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the data format with the specified mime-type.
mime_type | Specifies the mime-type of the data format that is associated with the requested Base::DataOutputHandler implementation instance. |