Template for all plug-in handlers that are responsible for data IO. More...
#include <mia/core/iohandler.hh>
Public Types | |
typedef TPluginHandler< I >::const_iterator | const_iterator |
an iterator over the available plug-ins More... | |
typedef std::multimap< std::string, std::string > | CSuffixmap |
The map that maps file name suffixes to IO plug-ins. More... | |
typedef I::Data | Data |
Data type handled by this plug-in. More... | |
typedef TDelayedParameter< PData > | DataKey |
The type of the key used for the CDatapool access. More... | |
typedef TPluginHandler< I >::Interface | Interface |
the IO interface provided by this handler More... | |
typedef std::shared_ptr< Data > | PData |
Shared pointer to the data hadnled by this plug-in. More... | |
Public Types inherited from TPluginHandler< I > | |
typedef CPluginMap::const_iterator | const_iterator |
the iterator to walk over the available plug-ins More... | |
typedef std::map< std::string, PInterface > | CPluginMap |
a map containing the names and the available plug-ins More... | |
typedef I | Interface |
typedef for the plug-in interface provided by the class More... | |
typedef std::shared_ptr< I > | PInterface |
Public Member Functions | |
std::string | get_preferred_suffix (const std::string &type) const |
const CSuffixmap & | get_supported_filetype_map () const |
const std::set< std::string > | get_supported_suffix_set () const |
@ returns a saet containing the supported file type suffixes More... | |
const std::string | get_supported_suffixes () const |
@ returns a string containing the supported file type suffixes More... | |
PData | load (const std::string &fname) const |
DataKey | load_to_pool (const std::string &fname) const |
const Interface & | preferred_plugin (const std::string &fname) const |
const Interface * | preferred_plugin_ptr (const std::string &fname) const |
bool | save (const std::string &fname, const Data &data) const |
Public Member Functions inherited from TPluginHandler< I > | |
bool | add_plugin (PInterface plugin) |
const_iterator | begin () const |
const_iterator | end () const |
const std::string | get_plugin_names () const |
const std::set< std::string > | get_set () const |
size_t | size () const |
virtual | ~TPluginHandler () |
Public Member Functions inherited from CPluginHandlerBase | |
void | add_dependend_handlers (HandlerHelpMap &handler_map) const |
CPluginHandlerBase (const char *data_descr, const char *type_descr) | |
CPluginHandlerBase (const CPluginHandlerBase &other)=delete | |
const std::string & | get_descriptor () const |
std::string | get_handler_type_string () const |
void | get_string_help_description_xml (std::ostream &os, CXMLElement &root) const |
void | get_xml_help (CXMLElement &root) const |
CPluginHandlerBase & | operator= (const CPluginHandlerBase &other)=delete |
void | print_help (std::ostream &os) const |
void | print_short_help (std::ostream &os) const |
bool | validate_parameter_string (const std::string &s) const |
virtual | ~CPluginHandlerBase () |
Protected Member Functions | |
TIOPluginHandler () | |
Protected Member Functions inherited from TPluginHandler< I > | |
void | add_plugin_internal (PInterface plugin) |
void | initialise (const CPluginSearchpath &searchpath) |
TPluginHandler< I >::Interface * | plugin (const char *plugin) const |
TPluginHandler () | |
Initializes the plugin handler based on the build-in search path. More... | |
Template for all plug-in handlers that are responsible for data IO.
Input/Output plugin handler base class, derived privately from the standart plug-in handler to hide its interface. All IO plug-in handlers all proved a CDatapool as temporal storage to pass data around without disk-io.
I | the interface class that needs to be derived from TIOPlugin. |
Definition at line 44 of file iohandler.hh.
typedef TPluginHandler<I>::const_iterator TIOPluginHandler< I >::const_iterator |
an iterator over the available plug-ins
Definition at line 57 of file iohandler.hh.
typedef std::multimap<std::string, std::string> TIOPluginHandler< I >::CSuffixmap |
The map that maps file name suffixes to IO plug-ins.
Definition at line 60 of file iohandler.hh.
typedef I::Data TIOPluginHandler< I >::Data |
Data type handled by this plug-in.
Definition at line 48 of file iohandler.hh.
typedef TDelayedParameter<PData> TIOPluginHandler< I >::DataKey |
The type of the key used for the CDatapool access.
Definition at line 63 of file iohandler.hh.
typedef TPluginHandler<I>::Interface TIOPluginHandler< I >::Interface |
the IO interface provided by this handler
Definition at line 54 of file iohandler.hh.
typedef std::shared_ptr<Data > TIOPluginHandler< I >::PData |
Shared pointer to the data hadnled by this plug-in.
Definition at line 51 of file iohandler.hh.
|
protected |
constructor that is provided with a list of plugin search path.
std::string TIOPluginHandler< I >::get_preferred_suffix | ( | const std::string & | type | ) | const |
Translate the file type decriptor to the file suffix.
type | type descriptor (plugin name); |
const CSuffixmap& TIOPluginHandler< I >::get_supported_filetype_map | ( | ) | const |
const std::set<std::string> TIOPluginHandler< I >::get_supported_suffix_set | ( | ) | const |
@ returns a saet containing the supported file type suffixes
const std::string TIOPluginHandler< I >::get_supported_suffixes | ( | ) | const |
@ returns a string containing the supported file type suffixes
PData TIOPluginHandler< I >::load | ( | const std::string & | fname | ) | const |
Load data from a file. The suffix of fname is used to derive a preffered plug-in, which is then tried first. If this fails, all other plug-ins are tried as well.
fname | the file name |
DataKey TIOPluginHandler< I >::load_to_pool | ( | const std::string & | fname | ) | const |
Load data from a file into the data pool, the key is the filename. The suffix of fname is used to derive a preffered plug-in, which is then tried first. If this fails, all other plug-ins are tried as well.
fname | the file name throws a std::runtime_error if loading fails |
const Interface& TIOPluginHandler< I >::preferred_plugin | ( | const std::string & | fname | ) | const |
Search for the plug-in corresponding to the file name suffix, if the search fails, an std::invalid_argument exception is thrown.
fname | a file name |
const Interface* TIOPluginHandler< I >::preferred_plugin_ptr | ( | const std::string & | fname | ) | const |
Tolerant search for the plug-in corresponding to the file name suffix
fname | a file name |
bool TIOPluginHandler< I >::save | ( | const std::string & | fname, |
const Data & | data | ||
) | const |
Save the data to a file. If type is empty, then the output plugin is derived from the fname suffix. if this fails, saving fails. If type is provided, the output plugin is selected accordingly.
fname | output file name |
data | the data to be saved |