SST  15.1.0
StructuralSimulationToolkit
SST::OptionDefinitionImpl< T > Struct Template Reference

Class use to represent OptionDefinitions that store a value. More...

#include <configBase.h>

Inheritance diagram for SST::OptionDefinitionImpl< T >:
SST::OptionDefinition

Public Member Functions

 OptionDefinitionImpl (std::string name, T val, std::function< int(T &, std::string)> parser)
 Constructor. More...
 
 OptionDefinitionImpl (std::string name, T val, std::function< int(T &, std::string)> parser, std::function< std::string()> ext_help)
 Constructor. More...
 
OptionDefinitionImploperator= (const T &val)
 
OptionDefinitionImploperator= (const OptionDefinitionImpl &val)
 
 operator T () const
 
 OptionDefinitionImpl (const OptionDefinitionImpl &)=delete
 
 OptionDefinitionImpl (OptionDefinitionImpl &&)=default
 
int parse (std::string arg) override
 Function called to parse the option. More...
 
void transfer (OptionDefinition *def) override
 Function called to transfer the value(s) of a separate OptionDefinition to the current OptionDefinition. More...
 
void serialize (SST::Core::Serialization::serializer &ser) override
 Function called to serialize the data in the OptionDefinition. More...
 
void to_string (std::vector< std::string > &out) override
 Adds a string representation to the input vector for each of the underlying variables. More...
 
- Public Member Functions inherited from SST::OptionDefinition
 OptionDefinition (std::function< std::string()> ext_help)
 

Data Fields

value = T()
 
std::string name
 
const std::function< int(T &, std::string)> parser
 
- Data Fields inherited from SST::OptionDefinition
const std::function< std::string()> ext_help
 
bool set_cmdline = false
 

Detailed Description

template<typename T>
struct SST::OptionDefinitionImpl< T >

Class use to represent OptionDefinitions that store a value.

The class is templated on the type of the stored data.

NOTE: This class should be created using the DECL_OPTION macro, which will also create an accessor function for the underlying data

Constructor & Destructor Documentation

◆ OptionDefinitionImpl() [1/2]

template<typename T >
SST::OptionDefinitionImpl< T >::OptionDefinitionImpl ( std::string  name,
val,
std::function< int(T &, std::string)>  parser 
)
inline

Constructor.

Parameters
nameName of the option as seen by users of the class
valInitialization value of the underlying value
paraserFunction used to parse the value of the option

◆ OptionDefinitionImpl() [2/2]

template<typename T >
SST::OptionDefinitionImpl< T >::OptionDefinitionImpl ( std::string  name,
val,
std::function< int(T &, std::string)>  parser,
std::function< std::string()>  ext_help 
)
inline

Constructor.

Parameters
nameName of the option as seen by users of the class
valInitialization value of the underlying value
parserFunction used to parse the value of the option
ext_helpFunction called to print extended help for the option

Member Function Documentation

◆ parse()

template<typename T >
int SST::OptionDefinitionImpl< T >::parse ( std::string  arg)
inlineoverridevirtual

Function called to parse the option.

This generally defers to an underlying std::function that is defined when the OptionDefinition is declared (see children classes). There are standard parsers found in the StandardConfigParsers namespace, and extra parsing functions can be added to the namespace by child classes, if needed.

Parameters
argArgument passed to the option on the command line

Implements SST::OptionDefinition.

◆ serialize()

template<typename T >
void SST::OptionDefinitionImpl< T >::serialize ( SST::Core::Serialization::serializer ser)
inlineoverridevirtual

Function called to serialize the data in the OptionDefinition.

See also
Impl::option_serialize_data()
Parameters
serSerializer used to serialize the data

Implements SST::OptionDefinition.

◆ to_string()

template<typename T >
void SST::OptionDefinitionImpl< T >::to_string ( std::vector< std::string > &  out)
inlineoverridevirtual

Adds a string representation to the input vector for each of the underlying variables.

Format is variable = value. If there are no underlying variables, nothing will be added.

Parameters
[out]outvector to put the output strings in

Implements SST::OptionDefinition.

◆ transfer()

template<typename T >
void SST::OptionDefinitionImpl< T >::transfer ( OptionDefinition def)
inlineoverridevirtual

Function called to transfer the value(s) of a separate OptionDefinition to the current OptionDefinition.

Parameters
defOptionDefinition to copy value(s) from

Implements SST::OptionDefinition.


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