The base class for parameters used in complex options. More...
#include <mia/core/parameter.hh>
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 |
CXMLElement & | add_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... | |
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.
CParameter::CParameter | ( | const char | type[], |
bool | required, | ||
const char * | descr | ||
) |
Base parameter type constructor
type | a type description string that will show up in the help |
required | set to true if the parameter has to be set by the user |
descr | a short description of the parameter |
|
virtual |
ensure virtual destructor and avoid warnings because we have a virtual function
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
[in,out] | handler_map | the map to store then pointers to handlers used by this parameter |
|
protected |
|
protected |
|
protected |
Referenced by CDictParameter< T >::do_descr().
void CParameter::descr | ( | std::ostream & | os | ) | const |
|
protectedpure virtual |
the actual (abstract) function to write the description to a stream that needs to be overwritten
os |
Implemented in TParameter< T >, CSetParameter< T >, CDictParameter< T >, TBoundedParameter< T >, and CTParameter< T >.
|
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().
std::string CParameter::get_default_value | ( | ) | const |
const char* CParameter::get_descr | ( | ) | const |
void CParameter::get_help_xml | ( | CXMLElement & | root | ) | const |
Add the help for this parameter to a given XML tree
root | the root node to add the help entry to. |
std::string CParameter::get_value_as_string | ( | ) | const |
Get the curent parameter value as string
|
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
bool CParameter::required_set | ( | ) | const |
void CParameter::reset | ( | ) |
clear the required flag and reset to default value
bool CParameter::set | ( | const std::string & | str_value | ) |
set the parameter based on the string value
const char* CParameter::type | ( | ) | const |
void CParameter::value | ( | std::ostream & | os | ) | const |
Write the current value plus information to a stream,
os | output stream |