CParameter Class Referenceabstract
Command line and parameter parsing

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
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

## 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

  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

References descr(), and type().

Referenced by CDictParameter< T >::CDictParameter(), CSetParameter< T >::CSetParameter(), TFactoryParameter< F >::TFactoryParameter(), TFactoryParameter< F >::TFactoryParameter(), and TParameter< T >::TParameter().

## ~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_map | the 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

References value().

## 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

References value().

## descr()

void CParameter::descr | ( | std::ostream & | os | ) | const

Returns
  the description string of the parameter

Referenced by CDictParameter< T >::CDictParameter(), CParameter(), CSetParameter< T >::CSetParameter(), CStringParameter::CStringParameter(), CTParameter< bool >::CTParameter(), TBoundedParameter< uint16_t >::TBoundedParameter(), TFactoryParameter< F >::TFactoryParameter(), TFactoryParameter< F >::TFactoryParameter(), and TParameter< T >::TParameter().

## do_descr()

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

protected pure virtual

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

Parameters

  os |

Implemented in CDictParameter< T >, CSetParameter< T >, CTParameter< T >, CTParameter< bool >, CTParameter< C2DBounds >, CTParameter< C2DFVector >, CTParameter< C3DBounds >, CTParameter< C3DFVector >, TBoundedParameter< T >, TBoundedParameter< double >, TBoundedParameter< float >, TBoundedParameter< int16_t >, TBoundedParameter< int32_t >, TBoundedParameter< int64_t >, TBoundedParameter< std::vector< double > >, TBoundedParameter< std::vector< float > >, TBoundedParameter< std::vector< int16_t > >, TBoundedParameter< std::vector< int32_t > >, TBoundedParameter< std::vector< int64_t > >, TBoundedParameter< std::vector< uint16_t > >, TBoundedParameter< std::vector< uint32_t > >, TBoundedParameter< std::vector< uint64_t > >, TBoundedParameter< uint16_t >, TBoundedParameter< uint32_t >, TBoundedParameter< uint64_t >, and TParameter< 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

## 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

  root | the 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

Referenced by CParameter().

## value()

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

Write the current value plus information to a stream,

Parameters

  os | output stream

Referenced by add_xmlhelp_attribute(), add_xmlhelp_text(), CDictParameter< T >::CDictParameter(), CSetParameter< T >::CSetParameter(), CStringParameter::CStringParameter(), CTParameter< bool >::CTParameter(), CTParameter< bool >::do_descr(), TBoundedParameter< uint16_t >::do_descr(), TBoundedParameter< uint16_t >::TBoundedParameter(), TFactoryParameter< F >::TFactoryParameter(), TFactoryParameter< F >::TFactoryParameter(), and TParameter< T >::TParameter().

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

- parameter.hh