OSVR-Core
|
A data structure storing "any" by name, to reduce coupling. More...
#include <AnyMap.h>
Public Member Functions | |
OSVR_UTIL_EXPORT bool | contains (std::string const &key) const |
Do we have data under this key? More... | |
OSVR_UTIL_EXPORT bool | contains (const char *key) const |
OSVR_UTIL_EXPORT boost::any | get (std::string const &key) const |
Get the data for this key. More... | |
OSVR_UTIL_EXPORT boost::any | get (const char *key) const |
OSVR_UTIL_EXPORT void | erase (std::string const &key) |
Clears the data for this key. More... | |
OSVR_UTIL_EXPORT void | erase (const char *key) |
OSVR_UTIL_EXPORT void | set (std::string const &key, boost::any const &value) |
Set data for the given key. More... | |
OSVR_UTIL_EXPORT void | set (const char *key, boost::any const &value) |
template<typename T > | |
void | set (std::string const &key, T value) |
template<typename T > | |
void | set (const char *key, T value) |
A data structure storing "any" by name, to reduce coupling.
bool osvr::util::AnyMap::contains | ( | std::string const & | key | ) | const |
Do we have data under this key?
All the const char * overloads are in case we change the internal representation to something that works faster with string literals.
bool osvr::util::AnyMap::contains | ( | const char * | key | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void osvr::util::AnyMap::erase | ( | std::string const & | key | ) |
Clears the data for this key.
If the key doesn't exist, this method does nothing
void osvr::util::AnyMap::erase | ( | const char * | key | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
boost::any osvr::util::AnyMap::get | ( | std::string const & | key | ) | const |
Get the data for this key.
Returns an empty boost::any if the key doesn't exist.
boost::any osvr::util::AnyMap::get | ( | const char * | key | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void osvr::util::AnyMap::set | ( | std::string const & | key, |
boost::any const & | value | ||
) |
Set data for the given key.
Silently overwrites existing data at that key.