NEML2 2.0.0
|
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed. More...
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
#include <OptionSet.h>
Classes | |
struct | Metadata |
class | Option |
class | OptionBase |
Public Member Functions | |
OptionSet ()=default | |
OptionSet (const OptionSet &) | |
OptionSet (OptionSet &&) noexcept | |
OptionSet & | operator= (const OptionSet &) |
OptionSet & | operator= (OptionSet &&) noexcept |
virtual | ~OptionSet ()=default |
const std::string & | name () const |
A readonly reference to the option set's name. | |
std::string & | name () |
A writable reference to the option set's name. | |
const std::string & | type () const |
A readonly reference to the option set's type. | |
std::string & | type () |
A writable reference to the option set's type. | |
const std::string & | path () const |
A readonly reference to the option set's path. | |
std::string & | path () |
A writable reference to the option set's path. | |
const std::string & | doc () const |
A readonly reference to the option set's docstring. | |
std::string & | doc () |
A writable reference to the option set's docstring. | |
const std::string & | section () const |
A readonly reference to the option set's section. | |
std::string & | section () |
A writable reference to the option set's section. | |
template<typename T > | |
bool | contains (const std::string &) const |
bool | contains (const std::string &) const |
std::size_t | size () const |
void | clear () |
Clear internal data structures & frees any allocated memory. | |
void | print (std::ostream &os=std::cout) const |
Print the contents. | |
template<typename T > | |
const T & | get (const std::string &) const |
const OptionBase & | get (const std::string &) const |
void | operator+= (const OptionSet &source) |
void | operator+= (OptionSet &&source) |
template<typename T , FType f = FType::NONE> | |
T & | set (const std::string &) |
OptionBase & | set (const std::string &) |
Convenient methods to request an input variable | |
LabeledAxisAccessor & | set_input (const std::string &) |
Convenient methods to request an output variable | |
using | map_type = std::map<std::string, std::unique_ptr<OptionBase>, std::less<>> |
The type of the map that we store internally. | |
using | iterator = map_type::iterator |
Option map iterator. | |
using | const_iterator = map_type::const_iterator |
Constant option map iterator. | |
struct neml2::OptionSet::Metadata | _metadata |
map_type | _values |
Data structure to map names with values. | |
LabeledAxisAccessor & | set_output (const std::string &) |
template<typename T > | |
T & | set_parameter (const std::string &) |
Convenient method to request a parameter. | |
template<typename T > | |
T & | set_buffer (const std::string &) |
Convenient method to request a buffer. | |
iterator | begin () |
Iterator pointing to the beginning of the set of options. | |
const_iterator | begin () const |
Iterator pointing to the beginning of the set of options. | |
iterator | end () |
Iterator pointing to the end of the set of options. | |
const_iterator | end () const |
Iterator pointing to the end of the set of options. | |
using const_iterator = map_type::const_iterator |
Constant option map iterator.
using map_type = std::map<std::string, std::unique_ptr<OptionBase>, std::less<>> |
The type of the map that we store internally.
|
default |
OptionSet::iterator begin | ( | ) |
Iterator pointing to the beginning of the set of options.
OptionSet::const_iterator begin | ( | ) | const |
Iterator pointing to the beginning of the set of options.
void clear | ( | ) |
Clear internal data structures & frees any allocated memory.
true
if an option of type T
with a specified name exists, false
otherwise. true
if an option with a specified name exists, false
otherwise.We return true
if an option of specified name exists regardless of its type.
|
inline |
A writable reference to the option set's docstring.
|
inline |
A readonly reference to the option set's docstring.
OptionSet::iterator end | ( | ) |
Iterator pointing to the end of the set of options.
OptionSet::const_iterator end | ( | ) | const |
Iterator pointing to the end of the set of options.
const OptionSet::OptionBase & get | ( | const std::string & | name | ) | const |
|
inline |
A writable reference to the option set's name.
|
inline |
A readonly reference to the option set's name.
Addition/Assignment operator. Inserts copies of all options from source
. Any options of the same name already in this
are replaced.
|
inline |
A writable reference to the option set's path.
|
inline |
A readonly reference to the option set's path.
void print | ( | std::ostream & | os = std::cout | ) | const |
Print the contents.
|
inline |
A writable reference to the option set's section.
|
inline |
A readonly reference to the option set's section.
get()
member. OptionSet::OptionBase & set | ( | const std::string & | name | ) |
Convenient method to request a buffer.
LabeledAxisAccessor & set_input | ( | const std::string & | name | ) |
LabeledAxisAccessor & set_output | ( | const std::string & | name | ) |
Convenient method to request a parameter.
|
inline |
|
inline |
A writable reference to the option set's type.
|
inline |
A readonly reference to the option set's type.
|
protected |