Interface Documentation
Version: invalid
Classes | Public Member Functions | List of all members
flecsi::program_option< ValueType > Struct Template Reference

#include <execution.hh>

Classes

struct  initializer_value
 

Public Member Functions

 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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ program_option() [1/2]

template<typename ValueType>
flecsi::program_option< ValueType >::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 
)
inline

Construct a program option.

Parameters
sectionThe options description label.
flagThe command-line option in long, short, or dual form, e.g., "option,o" -> –option or -o.
helpThe help message for the option.
valuesMechanism 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.
checkAn 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>
flecsi::program_option< ValueType >::program_option ( const char *  name,
const char *  help,
size_t  count,
std::function< bool(const any &)> const &  check = default_check 
)
inline

Construct a positional program option.

Parameters
nameThe name for the positional option.
helpThe help message for the option.
countThe number of values to consume for this positional option. If -1 is passed, this option will consume all remainging values.
checkAn optional, user-defined predicate to validate the option passed by the user.

The documentation for this struct was generated from the following file: