15 #ifndef BORNAGAIN_FIT_TOOLS_OPTIONCONTAINER_H
16 #define BORNAGAIN_FIT_TOOLS_OPTIONCONTAINER_H
40 option_t addOption(
const std::string& optionName, T value,
const std::string& description =
"");
45 template <
class T> T
optionValue(
const std::string& optionName)
const;
48 template <
class T>
void setOptionValue(
const std::string& optionName, T value);
60 bool exists(
const std::string& name);
67 const std::string& description)
70 throw std::runtime_error(
"OptionContainer::addOption() -> Error. Option '" + optionName
80 return option(optionName)->get<T>();
85 option(optionName)->value() = value;
86 if (
option(optionName)->value().which() !=
option(optionName)->defaultValue().which())
87 throw std::runtime_error(
88 "OptionContainer::setOptionValue() -> Error. Attempt to set different"
Declares class MultiOption.
Stores a single option for minimization algorithm.
Stores multi option (int,double,string) in a container.
std::vector< option_t > container_t
const_iterator begin() const
void setOptionValue(const std::string &optionName, T value)
Sets the value of option. Option should hold same value type already.
const_iterator end() const
container_t::iterator iterator
T optionValue(const std::string &optionName) const
std::shared_ptr< MultiOption > option_t
OptionContainer & operator=(const OptionContainer &other)
option_t option(const std::string &optionName)
void swapContent(OptionContainer &other)
option_t addOption(const std::string &optionName, T value, const std::string &description="")
container_t::const_iterator const_iterator
bool exists(const std::string &name)