Storage

The Storage facility allows one to store key-value pairs for any type of values, the keys are allways strings. Values can be associated with only a key, or with a key and an index, like in an array. There is only one instance of Storage in any given program, namespaces are supported to allow compartimentalization.

Interface

std::string &nameSpace()
Return the current namespace.
void setNameSpace(std::string newNameSpace)
Change to a different namespace.
void clearNameSpace()
Return to the root namespace.
template <class T>
void store(const std::string key, const T value)
Store the given value under the given key.
template <class T>
void store(const std::string key, const T value, unsigned index)
Store the given value under the given key with the specified index.
template <class T>
T &retrieve(std::string key)
Given a key, return the value associated with it.
template <class T>
T &retrieve(std::string key, unsigned index)
Given a key and an index, return the value associated with it.
template <class T>
bool hasKey(const std::string key)
Returns true if a stored value of type T exists for the given key.