#include <execution.hh>
|
| program_option (const char *section, const char *flag, const char *help, std::initializer_list< initializer_value > values={}, std::function< bool(const any &)> const &check=default_check) |
|
| program_option (const char *name, const char *help, size_t count, std::function< bool(const any &)> const &check=default_check) |
|
ValueType | value () const |
|
| operator ValueType () const |
|
bool | has_value () const |
|
template<typename ValueType>
struct flecsi::program_option< ValueType >
The program_option type is a wrapper that implements a useful subset of Boost's Program Options utility. Creating an instance of this type at namespace scope will add a program option that can be queried after the initialize function is called.
◆ program_option() [1/2]
template<typename ValueType>
Construct a program option.
- Parameters
-
section | The options description label. |
flag | The command-line option in long, short, or dual form, e.g., "option,o" -> –option or -o. |
help | The help message for the option. |
values | Mechanism to set optional value attributes. Supported keys are option_default, option_implicit, option_zero, and option_multi. If an option_default value is specified, it will be used if the flag is not passed to the command line. If an option_implicit value is specified, it will be used if the flag is passed to the command line without a value. If option_zero is passed, the flag will not take any values, and must have an option_implicit value specified. If option_multi is passed, the flag will take multiple values. |
check | An optional, user-defined predicate to validate the option passed by the user. |
program_option<int> my_flag("My Section",
"flag,f",
"Specify the flag [0-9].",
{
{option_default, 1},
{option_implicit, 0}
},
[](flecsi::any const & v) {
const int value = flecsi::option_value<int>(v);
return value >= 0 && value < 10;
});
◆ program_option() [2/2]
template<typename ValueType>
Construct a positional program option.
- Parameters
-
name | The name for the positional option. |
help | The help message for the option. |
count | The number of values to consume for this positional option. If -1 is passed, this option will consume all remainging values. |
check | An optional, user-defined predicate to validate the option passed by the user. |
The documentation for this struct was generated from the following file: