NEML2 1.4.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 Types | |
typedef std::map< std::string, std::unique_ptr< OptionBase >, std::less<> > | map_type |
The type of the map that we store internally. | |
typedef map_type::iterator | iterator |
Option map iterator. | |
typedef map_type::const_iterator | const_iterator |
Constant option map iterator. | |
Public Member Functions | |
OptionSet ()=default | |
OptionSet (const OptionSet &) | |
Copy constructor. Deep copy. | |
virtual | ~OptionSet ()=default |
virtual OptionSet & | operator= (const OptionSet &source) |
Assignment operator. Deep copy. | |
virtual void | operator+= (const OptionSet &source) |
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 |
virtual 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 |
template<typename T > | |
T & | set (const std::string &) |
OptionBase & | set (const std::string &) |
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. | |
Protected Attributes | |
struct neml2::OptionSet::Metadata | _metadata |
map_type | _values |
Data structure to map names with values. | |
typedef map_type::const_iterator const_iterator |
Constant option map iterator.
typedef std::map<std::string, std::unique_ptr<OptionBase>, std::less<> > map_type |
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.
|
virtual |
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 | ) |
|
inline |
|
inline |
A writable reference to the option set's type.
|
inline |
A readonly reference to the option set's type.
|
protected |