The command line argument parser used by the main ARGoS executable. More...
#include <argos_command_line_arg_parser.h>
Public Types | |
enum | EAction { ACTION_UNKNOWN = 0 , ACTION_SHOW_HELP , ACTION_SHOW_VERSION , ACTION_RUN_EXPERIMENT , ACTION_QUERY } |
The possible actions that can be done. More... | |
Public Member Functions | |
CARGoSCommandLineArgParser () | |
Class constructor. More... | |
virtual | ~CARGoSCommandLineArgParser () |
Class destructor. More... | |
virtual void | PrintUsage (CARGoSLog &c_log) |
Prints usage information to the wanted log. More... | |
virtual void | PrintVersion () |
Prints the current ARGoS version and release. More... | |
virtual void | Parse (SInt32 n_argc, char **ppch_argv) |
Parses the command line. More... | |
EAction | GetAction () |
Returns the action parsed by Parse(). More... | |
const std::string & | GetExperimentConfigFile () |
Returns the experiment configuration file as parsed by Parse(). More... | |
const std::string & | GetQuery () |
Returns the query on the plugins as parsed by Parse(). More... | |
bool | IsLogColored () |
Returns true if color is enabled for LOG and LOGERR. More... | |
bool | IsHelpWanted () |
Returns true if color if a help message must be displayed. More... | |
Public Member Functions inherited from argos::CCommandLineArgParser | |
CCommandLineArgParser () | |
Class constructor. More... | |
virtual | ~CCommandLineArgParser () |
Class destructor. More... | |
void | AddFlag (char ch_short_option, const std::string &str_long_option, const std::string &str_description, bool &b_flag) |
Adds a flag to the parser. More... | |
template<typename T > | |
void | AddArgument (char ch_short_option, const std::string &str_long_option, const std::string &str_description, T &t_buffer) |
Adds an argument to the parser. More... | |
The command line argument parser used by the main ARGoS executable.
If you plan to write your own main.cpp
file, and want to keep the same command line arguments, use this class.
Definition at line 25 of file argos_command_line_arg_parser.h.
The possible actions that can be done.
Enumerator | |
---|---|
ACTION_UNKNOWN | |
ACTION_SHOW_HELP | |
ACTION_SHOW_VERSION | |
ACTION_RUN_EXPERIMENT | |
ACTION_QUERY |
Definition at line 32 of file argos_command_line_arg_parser.h.
argos::CARGoSCommandLineArgParser::CARGoSCommandLineArgParser | ( | ) |
Class constructor.
Definition at line 15 of file argos_command_line_arg_parser.cpp.
|
virtual |
Class destructor.
Definition at line 66 of file argos_command_line_arg_parser.cpp.
|
inline |
Returns the action parsed by Parse().
Definition at line 87 of file argos_command_line_arg_parser.h.
|
inline |
Returns the experiment configuration file as parsed by Parse().
The returned value is meaningful only if GetAction() returns ACTION_RUN_EXPERIMENT.
Definition at line 97 of file argos_command_line_arg_parser.h.
|
inline |
Returns the query on the plugins as parsed by Parse().
The returned value is meaningful only if GetAction() returns ACTION_QUERY.
Definition at line 107 of file argos_command_line_arg_parser.h.
|
inline |
Returns true
if color if a help message must be displayed.
Help maybe be necessary either in case of parsing error, or because the –help</t> argument was passed on the command line.
Definition at line 128 of file argos_command_line_arg_parser.h.
|
inline |
Returns true
if color is enabled for LOG and LOGERR.
Definition at line 118 of file argos_command_line_arg_parser.h.
|
virtual |
Parses the command line.
In parsing is successful, it sets m_eAction to the action to perform, along with the relevant operands.
n_argc | The number of command line arguments. |
ppch_argv | An array of C-style strings containing the arguments. |
CARGoSException | if a parse error occurs. |
Reimplemented from argos::CCommandLineArgParser.
Definition at line 80 of file argos_command_line_arg_parser.cpp.
|
virtual |
Prints usage information to the wanted log.
c_log | The output log (LOG or LOGERR) |
Reimplemented from argos::CCommandLineArgParser.
Definition at line 143 of file argos_command_line_arg_parser.cpp.
|
virtual |
Prints the current ARGoS version and release.
Definition at line 180 of file argos_command_line_arg_parser.cpp.