These classes and functions relate to the parsing of the command line and the parameter parsing for plug-ins. More...
Data Structures | |
class | CHelpOption::Callback |
Interface for the callback to print the help assositated with the given option. More... | |
class | CCmdBoolOption |
The command line option that sets a flag to true when given. More... | |
class | CCmdFlagOption |
Command line option that translates a string to a set of flags. More... | |
class | CCmdOption |
The base class for all command line options. More... | |
class | CCmdOptionList |
The class to hold the list of options. More... | |
class | CCmdStringOption |
The command line option that expects a string. More... | |
class | CComplexOptionParser |
Parser for complex command line options. More... | |
class | CDictParameter< T > |
Dictionary paramater. More... | |
class | CHelpOption |
A command line option that will appear in the help group and exits the program after printing the help. More... | |
class | CParameter |
The base class for parameters used in complex options. More... | |
class | CParamList |
A class to hold a list of named parameters. More... | |
class | CParamOption |
command line option that handles a parameter More... | |
class | CPropertyFlagHolder |
This class holds a set of properties. More... | |
class | CSetParameter< T > |
A parameter that can only assume values out of a limited set. More... | |
class | CTParameter< T > |
Generic type of a complex paramter. More... | |
class | TCmdOption< T > |
Templated version based on CCmdOptionValue for values that can be converted to and from strings by stream operators. More... | |
class | TDelayedParameter< T > |
A parameter proxy object with a key to identify it. More... | |
class | TDictMap< T > |
A mapper from emums to string values. - usefull for names flags. More... | |
class | TFactoryParameter< F > |
A parameter that get's initialized by a factory to a shared or unique pointer. More... | |
class | TParameter< T > |
A parameter that can assume any value of the given value type. More... | |
class | TPluginHandlerHelpCallback< PluginHandler > |
Help callback to print the help for the given plug-in. More... | |
class | TRangeParameter< T > |
Scalar parameter with an expected value range. More... | |
Typedefs | |
typedef std::map< std::string, std::string > | CParsedOptions |
typedef std::map < EProgramDescriptionEntry, const char * > | SProgramDescription |
the map that holds a basic program description More... | |
Enumerations | |
enum | EProgramDescriptionEntry { pdi_group = 0, pdi_short = 1, pdi_description = 2, pdi_example_descr = 3, pdi_example_code = 4, pdi_author = 5 } |
program description entry identifiers More... | |
Functions | |
PCmdOption | make_help_opt (const char *long_opt, char short_opt, const char *long_help, CHelpOption::Callback *cb) |
Create a command line help option. More... | |
template<typename T > | |
PCmdOption | make_opt (T &value, const char *long_opt, char short_opt, const char *help, bool flags=false) |
Create a standard option that sets a value of the give type. More... | |
template<typename T , typename Tmin , typename Tmax > | |
PCmdOption | make_opt (T &value, Tmin min, Tmax max, const char *long_opt, char short_opt, const char *help, bool flags=false) |
Create an option of a scalar value that is expecte to be within a given range. More... | |
template<typename T > | |
PCmdOption | make_opt (std::vector< T > &value, const char *long_opt, char short_opt, const char *help, bool required=false) |
Create an option to set a vector of values,. More... | |
PCmdOption | make_opt (bool &value, const char *long_opt, char short_opt, const char *help) |
Create an option that represents a flag. More... | |
template<typename T > | |
PCmdOption | make_opt (T &value, const TDictMap< T > &map, const char *long_opt, char short_opt, const char *help) |
Create a table lookup option. More... | |
PCmdOption | make_opt (int &value, const CFlagString &map, const char *long_opt, char short_opt, const char *long_help, const char *short_help, bool flags=false) |
Create a flag lookup option. More... | |
PCmdOption | make_opt (std::string &value, const char *long_opt, char short_opt, const char *long_help, bool required=false, const CPluginHandlerBase *plugin_hint=NULL) |
Create an option to set a string. More... | |
template<typename T > | |
PCmdOption | make_opt (T &value, const std::set< T > &valid_set, const char *long_opt, char short_opt, const char *help, bool required=false) |
Create an oüption that only takes values from a pre-defined set. More... | |
template<typename T > | |
PCmdOption | make_opt (typename std::shared_ptr< T > &value, const char *default_value, const char *long_opt, char short_opt, const char *help, bool required=false) |
Create a command line option that creates uses a factory to create an object based on the given description. More... | |
template<typename T > | |
PCmdOption | make_opt (typename std::unique_ptr< T > &value, const char *default_value, const char *long_opt, char short_opt, const char *help, bool required=false) |
Create a command line option that creates uses a factory to create an object based on the given description. More... | |
template<typename T > | |
CParameter * | make_param (std::shared_ptr< T > &value, const std::string &init, bool required, const char *descr) |
create a factory parameter that initializes to a std::shared_ptr More... | |
template<typename T > | |
CParameter * | make_param (std::unique_ptr< T > &value, const std::string &init, bool required, const char *descr) |
create a factory parameter that initializes to a std::unique_ptr More... | |
These classes and functions relate to the parsing of the command line and the parameter parsing for plug-ins.
typedef std::map<std::string, std::string> CParsedOptions |
a map of parsed options as pairs key:value pairs
Definition at line 37 of file optionparser.hh.
typedef std::map<EProgramDescriptionEntry, const char *> SProgramDescription |
the map that holds a basic program description
Map of strings to provied information about the program The following values should be provied: (1) the program section, (2) A short description of the program - this will become the whatis entry in the man page, (3) A long description of the program (4) A text describing an example usage (5) The actual exampel call without the program name. This information is used by the auto-help system to create man-pages and a cross-referenced help of all the programs.
Definition at line 83 of file cmdlineparser.hh.
program description entry identifiers
These enumerates identify the parts of the program description
Enumerator | |
---|---|
pdi_group | |
pdi_short | |
pdi_description | |
pdi_example_descr | |
pdi_example_code | |
pdi_author |
Definition at line 58 of file cmdlineparser.hh.
PCmdOption make_help_opt | ( | const char * | long_opt, |
char | short_opt, | ||
const char * | long_help, | ||
CHelpOption::Callback * | cb | ||
) |
Create a command line help option.
Create a command line hoption that is used to print out some help.
long_opt | long option name |
short_opt | short option char, set to 0 of none givn |
long_help | the help string for thie option |
cb | a call back that us used to write the help |
PCmdOption make_opt | ( | T & | value, |
const char * | long_opt, | ||
char | short_opt, | ||
const char * | help, | ||
bool | flags = false |
||
) |
Create a standard option that sets a value of the give type.
Create a standard option that translates a string given on the command line into a value. The translation back-end is implemented with CTParameter.
T | the type of thevalue, it must support to be read from (operator >>) and written (operator << ) to a stream, as the back-end uses these opterator to translate. |
[in,out] | value | at input the default value, at output the parsed value if it was given. |
short_opt | short option name (or 0) | |
long_opt | long option name (must not be NULL) | |
help | long help string (must not be NULL) | |
flags | add flags like whether the optionis required to be set |
Definition at line 593 of file cmdlineparser.hh.
PCmdOption make_opt | ( | T & | value, |
Tmin | min, | ||
Tmax | max, | ||
const char * | long_opt, | ||
char | short_opt, | ||
const char * | help, | ||
bool | flags = false |
||
) |
Create an option of a scalar value that is expecte to be within a given range.
If the given value does not fit into the range it will be adjusted accordingly
T | type of the value to be parsed, supported are float, double, long, int, short, unsigned long, unsigned int, unsigned short. |
Tmin | type of the given minmum of the range, a conversion to type T must exist |
Tmax | type of the given maximum of the range, a conversion to type T must exist |
value | value variable to hold the parsed option value - pass in the default value - |
min | start of the value range the option can be set to |
max | end of the value range the option can be set to |
short_opt | short option name (or 0) |
long_opt | long option name (must not be NULL) |
help | long help string (must not be NULL) |
flags | add flags like whether the optionis required to be set |
Definition at line 617 of file cmdlineparser.hh.
PCmdOption make_opt | ( | std::vector< T > & | value, |
const char * | long_opt, | ||
char | short_opt, | ||
const char * | help, | ||
bool | required = false |
||
) |
Create an option to set a vector of values,.
The parameters on the command line will be separated by ',' and without spaces (or protected from the shell by usinh "". If the vetcor comes with a pre-allocated size, then the numer of given values must correspond to this size, Otherwise the size of the vector is deducted from the given command line parameter,.
T | type of the value hold by the vector |
[in,out] | value | at input: if not empty, number of expected values and their defaults, at output: the values given on the command line |
long_opt | long option name (must not be NULL) | |
short_opt | short option name (or 0) | |
help | help string (must not be NULL) | |
required | set to true if the option is required to be set |
Definition at line 642 of file cmdlineparser.hh.
PCmdOption make_opt | ( | bool & | value, |
const char * | long_opt, | ||
char | short_opt, | ||
const char * | help | ||
) |
Create an option that represents a flag.
It is always assumed to be not set if the according option is not given at the command line
[out] | value | the boolean that carries the result |
long_opt | long option name (must not be NULL) | |
short_opt | short option name (or 0) | |
help | help string (must not be NULL) |
PCmdOption make_opt | ( | T & | value, |
const TDictMap< T > & | map, | ||
const char * | long_opt, | ||
char | short_opt, | ||
const char * | help | ||
) |
Create a table lookup option.
Create an option that uses a table to translate between the string given on the command line and the actual value.
T | the type of the value |
[in,out] | value | variable to hold the parsed and translated option value. At entry, the value must be set to a valid dictionary entry. |
map | the lookup table for the option | |
long_opt | long option name (must not be NULL) | |
short_opt | short option name (or 0) | |
help | help string (must not be NULL) |
Definition at line 680 of file cmdlineparser.hh.
PCmdOption make_opt | ( | int & | value, |
const CFlagString & | map, | ||
const char * | long_opt, | ||
char | short_opt, | ||
const char * | long_help, | ||
const char * | short_help, | ||
bool | flags = false |
||
) |
Create a flag lookup option.
[in,out] | value | at input it holds the default value, at output, if the command line option was givem this value is replaced by the parsed and translated option value, |
map | the lookup table for the option flags | |
long_opt | long option name (must not be NULL) | |
short_opt | short option name (or 0) | |
long_help | long help string (must not be NULL) | |
short_help | short help string | |
flags | add flags like whether the optionis required to be set |
PCmdOption make_opt | ( | std::string & | value, |
const char * | long_opt, | ||
char | short_opt, | ||
const char * | long_help, | ||
bool | required = false , |
||
const CPluginHandlerBase * | plugin_hint = NULL |
||
) |
Create an option to set a string.
Create an option that holds a string
[in,out] | value | at input it holds the default value, at output, if the command line option was givem this value is replaced by the parsed and translated option value, |
long_opt | long option name (must not be NULL) | |
short_opt | short option name (or 0) | |
long_help | long help string (must not be NULL) | |
required | set to true if the option is required to be set | |
plugin_hint | if the string will later be used to create an object by using plug-in then pass a pointer to the corresponding plug-in handler to give a hint the help system about this connection. |
PCmdOption make_opt | ( | T & | value, |
const std::set< T > & | valid_set, | ||
const char * | long_opt, | ||
char | short_opt, | ||
const char * | help, | ||
bool | required = false |
||
) |
Create an oüption that only takes values from a pre-defined set.
Create an option that can only take values from a given set.
T | the type of the value to be set |
[in,out] | value | at input it holds the default value, at output, if the command line option was givem this value is replaced by the parsed and translated option value, |
valid_set | the set of allowed values | |
long_opt | long option name (must not be NULL) | |
short_opt | short option name (or 0) | |
help | long help string (must not be NULL) | |
required | set true if the optionis required to be set |
Definition at line 746 of file cmdlineparser.hh.
PCmdOption make_opt | ( | typename std::shared_ptr< T > & | value, |
const char * | default_value, | ||
const char * | long_opt, | ||
char | short_opt, | ||
const char * | help, | ||
bool | required = false |
||
) |
Create a command line option that creates uses a factory to create an object based on the given description.
Create a command line option that creates uses a factory to create the value based on the command line arguments given,
T | the non-pointer type of the value |
[out] | value | at output, if the command line option was givem this value is replaced by the parsed and translated option value. If not given but the default_values was given then this default initializer is used to create the actual value. If no default value was givem and the option is not given at the command line, then the value is not touched. |
default_value | default value if parameter is not given | |
long_opt | long option name | |
short_opt | short option char, set to 0 of none givn | |
help | the help string for thie option | |
required | set true if the optionis required to be set |
Definition at line 776 of file cmdlineparser.hh.
PCmdOption make_opt | ( | typename std::unique_ptr< T > & | value, |
const char * | default_value, | ||
const char * | long_opt, | ||
char | short_opt, | ||
const char * | help, | ||
bool | required = false |
||
) |
Create a command line option that creates uses a factory to create an object based on the given description.
Create a command line option that uses a TFactoryPluginHandler to create the actual value hold by a std::unique_ptr.
T | the non-pointer type of the value |
[out] | value | at output, if the command line option was given this value is replaced by the parsed and translated option value. If not given but the default_values was given then this default initializer is used to create the actual value. |
default_value | default value if parameter is not given | |
long_opt | long option name | |
short_opt | short option char, set to 0 of none givn | |
help | the help string for thie option | |
required | set true if the optionis required to be set |
Definition at line 803 of file cmdlineparser.hh.
CParameter* make_param | ( | std::shared_ptr< T > & | value, |
const std::string & | init, | ||
bool | required, | ||
const char * | descr | ||
) |
create a factory parameter that initializes to a std::shared_ptr
Creates a TFactoryParameter accurding to the given parameters. The advantage over calling the TactoryParameter cunstructor is, that type deduction is done automatically.
the | type of the factory created parameter value |
value | the shared_ptr value to be set through this parameter. Best is to pass an empty shared pointer and leave the initialization to the parameter handling |
init | the default initialization string for the parameter, pass "" if there is no default. |
required | set to true if the user must set this parameter |
descr | a help description of the parameter |
Definition at line 445 of file parameter.hh.
Referenced by TWatershedFilterPlugin< dim >::TWatershedFilterPlugin().
CParameter* make_param | ( | std::unique_ptr< T > & | value, |
const std::string & | init, | ||
bool | required, | ||
const char * | descr | ||
) |
create a factory parameter that initializes to a std::unique_ptr
Creates a TFactoryParameter accurding to the given parameters. The advantage over calling the TactoryParameter cunstructor is that type deduction is done automatically.
the | type of the factory created parameter value |
value | the unique_ptr value to be set through this parameter. Best is to pass an empty unique pointer and leave the initialization to the parameter handling |
init | the default initialization string for the parameter, pass "" if there is no default. |
required | set to true if the user must set this parameter |
descr | a help description of the parameter |
Definition at line 467 of file parameter.hh.