ARGoS  3
A parallel, multi-engine simulator for swarm robotics
argos::CARGoSCommandLineArgParser Class Reference

The command line argument parser used by the main ARGoS executable. More...

#include <argos_command_line_arg_parser.h>

+ Inheritance diagram for argos::CARGoSCommandLineArgParser:

List of all members.

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.
virtual ~CARGoSCommandLineArgParser ()
 Class destructor.
virtual void PrintUsage (CARGoSLog &c_log)
 Prints usage information to the wanted log.
virtual void PrintVersion ()
 Prints the current ARGoS version and release.
virtual void Parse (SInt32 n_argc, char **ppch_argv)
 Parses the command line.
EAction GetAction ()
 Returns the action parsed by Parse().
const std::string & GetExperimentConfigFile ()
 Returns the experiment configuration file as parsed by Parse().
const std::string & GetQuery ()
 Returns the query on the plugins as parsed by Parse().
bool IsLogColored ()
 Returns true if color is enabled for LOG and LOGERR.
bool IsHelpWanted ()
 Returns true if color if a help message must be displayed.

Detailed Description

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.

See also:
CCommandLineArgParser

Definition at line 25 of file argos_command_line_arg_parser.h.


Member Enumeration Documentation

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.


Constructor & Destructor Documentation


Member Function Documentation

Returns the action parsed by Parse().

Returns:
The action parsed by Parse().
See also:
Parse()

Definition at line 87 of file argos_command_line_arg_parser.h.

Returns the experiment configuration file as parsed by Parse().

The returned value is meaningful only if GetAction() returns ACTION_RUN_EXPERIMENT.

Returns:
The experiment configuration file as parsed by Parse().
See also:
Parse()

Definition at line 97 of file argos_command_line_arg_parser.h.

const std::string& argos::CARGoSCommandLineArgParser::GetQuery ( ) [inline]

Returns the query on the plugins as parsed by Parse().

The returned value is meaningful only if GetAction() returns ACTION_QUERY.

Returns:
The query on the plugins as parsed by Parse().
See also:
Parse()

Definition at line 107 of file argos_command_line_arg_parser.h.

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.

See also:
Parse()

Definition at line 128 of file argos_command_line_arg_parser.h.

Returns true if color is enabled for LOG and LOGERR.

See also:
Parse()
CARGoSLogger
LOG
LOGERR

Definition at line 118 of file argos_command_line_arg_parser.h.

void argos::CARGoSCommandLineArgParser::Parse ( SInt32  n_argc,
char **  ppch_argv 
) [virtual]

Parses the command line.

In parsing is successful, it sets m_eAction to the action to perform, along with the relevant operands.

Parameters:
n_argcThe number of command line arguments.
ppch_argvAn array of C-style strings containing the arguments.
Exceptions:
CARGoSExceptionif a parse error occurs.
See also:
GetAction()
GetExperimentConfigFile()
GetQuery()
IsLogColored()
IsHelpWanted()

Reimplemented from argos::CCommandLineArgParser.

Definition at line 80 of file argos_command_line_arg_parser.cpp.

Prints usage information to the wanted log.

Parameters:
c_logThe output log (LOG or LOGERR)
See also:
CARGoSLogger
LOG
LOGERR

Reimplemented from argos::CCommandLineArgParser.

Definition at line 143 of file argos_command_line_arg_parser.cpp.

Prints the current ARGoS version and release.

Definition at line 180 of file argos_command_line_arg_parser.cpp.


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