OptionHandler
interface.
This class is an interface supplying a mechanism for processing an option and human-readable information about that option.
- See also
- NVXIO APIs
Definition at line 50 of file OptionHandler.hpp.
|
static ptr | integer (int *result, const Range< int > &validRange=ranges::all< int >()) |
| Creates an option handler that accepts argument values that look like decimal integers, converts them to int , and then stores them in the provided variable. More...
|
|
static ptr | oneOf (std::string *result, std::initializer_list< std::string > allowedValues) |
| Creates an option handler that accepts argument values from a certain set and stores them in the provided variable. More...
|
|
template<typename T > |
static ptr | oneOf (T *result, typename PairList< T >::type allowedValues) |
| Creates an option handler that accepts an argument value from a certain set, maps the argument value to a value of type T, and then stores that value in the provided variable. More...
|
|
static ptr | real (float *result, const Range< float > &validRange=ranges::all< float >()) |
| Creates an option handler that accepts argument values that look like real numbers, converts them to float , and then stores them in the provided variable. More...
|
|
static ptr | real (double *result, const Range< double > &validRange=ranges::all< double >()) |
| Creates an option handler that accepts argument values that look like real numbers, converts them to double , and then stores them in the provided variable. More...
|
|
static ptr | string (std::string *result) |
| Creates an option handler that accepts any argument value and copies it verbatim to the provided variable. More...
|
|
static ptr | unsignedInteger (unsigned *result, const Range< unsigned > &validRange=ranges::all< unsigned >()) |
| Creates an option handler that accepts argument values that look like unsigned decimal integers, converts them to unsigned int , and then stores them in the provided variable. More...
|
|
virtual nvxio::OptionHandler::~OptionHandler |
( |
| ) |
|
|
virtual |
virtual std::string nvxio::OptionHandler::getPlaceholder |
( |
| ) |
const |
|
pure virtual |
Gets a short hint that describes the expected values of the option (i.e., a placeholder for the option).
- Returns
- Placeholder for the option.
virtual std::string nvxio::OptionHandler::getConstraintString |
( |
| ) |
const |
|
virtual |
Gets information about valid values of the option.
- Returns
- Information about valid values of the option.
virtual std::string nvxio::OptionHandler::getDefaultString |
( |
| ) |
const |
|
pure virtual |
Gets the default value of the option.
- Returns
- Default value of the option.
virtual std::string nvxio::OptionHandler::processValue |
( |
const std::string & |
valueStr | ) |
const |
|
pure virtual |
Processes the value of the option.
- Parameters
-
[in] | valueStr | A reference to the value of the option. |
- Returns
- Status of the operation. If the operation fails returns an error message and an empty string.
static ptr nvxio::OptionHandler::string |
( |
std::string * |
result | ) |
|
|
static |
Creates an option handler that accepts any argument value and copies it verbatim to the provided variable.
- Parameters
-
[in,out] | result | A pointer to the provided variable that corresponds to the option. |
- Returns
- A pointer to the OptionHandler.
- Example Code
std::string configFile = "config.ini";
static ptr nvxio::OptionHandler::integer |
( |
int * |
result, |
|
|
const Range< int > & |
validRange = ranges::all< int >() |
|
) |
| |
|
static |
Creates an option handler that accepts argument values that look like decimal integers, converts them to int
, and then stores them in the provided variable.
- Parameters
-
[in,out] | result | A pointer to the provided variable that corresponds to the option. |
[in] | validRange | A reference to a range of valid values of the option. |
- Returns
- A pointer to the OptionHandler.
- Example Code
static ptr nvxio::OptionHandler::unsignedInteger |
( |
unsigned * |
result, |
|
|
const Range< unsigned > & |
validRange = ranges::all< unsigned >() |
|
) |
| |
|
static |
Creates an option handler that accepts argument values that look like unsigned decimal integers, converts them to unsigned int
, and then stores them in the provided variable.
- Parameters
-
[in,out] | result | A pointer to the provided variable that corresponds to the option. |
[in] | validRange | A reference to a range of valid values of the option. |
- Returns
- A pointer to the OptionHandler.
static ptr nvxio::OptionHandler::real |
( |
float * |
result, |
|
|
const Range< float > & |
validRange = ranges::all< float >() |
|
) |
| |
|
static |
Creates an option handler that accepts argument values that look like real numbers, converts them to float
, and then stores them in the provided variable.
- Parameters
-
[in,out] | result | A pointer to the provided variable that corresponds to the option. |
[in] | validRange | A range of valid values of the option. |
- Returns
- A pointer to the OptionHandler.
static ptr nvxio::OptionHandler::real |
( |
double * |
result, |
|
|
const Range< double > & |
validRange = ranges::all< double >() |
|
) |
| |
|
static |
Creates an option handler that accepts argument values that look like real numbers, converts them to double
, and then stores them in the provided variable.
- Parameters
-
[in,out] | result | A pointer to the provided variable that corresponds to the option. |
[in] | validRange | A reference to a range of valid values of the option. |
- Returns
- A pointer to the OptionHandler.
static ptr nvxio::OptionHandler::oneOf |
( |
std::string * |
result, |
|
|
std::initializer_list< std::string > |
allowedValues |
|
) |
| |
|
static |
Creates an option handler that accepts argument values from a certain set and stores them in the provided variable.
- Parameters
-
[in,out] | result | A pointer to the provided variable that corresponds to the option. |
[in] | allowedValues | The set of allowed values. |
- Returns
- A pointer to the OptionHandler.
- Example Code
std::string mode = "pedestrians";
template<typename T >
static ptr nvxio::OptionHandler::oneOf |
( |
T * |
result, |
|
|
typename PairList< T >::type |
allowedValues |
|
) |
| |
|
static |
Creates an option handler that accepts an argument value from a certain set, maps the argument value to a value of type T, and then stores that value in the provided variable.
- Parameters
-
[in,out] | result | A pointer to the provided variable that corresponds to the option. |
[in] | allowedValues | The set of allowed values. The set consists of combinations of a key value (std::string ) and a mapped value that has a type T. |
- Returns
- A pointer to the OptionHandler.
- Example Code
app.
addOption(0,
"scaleType",
"[ScaleImage] The scale interpolation type",
{"nearest", 0},
{"bilinear", 1},
{"area", 2},
}));
The documentation for this class was generated from the following file: