class Dictionary

This class is frozen, no new features A dictionary interface that objects can implement.

These are automatically mapped to python dictionaries.

Subclassed by rr::BasicDictionary, rr::NLEQ1Interface, rr::NLEQ2Interface

Public Functions

virtual void setItem(const std::string &key, const rr::Setting &value) = 0

Set the value for an arbitrary key.

The Setting object has a large number of creation operators so you only have to give the value as native C++ object i.e.

Dictionary*d = (...);
d->setItem("someIntKey", 1);
d->setItem("someStrKey", std::string("some std::string"));
d->setItem("someFloatVal, 0.123);

virtual Setting getItem(const std::string &key) const = 0

Get a value.

Variants are POD. If the key does not exist, an std::exception will be thrown.

The Setting object has the assigment operator overloaded so it will automatically convert to any native C++ object. If the Setting can not be converted, it will raise an exception, i.e.

Dictionary* d = ...;
int a = d->getItem("someIntKey");
std::string s = d->getItem("someStrVal");
double val = d->getItem("someDoubleVal");

virtual bool hasKey(const std::string &key) const = 0

is there a key matching this name.

virtual size_t deleteItem(const std::string &key) = 0

remove a value

virtual std::vector<std::string> getKeys() const = 0

list of keys in this object.

inline virtual ~Dictionary()

Pure virtual interface, you should never have to delete an instance of this type directly.