BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
|
Stores a single option for minimization algorithm. Int, double, string values are available.
Definition at line 28 of file MultiOption.h.
Public Types | |
using | variant_t = std::variant< int, double, std::string > |
Public Member Functions | |
template<typename T > | |
MultiOption (const std::string &name, const T &t, const std::string &descripion="") | |
MultiOption (std::string name="") | |
variant_t & | defaultValue () |
std::string | description () const |
template<typename T > | |
T | get () const |
Returns the option's value. More... | |
template<typename T > | |
T | getDefault () const |
Returns the option's default value (i.e. used during construction) More... | |
std::string | name () const |
void | setDescription (const std::string &description) |
void | setFromString (const std::string &value) |
Sets the value of option from string. More... | |
variant_t & | value () |
std::string | value_str () |
Returns a string representation of the option's value. More... | |
Private Attributes | |
variant_t | m_default_value |
std::string | m_description |
std::string | m_name |
variant_t | m_value |
using MultiOption::variant_t = std::variant<int, double, std::string> |
Definition at line 30 of file MultiOption.h.
MultiOption::MultiOption | ( | std::string | name = "" | ) |
Definition at line 19 of file MultiOption.cpp.
MultiOption::MultiOption | ( | const std::string & | name, |
const T & | t, | ||
const std::string & | descripion = "" |
||
) |
Definition at line 66 of file MultiOption.h.
References m_default_value, m_description, m_name, m_value, and name().
MultiOption::variant_t & MultiOption::defaultValue | ( | ) |
Definition at line 44 of file MultiOption.cpp.
References m_default_value.
std::string MultiOption::description | ( | ) | const |
Definition at line 29 of file MultiOption.cpp.
References m_description.
Referenced by setDescription().
T MultiOption::get |
T MultiOption::getDefault |
Returns the option's default value (i.e. used during construction)
Definition at line 81 of file MultiOption.h.
References m_default_value.
std::string MultiOption::name | ( | ) | const |
void MultiOption::setDescription | ( | const std::string & | description | ) |
Definition at line 34 of file MultiOption.cpp.
References description(), and m_description.
void MultiOption::setFromString | ( | const std::string & | value | ) |
Sets the value of option from string.
Definition at line 50 of file MultiOption.cpp.
References m_value, and value().
MultiOption::variant_t & MultiOption::value | ( | ) |
std::string MultiOption::value_str | ( | ) |
Returns a string representation of the option's value.
Sets the value of option from string.
Definition at line 66 of file MultiOption.cpp.
References m_value.
|
private |
Definition at line 62 of file MultiOption.h.
Referenced by MultiOption(), defaultValue(), and getDefault().
|
private |
Definition at line 60 of file MultiOption.h.
Referenced by MultiOption(), description(), and setDescription().
|
private |
Definition at line 59 of file MultiOption.h.
Referenced by MultiOption(), and name().
|
private |
Definition at line 61 of file MultiOption.h.
Referenced by MultiOption(), get(), setFromString(), value(), and value_str().