Compute Library
 21.08
EnumOption< T > Class Template Reference

Implementation of a simple option that accepts a value from a fixed set. More...

#include <EnumOption.h>

Collaboration diagram for EnumOption< T >:
[legend]

Public Member Functions

 EnumOption (std::string name, std::set< T > allowed_values)
 Construct option with allowed values. More...
 
 EnumOption (std::string name, std::set< T > allowed_values, T default_value)
 Construct option with allowed values, a fixed number of accepted values and default values for the option. More...
 
bool parse (std::string value) override
 Parses the given string. More...
 
std::string help () const override
 Help message for the option. More...
 
const T & value () const
 Get the selected value. More...
 
- Public Member Functions inherited from SimpleOption< T >
 SimpleOption (std::string name, T default_value)
 Construct the option with the given default value. More...
 
bool parse (std::string value) override
 Parses the given string. More...
 
std::string help () const override
 Help message for the option. More...
 
const T & value () const
 Get the option value. More...
 
template<>
bool parse (std::string value)
 Parses the given string. More...
 
- Public Member Functions inherited from Option
 Option (std::string name)
 Constructor. More...
 
 Option (std::string name, bool is_required, bool is_set)
 Constructor. More...
 
virtual ~Option ()=default
 Default destructor. More...
 
std::string name () const
 Name of the option. More...
 
void set_required (bool is_required)
 Set whether the option is required. More...
 
void set_help (std::string help)
 Set the help message for the option. More...
 
bool is_required () const
 Is the option required? More...
 
bool is_set () const
 Has a value been assigned to the option? More...
 

Detailed Description

template<typename T>
class arm_compute::utils::EnumOption< T >

Implementation of a simple option that accepts a value from a fixed set.

Definition at line 40 of file EnumOption.h.

Constructor & Destructor Documentation

◆ EnumOption() [1/2]

EnumOption ( std::string  name,
std::set< T >  allowed_values 
)
inline

Construct option with allowed values.

Parameters
[in]nameName of the option.
[in]allowed_valuesSet of allowed values for the option.

Definition at line 72 of file EnumOption.h.

73  : SimpleOption<T>{ std::move(name) }, _allowed_values{ std::move(allowed_values) }
std::string name() const
Name of the option.
Definition: Option.h:115

◆ EnumOption() [2/2]

EnumOption ( std::string  name,
std::set< T >  allowed_values,
default_value 
)

Construct option with allowed values, a fixed number of accepted values and default values for the option.

Parameters
[in]nameName of the option.
[in]allowed_valuesSet of allowed values for the option.
[in]default_valueDefault value.

Member Function Documentation

◆ help()

std::string help ( ) const
overridevirtual

Help message for the option.

Returns
String representing the help message for the specific subclass.

Implements Option.

◆ parse()

bool parse ( std::string  value)
overridevirtual

Parses the given string.

Parameters
[in]valueString representation as passed on the command line.
Returns
True if the value could be parsed by the specific subclass.

Implements Option.

◆ value()


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