TIOPluginHandler< I > Class Template Reference
Plug-in handling

Template for all plug-in handlers that are responsible for data IO. More...

`#include <mia/core/iohandler.hh>`

Inheritance diagram for TIOPluginHandler< I >:
[legend]
Collaboration diagram for TIOPluginHandler< I >:
[legend]

## Public Types

typedef TPluginHandler< I >::const_iterator | const_iterator
| an iterator over the available plug-ins
typedef std::multimap< std::string, std::string > | CSuffixmap
| The map that maps file name suffixes to IO plug-ins.
typedef I::Data | Data
| Data type handled by this plug-in.
typedef TDelayedParameter< PData > | DataKey
| The type of the key used for the CDatapool access.
typedef TPluginHandler< I >::Interface | Interface
| the IO interface provided by this handler
typedef std::shared_ptr< Data > | PData
| Shared pointer to the data hadnled by this plug-in.
Public Types inherited from TPluginHandler< I >
typedef CPluginMap::const_iterator | const_iterator
| the iterator to walk over the available plug-ins
typedef std::map< std::string, PInterface > | CPluginMap
| a map containing the names and the available plug-ins
typedef I | Interface
| typedef for the plug-in interface provided by the class
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
const std::string | get_supported_suffixes () const
| @ returns a string containing the supported file type suffixes
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)
| TPluginHandler ()
| Initializes the plugin handler based on the build-in search path.
TPluginHandler< I >::Interface * | plugin (const char *plugin) const
void | initialise (const CPluginSearchpath &searchpath)

## Detailed Description

template<class I>
class TIOPluginHandler< I >

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.

Template Parameters

  I | the interface class that needs to be derived from TIOPlugin.

Definition at line 44 of file iohandler.hh.

## Member Typedef Documentation

## const_iterator

template<class I>

typedef TPluginHandler<I>::const_iterator TIOPluginHandler< I >::const_iterator

an iterator over the available plug-ins

Definition at line 58 of file iohandler.hh.

## CSuffixmap

template<class I>

typedef std::multimap<std::string, std::string> TIOPluginHandler< I >::CSuffixmap

The map that maps file name suffixes to IO plug-ins.

Definition at line 61 of file iohandler.hh.

## Data

template<class I>

typedef I::Data TIOPluginHandler< I >::Data

Data type handled by this plug-in.

Definition at line 49 of file iohandler.hh.

## DataKey

template<class I>

typedef TDelayedParameter<PData> TIOPluginHandler< I >::DataKey

The type of the key used for the CDatapool access.

Definition at line 64 of file iohandler.hh.

## Interface

template<class I>

typedef TPluginHandler<I>::Interface TIOPluginHandler< I >::Interface

the IO interface provided by this handler

Definition at line 55 of file iohandler.hh.

## PData

template<class I>

typedef std::shared_ptr<Data > TIOPluginHandler< I >::PData

Shared pointer to the data hadnled by this plug-in.

Definition at line 52 of file iohandler.hh.

## Constructor & Destructor Documentation

## TIOPluginHandler()

template<class I>

TIOPluginHandler< I >::TIOPluginHandler | ( |  | ) |

protected

constructor that is provided with a list of plugin search path.

References EXPORT_HANDLER.

## Member Function Documentation

## get_preferred_suffix()

template<class I>

std::string TIOPluginHandler< I >::get_preferred_suffix | ( | const std::string & | type | ) | const

Translate the file type decriptor to the file suffix.

Parameters

  type | type descriptor (plugin name);

Returns
  preferred suffix of the file type

Remarks
  if the type is onkown it will throw and std::invalid_argument exception

## get_supported_filetype_map()

template<class I>

const CSuffixmap & TIOPluginHandler< I >::get_supported_filetype_map | ( |  | ) | const

Returns
  the a mapping of the supported file suffixes to their plugins

## get_supported_suffix_set()

template<class I>

const std::set< std::string > TIOPluginHandler< I >::get_supported_suffix_set | ( |  | ) | const

@ returns a saet containing the supported file type suffixes

## get_supported_suffixes()

template<class I>

const std::string TIOPluginHandler< I >::get_supported_suffixes | ( |  | ) | const

@ returns a string containing the supported file type suffixes

## load()

template<class I>

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.

Parameters

  fname | the file name

Returns
  a shared pointer to the loaded data or an empty shared pointer if no data could be loaded.

Referenced by load_2dtransform(), and load_3dtransform().

## load_to_pool()

template<class I>

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.

Parameters

  fname | the file name throws a std::runtime_error if loading fails

## preferred_plugin()

template<class I>

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.

Parameters

  fname | a file name

Returns
  the plug-in that is preferred for the suffix of fname

## preferred_plugin_ptr()

template<class I>

const Interface * TIOPluginHandler< I >::preferred_plugin_ptr | ( | const std::string & | fname | ) | const

Tolerant search for the plug-in corresponding to the file name suffix

Parameters

  fname | a file name

Returns
  the plug-in that is preferred for the suffix of fname, or NULL if none was found.

## save()

template<class I>

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.

Parameters

  fname | output file name
  data | the data to be saved

Returns
  true if saving is successfull, false otherwise.

Referenced by save_transform(), and save_transform().

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

- iohandler.hh