TIOPlugin< D > Class Template Referenceabstract

The templatex basis class of all IO plug-ins. More...

#include <mia/core/ioplugin.hh>

Inheritance diagram for TIOPlugin< D >:
[legend]
Collaboration diagram for TIOPlugin< D >:
[legend]

Public Types

typedef D::type Data
 type of the data handled by this plug-in More...
 
typedef std::shared_ptr< DataPData
 shared pointer of the data handled by this plug-in More...
 
typedef std::set< EPixelTypePixelTypeSet
 the type for the supported pixel types of this IO handler More...
 
typedef std::set< std::string > SuffixSet
 
- Public Types inherited from TPlugin< D, io_plugin_type >
typedef D PlugData
 Typedef for the data type descriptor handled by this plug-in. More...
 
typedef io_plugin_type PlugType
 Typedef for the plugin type descriptor handled by this plug-in. More...
 

Public Member Functions

void add_suffixes (std::multimap< std::string, std::string > &map) const
 
const std::string get_preferred_suffix () const
 
PData load (const std::string &fname) const
 
bool save (const std::string &fname, const Data &data) const
 
const PixelTypeSetsupported_pixel_types () const
 
 TIOPlugin (const char *name)
 
- Public Member Functions inherited from TPlugin< D, io_plugin_type >
virtual void get_help (std::ostream &os) const
 
const std::string get_long_name () const
 
 TPlugin (const char *name)
 
- Public Member Functions inherited from CPluginBase
void add_dependend_handlers (HandlerHelpMap &handler_map)
 
void add_property (const char *property)
 
void append_interface (CPluginBase *plugin)
 
 CPluginBase (const char *name)
 
PPluginModule get_module () const
 
unsigned get_priority () const
 
bool has_property (const char *property) const
 
CPluginBasenext_interface ()
 
void set_module (const PPluginModule &module)
 
void set_priority (unsigned p)
 
virtual ~CPluginBase ()
 
- Public Member Functions inherited from CParamTranslator
void add_parameter (const std::string &name, CParameter *param)
 
void check_parameters ()
 
 CParamTranslator (const char *name)
 
const std::string get_descr () const
 
void get_help (std::ostream &os) const
 
void get_help_xml (CXMLElement &root) const
 
const char * get_name () const
 
void get_short_help (std::ostream &os) const
 
void set_parameters (const CParsedOptions &options)
 
virtual ~CParamTranslator ()
 

Protected Member Functions

void add_suffix (const std::string &suffix)
 
void add_supported_type (EPixelType t)
 add pixel type t to the list of supported types More...
 
const SuffixSetget_suffixes () const
 
- Protected Member Functions inherited from CParamTranslator
CParamListget_parameters ()
 

Additional Inherited Members

- Static Public Member Functions inherited from TPlugin< D, io_plugin_type >
static const char * get_data_path_part ()
 
static const char * get_type_path_part ()
 

Detailed Description

template<typename D>
class TIOPlugin< D >

The templatex basis class of all IO plug-ins.

The basis of all IO plug-ins. The type D must provied a typedef type the referes to the data type to be handled and it must provied a string value that describes the type of the io data and also corresponds to the last part of the directory name, where the plug-in will be located after installation of the package. The type D must be derived from CIOData, to supply functions to store and acquire the file format used to load the data.

Template Parameters
Dthe data type for witch the IO is implemented

Definition at line 57 of file ioplugin.hh.

Member Typedef Documentation

◆ Data

template<typename D>
typedef D::type TIOPlugin< D >::Data

type of the data handled by this plug-in

Definition at line 61 of file ioplugin.hh.

◆ PData

template<typename D>
typedef std::shared_ptr<Data > TIOPlugin< D >::PData

shared pointer of the data handled by this plug-in

Definition at line 64 of file ioplugin.hh.

◆ PixelTypeSet

template<typename D>
typedef std::set<EPixelType> TIOPlugin< D >::PixelTypeSet

the type for the supported pixel types of this IO handler

Definition at line 67 of file ioplugin.hh.

◆ SuffixSet

template<typename D>
typedef std::set<std::string> TIOPlugin< D >::SuffixSet

Definition at line 69 of file ioplugin.hh.

Constructor & Destructor Documentation

◆ TIOPlugin()

template<typename D>
TIOPlugin< D >::TIOPlugin ( const char *  name)

Constructor of the Plugin

Parameters
namethe name of the plug-in, should correnspond to the file type

Member Function Documentation

◆ add_suffix()

template<typename D>
void TIOPlugin< D >::add_suffix ( const std::string &  suffix)
protected

◆ add_suffixes()

template<typename D>
void TIOPlugin< D >::add_suffixes ( std::multimap< std::string, std::string > &  map) const

Adds file suffixes supported by this plug-in to a map to improve loading of files.

Parameters
mapthe map, the suffixes will be added to.

◆ add_supported_type()

template<typename D>
void TIOPlugin< D >::add_supported_type ( EPixelType  t)
protected

add pixel type t to the list of supported types

◆ get_preferred_suffix()

template<typename D>
const std::string TIOPlugin< D >::get_preferred_suffix ( ) const

Translate the file type decriptor to the file suffix.

Returns
preferred suffix of the file type
Remarks
in most cases this is just a pass-through

◆ get_suffixes()

template<typename D>
const SuffixSet& TIOPlugin< D >::get_suffixes ( ) const
protected

◆ load()

template<typename D>
PData TIOPlugin< D >::load ( const std::string &  fname) const

the load function, the actual implementation of the loading is implemented in do_load, which has to be implemented in the according plug-in

Parameters
fnamethe file name to be loaded
Returns
a shared pointer to the loaded data, or an empty shared pointer, if no data could be loaded.

◆ save()

template<typename D>
bool TIOPlugin< D >::save ( const std::string &  fname,
const Data data 
) const

The save function. Saves the data to file fname. The actual save function is implemented in do_save and needs to be provied in th eaccording IO plug-in.

Parameters
fnamefile name
datadata to be stored.
Returns
true if the saving was succesfull, false otherwise

◆ supported_pixel_types()

template<typename D>
const PixelTypeSet& TIOPlugin< D >::supported_pixel_types ( ) const
Returns
a set of thepixel types, supported by this IO plug-in

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