handlerbase.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 mia_core_handlerbase_hh
#define mia_core_handlerbase_hh
#include <ostream>
#include <fstream>
#include <map>
#include <mia/core/defines.hh>
NS_MIA_BEGIN
class CXMLElement;
class CPluginHandlerBase;
typedef std::map<std::string, const CPluginHandlerBase *> HandlerHelpMap;
class EXPORT_CORE CPluginHandlerBase
{
public:
CPluginHandlerBase(const char *data_descr, const char *type_descr);
CPluginHandlerBase(const CPluginHandlerBase& other) = delete;
CPluginHandlerBase& operator = (const CPluginHandlerBase& other) = delete;
virtual ~CPluginHandlerBase();
void print_short_help(std::ostream& os) const;
void print_help(std::ostream& os) const;
void get_xml_help(CXMLElement& root) const;
const std::string& get_descriptor() const;
void add_dependend_handlers(HandlerHelpMap& handler_map) const;
void get_string_help_description_xml(std::ostream& os, CXMLElement& root) const;
std::string get_handler_type_string() const;
bool validate_parameter_string(const std::string& s) const;
private:
virtual void do_print_short_help(std::ostream& os) const = 0;
virtual void do_print_help(std::ostream& os) const = 0;
virtual void do_get_xml_help(CXMLElement& root) const = 0;
virtual void do_add_dependend_handlers(HandlerHelpMap& handler_map) const = 0;
virtual std::string get_handler_type_string_and_help(std::ostream& os) const;
virtual std::string do_get_handler_type_string() const;
virtual bool do_validate_parameter_string(const std::string& s) const;
std::string m_descriptor;
};
NS_MIA_END
#endif
CPluginHandlerBase
The base class for all plugin handlers.
Definition handlerbase.hh:57
CPluginHandlerBase::print_help
void print_help(std::ostream &os) const
CPluginHandlerBase::~CPluginHandlerBase
virtual ~CPluginHandlerBase()
CPluginHandlerBase::CPluginHandlerBase
CPluginHandlerBase(const char *data_descr, const char *type_descr)
CPluginHandlerBase::add_dependend_handlers
void add_dependend_handlers(HandlerHelpMap &handler_map) const
CPluginHandlerBase::print_short_help
void print_short_help(std::ostream &os) const
CPluginHandlerBase::get_string_help_description_xml
void get_string_help_description_xml(std::ostream &os, CXMLElement &root) const
CPluginHandlerBase::get_descriptor
const std::string & get_descriptor() const
CPluginHandlerBase::CPluginHandlerBase
CPluginHandlerBase(const CPluginHandlerBase &other)=delete
CPluginHandlerBase::get_handler_type_string
std::string get_handler_type_string() const
CPluginHandlerBase::validate_parameter_string
bool validate_parameter_string(const std::string &s) const
CPluginHandlerBase::get_xml_help
void get_xml_help(CXMLElement &root) const
CXMLElement
This class implements a facade for the xml Element.
Definition xmlinterface.hh:50
defines.hh
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
HandlerHelpMap
std::map< std::string, const CPluginHandlerBase * > HandlerHelpMap
A map that is used to collect the plug-in handlers used in a program.
Definition handlerbase.hh:45
type_descr
const char *const TSparseSolver< F >::type_descr
Definition sparse_solver.hh:141