CParameter Class Referenceabstract

The base class for parameters used in complex options. More...

#include <mia/core/parameter.hh>

Inheritance diagram for CParameter:
[legend]

Public Member Functions

void add_dependend_handler (HandlerHelpMap &handler_map) const
 
 CParameter (const char type[], bool required, const char *descr)
 
void descr (std::ostream &os) const
 
std::string get_default_value () const
 
const char * get_descr () const
 
void get_help_xml (CXMLElement &root) const
 
std::string get_value_as_string () const
 
virtual void post_set ()
 
bool required_set () const
 
void reset ()
 
bool set (const std::string &str_value)
 
const char * type () const
 
void value (std::ostream &os) const
 
virtual ~CParameter ()
 

Protected Member Functions

void add_xmlhelp_attribute (CXMLElement &node, const std::string &tag, const std::string &value) const
 
CXMLElementadd_xmlhelp_childnode (CXMLElement &parent, const std::string &tag) const
 
void add_xmlhelp_text (CXMLElement &node, const std::string &value) const
 
virtual void do_descr (std::ostream &os) const =0
 
const std::string errmsg (const std::string &err_value) const
 create an error message by using the given value that raises the error More...
 

Detailed Description

The base class for parameters used in complex options.

The base class for parameters that might be set based on strings. The main use-case is to provide parameters to plug-ins.

Definition at line 48 of file parameter.hh.

Constructor & Destructor Documentation

◆ CParameter()

CParameter::CParameter ( const char  type[],
bool  required,
const char *  descr 
)

Base parameter type constructor

Parameters
typea type description string that will show up in the help
requiredset to true if the parameter has to be set by the user
descra short description of the parameter

◆ ~CParameter()

virtual CParameter::~CParameter ( )
virtual

ensure virtual destructor and avoid warnings because we have a virtual function

Member Function Documentation

◆ add_dependend_handler()

void CParameter::add_dependend_handler ( HandlerHelpMap handler_map) const

Interface to add the plug-in handler this parameter calls to translate the input string Only for CFactoryParameter this actually does something

Parameters
[in,out]handler_mapthe map to store then pointers to handlers used by this parameter

◆ add_xmlhelp_attribute()

void CParameter::add_xmlhelp_attribute ( CXMLElement node,
const std::string &  tag,
const std::string &  value 
) const
protected

◆ add_xmlhelp_childnode()

CXMLElement& CParameter::add_xmlhelp_childnode ( CXMLElement parent,
const std::string &  tag 
) const
protected

◆ add_xmlhelp_text()

void CParameter::add_xmlhelp_text ( CXMLElement node,
const std::string &  value 
) const
protected

◆ descr()

void CParameter::descr ( std::ostream &  os) const
Returns
the description string of the parameter

◆ do_descr()

virtual void CParameter::do_descr ( std::ostream &  os) const
protectedpure virtual

the actual (abstract) function to write the description to a stream that needs to be overwritten

Parameters
os

Implemented in TParameter< T >, CSetParameter< T >, CDictParameter< T >, TBoundedParameter< T >, and CTParameter< T >.

◆ errmsg()

const std::string CParameter::errmsg ( const std::string &  err_value) const
protected

create an error message by using the given value that raises the error

Referenced by CSetParameter< T >::do_descr(), and TParameter< T >::do_descr().

◆ get_default_value()

std::string CParameter::get_default_value ( ) const
Returns
the default value of this parameter as a string

◆ get_descr()

const char* CParameter::get_descr ( ) const
Returns
the help description of the parameter

◆ get_help_xml()

void CParameter::get_help_xml ( CXMLElement root) const

Add the help for this parameter to a given XML tree

Parameters
rootthe root node to add the help entry to.

◆ get_value_as_string()

std::string CParameter::get_value_as_string ( ) const

Get the curent parameter value as string

Returns
the current parameter value

◆ post_set()

virtual void CParameter::post_set ( )
virtual

This command is run after the parsing has been done in most cases it will do nothing, only for factory parameters and the like it must set the final parameter value from the init string

◆ required_set()

bool CParameter::required_set ( ) const
Returns
wheather the required flag is (still) set

◆ reset()

void CParameter::reset ( )

clear the required flag and reset to default value

◆ set()

bool CParameter::set ( const std::string &  str_value)

set the parameter based on the string value

◆ type()

const char* CParameter::type ( ) const
Returns
the type string of the parameter q

◆ value()

void CParameter::value ( std::ostream &  os) const

Write the current value plus information to a stream,

Parameters
osoutput stream

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