SST  15.1.0
StructuralSimulationToolkit
SST::OptionDefinitionPair< T, U > Struct Template Reference

Class use to represent OptionDefinitions that need to store two values. More...

#include <configBase.h>

Inheritance diagram for SST::OptionDefinitionPair< T, U >:
SST::OptionDefinition

Public Member Functions

 OptionDefinitionPair (std::string name1, T val1, std::string name2, U val2, std::function< int(T &, U &, std::string)> parser)
 Constructor. More...
 
 OptionDefinitionPair (std::string name1, T val1, std::string name2, U val2, std::function< int(T &, U &, std::string)> parser, std::function< std::string()> ext_help)
 Constructor. More...
 
 OptionDefinitionPair (const OptionDefinitionPair &)=delete
 
 OptionDefinitionPair (OptionDefinitionPair &&)=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

value1 = T()
 
std::string name1
 
value2 = U()
 
std::string name2
 
const std::function< int(T &, U &, 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, typename U>
struct SST::OptionDefinitionPair< T, U >

Class use to represent OptionDefinitions that need to store two values.

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

NOTE: This class should be created using the DECL_OPTION_PAIR macro, which will also create accessor functions the two underlying data types.

Constructor & Destructor Documentation

◆ OptionDefinitionPair() [1/2]

template<typename T, typename U>
SST::OptionDefinitionPair< T, U >::OptionDefinitionPair ( std::string  name1,
val1,
std::string  name2,
val2,
std::function< int(T &, U &, std::string)>  parser 
)
inline

Constructor.

Parameters
name1Name of the first value
val1Initialzation value of value1
name2Name of the first value
val2Initialzation value of value2
parserFunction used to parese the values

◆ OptionDefinitionPair() [2/2]

template<typename T, typename U>
SST::OptionDefinitionPair< T, U >::OptionDefinitionPair ( std::string  name1,
val1,
std::string  name2,
val2,
std::function< int(T &, U &, std::string)>  parser,
std::function< std::string()>  ext_help 
)
inline

Constructor.

Parameters
name1Name of the first value
val1Initialzation value of value1
name2Name of the first value
val2Initialzation value of value2
parserFunction used to parese the values
ext_helpFunction called to print the extended help for the option

Member Function Documentation

◆ parse()

template<typename T, typename U>
int SST::OptionDefinitionPair< T, U >::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, typename U>
void SST::OptionDefinitionPair< T, U >::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, typename U>
void SST::OptionDefinitionPair< T, U >::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, typename U>
void SST::OptionDefinitionPair< T, U >::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: