ioplugin.hh
Go to the documentation of this file.
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
* Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ph_ioplugin_hh
#define ph_ioplugin_hh
#include <set>
#include <mia/core/plugin_base.hh>
#include <mia/core/pixeltype.hh>
#include <mia/core/iodata.hh>
NS_MIA_BEGIN
struct EXPORT_CORE io_plugin_type {
static const char *type_descr;
};
template <typename D>
class EXPORT_HANDLER TIOPlugin: public TPlugin<D, io_plugin_type>
{
public:
typedef typename D::type Data;
typedef typename std::shared_ptr<Data > PData;
typedef std::set<EPixelType> PixelTypeSet;
typedef std::set<std::string> SuffixSet;
TIOPlugin(const char *name);
void add_suffixes(std::multimap<std::string, std::string>& map) const;
PData load(const std::string& fname) const;
bool save(const std::string& fname, const Data& data) const;
const PixelTypeSet& supported_pixel_types() const;
const std::string get_preferred_suffix() const;
protected:
void add_suffix(const std::string& suffix);
const SuffixSet& get_suffixes() const;
void add_supported_type(EPixelType t);
private:
PixelTypeSet m_typeset;
SuffixSet m_suffixes;
virtual PData do_load(const std::string& fname) const = 0;
void do_get_help_xml(CXMLElement& root) const;
virtual bool do_save(const std::string& fname, const typename D::type& data) const = 0;
virtual const std::string do_get_preferred_suffix() const;
};
EXPORT_CORE extern const char *const io_plugin_property_multi_record;
EXPORT_CORE extern const char *const io_plugin_property_history_split;
EXPORT_CORE extern const char *const io_plugin_property_has_attributes;
EXPORT_CORE extern const char *const io_plugin_property_can_pipe;
NS_MIA_END
#endif
CParamTranslator::do_get_help_xml
virtual void do_get_help_xml(CXMLElement &root) const
CXMLElement
This class implements a facade for the xml Element.
Definition xmlinterface.hh:50
TIOPlugin::SuffixSet
std::set< std::string > SuffixSet
Definition ioplugin.hh:70
TIOPlugin::add_supported_type
void add_supported_type(EPixelType t)
add pixel type t to the list of supported types
TIOPlugin::TIOPlugin
TIOPlugin(const char *name)
TIOPlugin::Data
D::type Data
type of the data handled by this plug-in
Definition ioplugin.hh:62
TIOPlugin::PData
std::shared_ptr< Data > PData
shared pointer of the data handled by this plug-in
Definition ioplugin.hh:65
TIOPlugin::add_suffixes
void add_suffixes(std::multimap< std::string, std::string > &map) const
TIOPlugin::supported_pixel_types
const PixelTypeSet & supported_pixel_types() const
TIOPlugin::PixelTypeSet
std::set< EPixelType > PixelTypeSet
the type for the supported pixel types of this IO handler
Definition ioplugin.hh:68
TIOPlugin::save
bool save(const std::string &fname, const Data &data) const
TIOPlugin::get_preferred_suffix
const std::string get_preferred_suffix() const
TIOPlugin::load
PData load(const std::string &fname) const
TIOPlugin::add_suffix
void add_suffix(const std::string &suffix)
TIOPlugin::get_suffixes
const SuffixSet & get_suffixes() const
TPlugin< D, io_plugin_type >::TPlugin
TPlugin(const char *name)
EXPORT_HANDLER
#define EXPORT_HANDLER
Definition core/cost.hh:32
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
EXPORT_CORE
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition defines.hh:101
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36
iodata.hh
io_plugin_property_can_pipe
EXPORT_CORE const char *const io_plugin_property_can_pipe
io_plugin_property_has_attributes
EXPORT_CORE const char *const io_plugin_property_has_attributes
io_plugin_property_history_split
EXPORT_CORE const char *const io_plugin_property_history_split
io_plugin_property_multi_record
EXPORT_CORE const char *const io_plugin_property_multi_record
pixeltype.hh
EPixelType
EPixelType
Definition pixeltype.hh:33
plugin_base.hh
type_descr
const char *const TSparseSolver< F >::type_descr
Definition sparse_solver.hh:141