Public Member Functions | List of all members
rapidsmpf::config::OptionValue Class Reference

Configuration option value. More...

#include <config.hpp>

Public Member Functions

 OptionValue ()=default
 Default constructor. More...
 
 OptionValue (std::string value_as_string)
 Constructs OptionValue from a string representation. More...
 
template<typename T >
 OptionValue (T value) requires(!std
 Constructs OptionValue from a typed value. More...
 
std::any const & get_value () const
 Retrieves the stored value. More...
 
std::string const & get_value_as_string () const
 Retrieves the string representation of the value. More...
 
void set_value (std::any value)
 Sets the value if it has not been set already. More...
 

Detailed Description

Configuration option value.

The OptionValue class encapsulates a value (of any type using std::any) and a string representation of the value.

Definition at line 41 of file config.hpp.

Constructor & Destructor Documentation

◆ OptionValue() [1/3]

rapidsmpf::config::OptionValue::OptionValue ( )
default

Default constructor.

Constructs an empty OptionValue.

◆ OptionValue() [2/3]

rapidsmpf::config::OptionValue::OptionValue ( std::string  value_as_string)
inline

Constructs OptionValue from a string representation.

Parameters
value_as_stringA string representation of the value.

Definition at line 55 of file config.hpp.

◆ OptionValue() [3/3]

template<typename T >
rapidsmpf::config::OptionValue::OptionValue ( value)
inlineexplicit

Constructs OptionValue from a typed value.

The value is stored directly and no string representation is provided. Options constructed this way are considered initialized and make the Options instance unserializable.

Template Parameters
TType of the value to store.
Parameters
valueThe value to store.

Definition at line 69 of file config.hpp.

Member Function Documentation

◆ get_value()

std::any const& rapidsmpf::config::OptionValue::get_value ( ) const
inline

Retrieves the stored value.

Returns
A const reference to the std::any value.

Definition at line 78 of file config.hpp.

◆ get_value_as_string()

std::string const& rapidsmpf::config::OptionValue::get_value_as_string ( ) const
inline

Retrieves the string representation of the value.

Is the empty string, if not string representation exist.

Returns
A const reference to the string representation.

Definition at line 89 of file config.hpp.

◆ set_value()

void rapidsmpf::config::OptionValue::set_value ( std::any  value)
inline

Sets the value if it has not been set already.

Parameters
valueThe new value to store.
Exceptions
std::invalid_argumentif the value is already set.

Definition at line 100 of file config.hpp.


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