Compute Library
 21.05
Option Class Referenceabstract

Abstract base class for a command line option. More...

#include <Option.h>

Public Member Functions

 Option (std::string name)
 Constructor. More...
 
 Option (std::string name, bool is_required, bool is_set)
 Constructor. More...
 
virtual ~Option ()=default
 Default destructor. More...
 
virtual bool parse (std::string value)=0
 Parses the given string. More...
 
virtual std::string help () const =0
 Help message for the option. 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

Abstract base class for a command line option.

Definition at line 34 of file Option.h.

Constructor & Destructor Documentation

◆ Option() [1/2]

Option ( std::string  name)
inline

Constructor.

Parameters
[in]nameName of the option.

Definition at line 105 of file Option.h.

106  : _name{ std::move(name) }
107 {
108 }
std::string name() const
Name of the option.
Definition: Option.h:115

◆ Option() [2/2]

Option ( std::string  name,
bool  is_required,
bool  is_set 
)
inline

Constructor.

Parameters
[in]nameName of the option.
[in]is_requiredIs the option required?
[in]is_setHas a value been assigned to the option?

Definition at line 110 of file Option.h.

111  : _name{ std::move(name) }, _is_required{ is_required }, _is_set{ is_set }
112 {
113 }
std::string name() const
Name of the option.
Definition: Option.h:115
bool is_required() const
Is the option required?
Definition: Option.h:130
bool is_set() const
Has a value been assigned to the option?
Definition: Option.h:135

◆ ~Option()

virtual ~Option ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ help()

◆ is_required()

bool is_required ( ) const
inline

Is the option required?

Returns
True if the option is required.

Definition at line 130 of file Option.h.

131 {
132  return _is_required;
133 }

◆ is_set()

bool is_set ( ) const
inline

Has a value been assigned to the option?

Returns
True if a value has been set.

Definition at line 135 of file Option.h.

136 {
137  return _is_set;
138 }

Referenced by arm_compute::utils::consume_common_graph_parameters(), CommonGraphValidateOptions::consume_common_parameters(), CommonOptions::create_printers(), main(), and arm_compute::utils::run_example().

◆ name()

std::string name ( ) const
inline

Name of the option.

Returns
Name of the option.

Definition at line 115 of file Option.h.

116 {
117  return _name;
118 }

Referenced by ToggleOption::help(), ListOption< T >::ListOption(), and ToggleOption::ToggleOption().

◆ parse()

◆ set_help()

void set_help ( std::string  help)
inline

Set the help message for the option.

Parameters
[in]helpOption specific help message.

Definition at line 125 of file Option.h.

126 {
127  _help = std::move(help);
128 }
virtual std::string help() const =0
Help message for the option.

References GemmTuner::help.

Referenced by CommonGemmExampleOptions::CommonGemmExampleOptions(), CommonGraphOptions::CommonGraphOptions(), CommonGraphValidateOptions::CommonGraphValidateOptions(), CommonOptions::CommonOptions(), main(), and arm_compute::utils::run_example().

◆ set_required()

void set_required ( bool  is_required)
inline

Set whether the option is required.

Parameters
[in]is_requiredPass true if the option is required.

Definition at line 120 of file Option.h.

121 {
122  _is_required = is_required;
123 }
bool is_required() const
Is the option required?
Definition: Option.h:130

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