|
BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Stores a single option for minimization algorithm. More...
Public Types | |
| using | variant_t = boost::variant< int, double, std::string > |
Public Member Functions | |
| template<typename T > | |
| MultiOption (const std::string &name, const T &t, const std::string &descripion="") | |
| MultiOption (const 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 () |
Private Attributes | |
| variant_t | m_default_value |
| std::string | m_description |
| std::string | m_name |
| variant_t | m_value |
Stores a single option for minimization algorithm.
Int, double, string values are available. Relies on boost::variant, will be switched to std::variant in C++-17.
Definition at line 30 of file MultiOption.h.
| using MultiOption::variant_t = boost::variant<int, double, std::string> |
Definition at line 32 of file MultiOption.h.
|
explicit |
Definition at line 18 of file MultiOption.cpp.
|
explicit |
Definition at line 63 of file MultiOption.h.
References m_default_value, m_description, m_name, m_value, and name().
| MultiOption::variant_t & MultiOption::defaultValue | ( | ) |
Definition at line 40 of file MultiOption.cpp.
References m_default_value.
| std::string MultiOption::description | ( | ) | const |
Definition at line 25 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 76 of file MultiOption.h.
References m_default_value.
| std::string MultiOption::name | ( | ) | const |
| void MultiOption::setDescription | ( | const std::string & | description | ) |
Definition at line 30 of file MultiOption.cpp.
References description(), and m_description.
| void MultiOption::setFromString | ( | const std::string & | value | ) |
Sets the value of option from string.
TODO find more elegant way (without if/else and boost::lexical_cast
Definition at line 48 of file MultiOption.cpp.
References m_value, and value().
| MultiOption::variant_t & MultiOption::value | ( | ) |
|
private |
Definition at line 59 of file MultiOption.h.
Referenced by MultiOption(), defaultValue(), and getDefault().
|
private |
Definition at line 57 of file MultiOption.h.
Referenced by MultiOption(), description(), and setDescription().
|
private |
Definition at line 56 of file MultiOption.h.
Referenced by MultiOption(), and name().
|
private |
Definition at line 58 of file MultiOption.h.
Referenced by MultiOption(), get(), setFromString(), and value().