OSVR-Core
Public Member Functions | List of all members
osvr::util::AnyMap Class Reference

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)
 

Detailed Description

A data structure storing "any" by name, to reduce coupling.

Member Function Documentation

§ contains() [1/2]

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.

§ contains() [2/2]

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.

§ erase() [1/2]

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

§ erase() [2/2]

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.

§ get() [1/2]

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.

§ get() [2/2]

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.

§ set()

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.


The documentation for this class was generated from the following files: