32#include "neml2/base/Option.h"
33#include "neml2/misc/errors.h"
70 void operator+=(const
OptionSet & source);
100 bool contains(
const std::string &)
const;
107 bool contains(
const std::string &)
const;
116 std::string
to_str()
const;
122 template <
typename T>
123 const T &
get(
const std::string &)
const;
133 template <
typename T, FType f = FType::NONE>
134 T &
set(
const std::string &);
143 template <
typename T>
146 template <
typename T>
150 using map_type = std::map<std::string, std::unique_ptr<OptionBase>, std::less<>>;
254 if (
dynamic_cast<const Option<T> *
>(it->second.get()))
264 throw NEMLException(
"ERROR: no option named \"" +
name +
"\" found.\n\nKnown options:\n" +
271template <
typename T, FType F>
The accessor containing all the information needed to access an item in a LabeledAxis.
Definition LabeledAxisAccessor.h:56
Definition OptionBase.h:44
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
Definition OptionSet.h:52
map_type::iterator iterator
Option map iterator.
Definition OptionSet.h:152
map_type _values
Data structure to map names with values.
Definition OptionSet.h:241
T & set_buffer(const std::string &)
Convenient method to request a buffer.
Definition OptionSet.h:291
const std::string & name() const
A readonly reference to the option set's name.
Definition OptionSet.h:75
const std::string & type() const
A readonly reference to the option set's type.
Definition OptionSet.h:79
LabeledAxisAccessor & set_output(const std::string &)
Definition OptionSet.cxx:83
std::string to_str() const
Print the contents.
Definition OptionSet.cxx:132
map_type::const_iterator const_iterator
Constant option map iterator.
Definition OptionSet.h:154
std::map< std::string, std::unique_ptr< OptionBase >, std::less<> > map_type
The type of the map that we store internally.
Definition OptionSet.h:150
std::string & name()
A writable reference to the option set's name.
Definition OptionSet.h:77
LabeledAxisAccessor & set_input(const std::string &)
Definition OptionSet.cxx:77
std::string & type()
A writable reference to the option set's type.
Definition OptionSet.h:81
const std::string & doc() const
A readonly reference to the option set's docstring.
Definition OptionSet.h:87
const std::string & section() const
A readonly reference to the option set's section.
Definition OptionSet.h:91
T & set_parameter(const std::string &)
Convenient method to request a parameter.
Definition OptionSet.h:284
iterator begin()
Iterator pointing to the beginning of the set of options.
Definition OptionSet.cxx:178
iterator end()
Iterator pointing to the end of the set of options.
Definition OptionSet.cxx:190
const std::string & path() const
A readonly reference to the option set's path.
Definition OptionSet.h:83
std::string & doc()
A writable reference to the option set's docstring.
Definition OptionSet.h:89
const T & get(const std::string &) const
Definition OptionSet.h:261
struct neml2::OptionSet::Metadata _metadata
void clear()
Clear internal data structures & frees any allocated memory.
Definition OptionSet.cxx:89
std::string & path()
A writable reference to the option set's path.
Definition OptionSet.h:85
std::string & section()
A writable reference to the option set's section.
Definition OptionSet.h:93
std::size_t size() const
Definition OptionSet.h:110
T & set(const std::string &)
Definition OptionSet.h:273
bool contains(const std::string &) const
Definition OptionSet.h:250
Definition DiagnosticsInterface.cxx:30
bool options_compatible(const OptionSet &opts, const OptionSet &additional_opts)
Definition OptionSet.cxx:34
std::ostream & operator<<(std::ostream &os, const EnumSelection &es)
Definition EnumSelection.cxx:32