|
BALL
1.5.0
|
#include <BALL/FORMAT/commandlineParser.h>
Public Member Functions | |
| CommandlineParser (String tool_name, String tool_description, String tool_version, String build_date, String category="") | |
| void | setToolManual (const String &manual) |
| void | registerMandatoryIntegerParameter (const String &name, const String &description) |
| void | registerMandatoryIntegerListParameter (const String &name, const String &description) |
| void | registerMandatoryDoubleParameter (const String &name, const String &description) |
| void | registerMandatoryDoubleListParameter (const String &name, const String &description) |
| void | registerMandatoryStringParameter (const String &name, const String &description) |
| void | registerMandatoryStringListParameter (const String &name, const String &description) |
| void | registerMandatoryInputFile (const String &name, const String &description) |
| void | registerMandatoryOutputFile (const String &name, const String &description) |
| void | registerMandatoryInputFileList (const String &name, const String &description) |
| void | registerMandatoryOutputFileList (const String &name, const String &description) |
| void | registerMandatoryGalaxyOutputFolder (const String &name, const String &description) |
| void | registerMandatoryGalaxyOutputId (const String &name, const String &description) |
| void | registerOptionalIntegerParameter (const String &name, const String &description, int default_value=0) |
| void | registerOptionalIntegerListParameter (const String &name, const String &description, const std::vector< int > &default_values=vector< int >()) |
| void | registerOptionalDoubleParameter (const String &name, const String &description, double default_value=0.0) |
| void | registerOptionalDoubleListParameter (const String &name, const String &description, const std::vector< double > &default_values=vector< double >()) |
| void | registerOptionalStringParameter (const String &name, const String &description, const String &default_value="") |
| void | registerOptionalStringListParameter (const String &name, const String &description, const std::vector< String > &default_values=vector< String >()) |
| void | registerOptionalInputFile (const String &name, const String &description, const String &default_value="") |
| void | registerOptionalOutputFile (const String &name, const String &description, const String &default_value="") |
| void | registerOptionalInputFileList (const String &name, const String &description, const std::vector< String > &default_values=vector< String >()) |
| void | registerOptionalOutputFileList (const String &name, const String &description, const std::vector< String > &default_values=vector< String >()) |
| void | registerOptionalGalaxyOutputFolder (const String &name, const String &description, const String &default_value="") |
| void | registerOptionalGalaxyOutputId (const String &name, const String &description, const String &default_value="") |
| void | registerFlag (String name, String description, bool default_gui_value=false, bool hidden=false) |
| void | registerAdvancedParameters (Options &options) |
| void | setParameterAsAdvanced (String name) |
| void | setParameterAsHidden (String name) |
| void | setParameterRestrictions (String category, String par_name, double min_value, double max_value) |
| void | setParameterRestrictions (String par_name, double min_value, double max_value) |
| void | setParameterRestrictions (String category, String par_name, int min_value, int max_value) |
| void | setParameterRestrictions (String par_name, int min_value, int max_value) |
| void | setParameterRestrictions (String category, String par_name, list< String > &allowed_values) |
| void | setParameterRestrictions (String par_name, list< String > &allowed_values) |
| void | setSupportedFormats (String category, String par_name, String supported_formats) |
| void | setSupportedFormats (String par_name, String supported_formats) |
| void | parse (int argc, char *argv[]) |
| void | copyAdvancedParametersToOptions (Options &options) |
| const String & | get (String name) |
| bool | has (String name) |
| const list< String > & | getList (String name) |
| void | printHelp (const std::set< String > ¶meter_names=std::set< String >(), bool show_manual=true) |
| void | printToolInfo () |
| const String & | getStartTime () |
| const String & | getStartCommand () |
Static Public Attributes | |
| static const String | NOT_FOUND |
| static const list< String > | EMTPY_LIST |
Class for parsing parameters specified on the command line.
Register the parameters and flags of your tool with registerParameter(), resp. registerFlag() and have the command-line parsed with parse(). After this, you can retrieve the values of all parameters with get().
In addition to this, you can also register a tool-manual text, define restrictions on parameters and register file-formats that are supported for in- or output-files.
If the parameter '-write_par somefilename.xml' is given to the program, an xml-based parameter-file will be automatically written, containing the specification the tool, all its parameters and all parameter values used on the commend-line.
If the parameter '-par somefilename.xml' is used, such a file can be read, so that the parameter-values stored in it will be used. However, if, although this is not necessary, parameters (other than -par) are specified on the command-line, their values will automatically overload those stored in the xml-file.
The parameter '-env' allows to differentiate between command line ('cmdline') behaviour and special adaptions to workflow systems like galaxy or knime.
Definition at line 38 of file commandlineParser.h.
| BALL::CommandlineParser::CommandlineParser | ( | String | tool_name, |
| String | tool_description, | ||
| String | tool_version, | ||
| String | build_date, | ||
| String | category = "" |
||
| ) |
| void BALL::CommandlineParser::copyAdvancedParametersToOptions | ( | Options & | options | ) |
Copies names and values of all advanced parameters to the given Options object.
Returns the value for a given parameter name.
Example: For "-o outfile.sdf", CommandlineParser::get("o") will return "outfile.sdf".
Returns a parameter-list for a given parameter name.
Example: For "-i infile1.sdf infile2.sdf", CommandlineParser::getList("i") will return a vector containing 'infile1.sdf' and infile2.sdf'.
| const String& BALL::CommandlineParser::getStartCommand | ( | ) |
Get the exact command with which the tool was started on the command-line.
| const String& BALL::CommandlineParser::getStartTime | ( | ) |
Find out whether a the parameter or flag has been specified on the command-line.
| void BALL::CommandlineParser::parse | ( | int | argc, |
| char * | argv[] | ||
| ) |
Parse all parameters found in the command line
| void BALL::CommandlineParser::printHelp | ( | const std::set< String > & | parameter_names = std::set< String >(), |
| bool | show_manual = true |
||
| ) |
Print information about about all registered parameters.
If 'parameter_names' is specified, only information those parameters is shown.
| void BALL::CommandlineParser::printToolInfo | ( | ) |
| void BALL::CommandlineParser::registerAdvancedParameters | ( | Options & | options | ) |
| void BALL::CommandlineParser::registerFlag | ( | String | name, |
| String | description, | ||
| bool | default_gui_value = false, |
||
| bool | hidden = false |
||
| ) |
| void BALL::CommandlineParser::registerMandatoryDoubleListParameter | ( | const String & | name, |
| const String & | description | ||
| ) |
| void BALL::CommandlineParser::registerMandatoryDoubleParameter | ( | const String & | name, |
| const String & | description | ||
| ) |
| void BALL::CommandlineParser::registerMandatoryGalaxyOutputFolder | ( | const String & | name, |
| const String & | description | ||
| ) |
| void BALL::CommandlineParser::registerMandatoryGalaxyOutputId | ( | const String & | name, |
| const String & | description | ||
| ) |
| void BALL::CommandlineParser::registerMandatoryInputFile | ( | const String & | name, |
| const String & | description | ||
| ) |
| void BALL::CommandlineParser::registerMandatoryInputFileList | ( | const String & | name, |
| const String & | description | ||
| ) |
| void BALL::CommandlineParser::registerMandatoryIntegerListParameter | ( | const String & | name, |
| const String & | description | ||
| ) |
| void BALL::CommandlineParser::registerMandatoryIntegerParameter | ( | const String & | name, |
| const String & | description | ||
| ) |
| void BALL::CommandlineParser::registerMandatoryOutputFile | ( | const String & | name, |
| const String & | description | ||
| ) |
| void BALL::CommandlineParser::registerMandatoryOutputFileList | ( | const String & | name, |
| const String & | description | ||
| ) |
| void BALL::CommandlineParser::registerMandatoryStringListParameter | ( | const String & | name, |
| const String & | description | ||
| ) |
| void BALL::CommandlineParser::registerMandatoryStringParameter | ( | const String & | name, |
| const String & | description | ||
| ) |
| void BALL::CommandlineParser::registerOptionalDoubleListParameter | ( | const String & | name, |
| const String & | description, | ||
| const std::vector< double > & | default_values = vector< double >() |
||
| ) |
| void BALL::CommandlineParser::registerOptionalDoubleParameter | ( | const String & | name, |
| const String & | description, | ||
| double | default_value = 0.0 |
||
| ) |
| void BALL::CommandlineParser::registerOptionalGalaxyOutputFolder | ( | const String & | name, |
| const String & | description, | ||
| const String & | default_value = "" |
||
| ) |
| void BALL::CommandlineParser::registerOptionalGalaxyOutputId | ( | const String & | name, |
| const String & | description, | ||
| const String & | default_value = "" |
||
| ) |
| void BALL::CommandlineParser::registerOptionalInputFile | ( | const String & | name, |
| const String & | description, | ||
| const String & | default_value = "" |
||
| ) |
| void BALL::CommandlineParser::registerOptionalInputFileList | ( | const String & | name, |
| const String & | description, | ||
| const std::vector< String > & | default_values = vector< String >() |
||
| ) |
| void BALL::CommandlineParser::registerOptionalIntegerListParameter | ( | const String & | name, |
| const String & | description, | ||
| const std::vector< int > & | default_values = vector< int >() |
||
| ) |
| void BALL::CommandlineParser::registerOptionalIntegerParameter | ( | const String & | name, |
| const String & | description, | ||
| int | default_value = 0 |
||
| ) |
| void BALL::CommandlineParser::registerOptionalOutputFile | ( | const String & | name, |
| const String & | description, | ||
| const String & | default_value = "" |
||
| ) |
| void BALL::CommandlineParser::registerOptionalOutputFileList | ( | const String & | name, |
| const String & | description, | ||
| const std::vector< String > & | default_values = vector< String >() |
||
| ) |
| void BALL::CommandlineParser::registerOptionalStringListParameter | ( | const String & | name, |
| const String & | description, | ||
| const std::vector< String > & | default_values = vector< String >() |
||
| ) |
| void BALL::CommandlineParser::registerOptionalStringParameter | ( | const String & | name, |
| const String & | description, | ||
| const String & | default_value = "" |
||
| ) |
| void BALL::CommandlineParser::setParameterAsAdvanced | ( | String | name | ) |
| void BALL::CommandlineParser::setParameterAsHidden | ( | String | name | ) |
| void BALL::CommandlineParser::setParameterRestrictions | ( | String | category, |
| String | par_name, | ||
| double | min_value, | ||
| double | max_value | ||
| ) |
Register the minimal and maximal allowed value for a floating-point numerical parameter.
| void BALL::CommandlineParser::setParameterRestrictions | ( | String | category, |
| String | par_name, | ||
| int | min_value, | ||
| int | max_value | ||
| ) |
Register the minimal and maximal allowed value for an integer numerical parameter.
| void BALL::CommandlineParser::setParameterRestrictions | ( | String | category, |
| String | par_name, | ||
| list< String > & | allowed_values | ||
| ) |
Register the allowed values for a string-parameter.
| void BALL::CommandlineParser::setParameterRestrictions | ( | String | par_name, |
| double | min_value, | ||
| double | max_value | ||
| ) |
| void BALL::CommandlineParser::setParameterRestrictions | ( | String | par_name, |
| int | min_value, | ||
| int | max_value | ||
| ) |
| void BALL::CommandlineParser::setParameterRestrictions | ( | String | par_name, |
| list< String > & | allowed_values | ||
| ) |
| void BALL::CommandlineParser::setSupportedFormats | ( | String | category, |
| String | par_name, | ||
| String | supported_formats | ||
| ) |
Register the supported formats for input-/output-files.
| supported_formats | supported file-formats separated by commas |
| void BALL::CommandlineParser::setToolManual | ( | const String & | manual | ) |
Set the text to be displayed as mini-manual when starting the tool, containing a few sentences describing what the tool should be good for ...
|
static |
Definition at line 47 of file commandlineParser.h.
|
static |
Definition at line 46 of file commandlineParser.h.