(argc,argv[]) and set options.
More...
#include <Teuchos_CommandLineProcessor.hpp>
Collaboration diagram for Teuchos::CommandLineProcessor:
Public Types | |
| enum | EParseCommandLineReturn { PARSE_SUCCESSFUL = 0, PARSE_HELP_PRINTED = 1, PARSE_UNRECOGNIZED_OPTION = -1 } |
Return value for CommandLineProcessor::parse(). More... | |
| enum | EOptType { OPT_NONE, OPT_BOOL_TRUE, OPT_BOOL_FALSE, OPT_INT, OPT_DOUBLE, OPT_STRING, OPT_ENUM_INT } |
Public Member Functions | |
Constructors | |
| CommandLineProcessor (bool throwExceptions=true, bool recogniseAllOptions=true) | |
| Default Constructor. | |
Set up options | |
| void | setOption (const char option_true[], const char option_false[], bool *option_val, const char documentation[]=NULL) |
| Set a boolean option. | |
| void | setOption (const char option_name[], int *option_val, const char documentation[]=NULL) |
| Set an integer option. | |
| void | setOption (const char option_name[], double *option_val, const char documentation[]=NULL) |
| Set a floating-point option. | |
| void | setOption (const char option_name[], std::string *option_val, const char documentation[]=NULL) |
| Set a string option. | |
| template<class EType> | |
| void | setOption (const char enum_option_name[], EType *enum_option_val, const int num_enum_opt_values, const EType enum_opt_values[], const char *enum_opt_names[], const char documentation[]=NULL) |
| Set an enumeration option (templated by enumeration type). | |
Parse methods | |
| EParseCommandLineReturn | parse (int argc, char *argv[], std::ostream *errout=&std::cerr) const |
| Parse a command line. | |
Miscellaneous method | |
| void | printHelpMessage (const char program_name[], std::ostream &out) const |
| Print the help message. | |
Behavior modes | |
| void | throwExceptions (const bool &throwExceptions) |
| Set if an exception is thrown, there is a parse error, or help is printed. | |
| const bool & | throwExceptions () const |
| Return true if an exception is thrown, there is a parse error, or help is printed. | |
| void | recogniseAllOptions (const bool &recogniseAllOptions) |
| Set if all options must be recognized or not. | |
| const bool & | recogniseAllOptions () const |
| Return true if all options are being recognized by the parser. | |
Private Types | |
| typedef Teuchos::map< std::string, opt_val_val_t > | options_list_t |
| typedef std::vector< opt_doc_t > | options_documentation_list_t |
| typedef std::vector< enum_opt_data_t > | enum_opt_data_list_t |
Private Member Functions | |
| void | setEnumOption (const char enum_option_name[], int *enum_option_val, const int num_enum_opt_values, const int enum_opt_values[], const char *enum_opt_names[], const char documentation[]) |
| bool | set_enum_value (int argv_i, char *argv[], const std::string &enum_opt_name, const int enum_id, const std::string &enum_str_val, std::ostream *errout) const |
| void | print_enum_opt_names (const int enum_id, std::ostream &out) const |
| std::string | enum_opt_default_val_name (const std::string &enum_name, const int enum_id, std::ostream *errout) const |
| int | find_enum_opt_index (const std::string &enum_opt_name, const int opt_value, const enum_opt_data_t &enum_data, std::ostream *errout) const |
| bool | get_opt_val (const char str[], std::string *opt_name, std::string *opt_val_str) const |
| std::string | opt_type_str (EOptType) const |
| void | print_bad_opt (int argv_i, char *argv[], std::ostream *errout) const |
Private Attributes | |
| bool | throwExceptions_ |
| bool | recogniseAllOptions_ |
| options_list_t | options_list_ |
| options_documentation_list_t | options_documentation_list_ |
| enum_opt_data_list_t | enum_opt_data_list_ |
(argc,argv[]) and set options.
This class will process command-line arguments in the form of (argc,argv[]) and set user-defined options. This class can also work in a number of modes. This processor can require that all options be recognized or not.
Definition at line 63 of file Teuchos_CommandLineProcessor.hpp.
|
|
Definition at line 348 of file Teuchos_CommandLineProcessor.hpp. |
|
|
Definition at line 368 of file Teuchos_CommandLineProcessor.hpp. |
|
|
Definition at line 395 of file Teuchos_CommandLineProcessor.hpp. |
|
|
Return value for
Definition at line 69 of file Teuchos_CommandLineProcessor.hpp. |
|
|
Definition at line 320 of file Teuchos_CommandLineProcessor.hpp. |
|
||||||||||||
|
Default Constructor.
Definition at line 61 of file Teuchos_CommandLineProcessor.cpp. |
|
||||||||||||||||||||
|
Set a boolean option.
Definition at line 71 of file Teuchos_CommandLineProcessor.cpp. |
|
||||||||||||||||
|
Set an integer option.
Definition at line 87 of file Teuchos_CommandLineProcessor.cpp. |
|
||||||||||||||||
|
Set a floating-point option.
Definition at line 100 of file Teuchos_CommandLineProcessor.cpp. |
|
||||||||||||||||
|
Set a string option.
Definition at line 113 of file Teuchos_CommandLineProcessor.cpp. |
|
||||||||||||||||||||||||||||||||
|
Set an enumeration option (templated by enumeration type).
int for EType. Using any other type for EType could be trouble!
Definition at line 475 of file Teuchos_CommandLineProcessor.hpp. |
|
||||||||||||||||
|
Parse a command line.
Note that if the option
Definition at line 129 of file Teuchos_CommandLineProcessor.cpp. |
|
||||||||||||
|
Print the help message.
Definition at line 216 of file Teuchos_CommandLineProcessor.cpp. |
|
|
Set if an exception is thrown, there is a parse error, or help is printed.
Definition at line 289 of file Teuchos_CommandLineProcessor.hpp. |
|
|
Return true if an exception is thrown, there is a parse error, or help is printed.
Definition at line 292 of file Teuchos_CommandLineProcessor.hpp. |
|
|
Set if all options must be recognized or not.
Definition at line 295 of file Teuchos_CommandLineProcessor.hpp. |
|
|
Return true if all options are being recognized by the parser.
Definition at line 298 of file Teuchos_CommandLineProcessor.hpp. |
|
||||||||||||||||||||||||||||
|
Definition at line 350 of file Teuchos_CommandLineProcessor.cpp. |
|
||||||||||||||||||||||||||||
|
Definition at line 375 of file Teuchos_CommandLineProcessor.cpp. |
|
||||||||||||
|
Definition at line 411 of file Teuchos_CommandLineProcessor.cpp. |
|
||||||||||||||||
|
Definition at line 427 of file Teuchos_CommandLineProcessor.cpp. |
|
||||||||||||||||||||
|
Definition at line 442 of file Teuchos_CommandLineProcessor.cpp. |
|
||||||||||||||||
|
Definition at line 467 of file Teuchos_CommandLineProcessor.cpp. |
|
|
Definition at line 504 of file Teuchos_CommandLineProcessor.hpp. |
|
||||||||||||||||
|
Definition at line 493 of file Teuchos_CommandLineProcessor.cpp. |
|
|
Definition at line 400 of file Teuchos_CommandLineProcessor.hpp. |
|
|
Definition at line 401 of file Teuchos_CommandLineProcessor.hpp. |
|
|
Definition at line 402 of file Teuchos_CommandLineProcessor.hpp. |
|
|
Definition at line 403 of file Teuchos_CommandLineProcessor.hpp. |
|
|
Definition at line 404 of file Teuchos_CommandLineProcessor.hpp. |
1.3.9.1