vSMC
v3.0.0
Scalable Monte Carlo
|
Program options. More...
#include <vsmc/utility/program_option.hpp>
Public Member Functions | |
ProgramOptionMap (bool silent=false) | |
template<typename T > | |
ProgramOptionMap & | add (const std::string &name, const std::string &desc, T *ptr) |
Add an option with a single value. More... | |
template<typename T , typename V > | |
ProgramOptionMap & | add (const std::string &name, const std::string &desc, T *ptr, V val) |
Add an option with a single value, with a default value. More... | |
template<typename T , typename Alloc > | |
ProgramOptionMap & | add (const std::string &name, const std::string &desc, std::vector< T, Alloc > *ptr) |
Add an option with multiple value. More... | |
template<typename T , typename Alloc , typename V > | |
ProgramOptionMap & | add (const std::string &name, const std::string &desc, std::vector< T, Alloc > *ptr, V val) |
Add an option with multiple value, with a default value. More... | |
std::size_t | count (const std::string &name) const |
Count the number of successful processing of an option. More... | |
bool | help () |
If the "help" option is processed and set to true. More... | |
std::shared_ptr< ProgramOption > | option (const std::string &name) |
Get the underlying option object. More... | |
std::shared_ptr< const ProgramOption > | option (const std::string &name) const |
Get the underlying option object. More... | |
void | print_help (std::ostream &os=std::cout) const |
Print help information for each option. More... | |
void | process (int argc, const char *const *argv, std::ostream &os=std::cout) |
Process the options. More... | |
void | process (int argc, char *const *argv, std::ostream &os=std::cout) |
Process the options. More... | |
ProgramOptionMap & | remove (const std::string &name) |
void | silent (bool flag) |
Set the silent flag, if true, no warning messages will be printed for unknown options etc.,. More... | |
Program options.
Definition at line 336 of file program_option.hpp.
|
inlineexplicit |
Definition at line 339 of file program_option.hpp.
|
inline |
Add an option with a single value.
name | Name of the option, on command name it shall be specified by --name |
desc | A descritpion stream of the option |
ptr | The destination that store the option value |
Definition at line 352 of file program_option.hpp.
|
inline |
Add an option with a single value, with a default value.
Definition at line 363 of file program_option.hpp.
|
inline |
Add an option with multiple value.
Definition at line 374 of file program_option.hpp.
|
inline |
Add an option with multiple value, with a default value.
Definition at line 385 of file program_option.hpp.
|
inline |
Count the number of successful processing of an option.
Definition at line 463 of file program_option.hpp.
|
inline |
If the "help" option is processed and set to true.
Definition at line 472 of file program_option.hpp.
|
inline |
Get the underlying option object.
Definition at line 475 of file program_option.hpp.
|
inline |
Get the underlying option object.
Definition at line 485 of file program_option.hpp.
|
inline |
Print help information for each option.
Definition at line 442 of file program_option.hpp.
|
inline |
Process the options.
If the option --help
is given at the commad line, help information are printed.
argc | The first argument of the main function |
argv | The second argument of the main function |
os | The output stream used to print help information and the warning messages if any error occurs when processing the options. |
Definition at line 413 of file program_option.hpp.
|
inline |
Process the options.
Definition at line 428 of file program_option.hpp.
|
inline |
Definition at line 394 of file program_option.hpp.
|
inline |
Set the silent flag, if true, no warning messages will be printed for unknown options etc.,.
Definition at line 496 of file program_option.hpp.