25 #ifndef INCLUDED_KeyedOwnershipContainer_h_GUID_002CD118_DF06_45AC_44D8_C37BA99E0E93 26 #define INCLUDED_KeyedOwnershipContainer_h_GUID_002CD118_DF06_45AC_44D8_C37BA99E0E93 32 #include <boost/any.hpp> 42 void *doInsert(
void *rawPtr, boost::any smartPtr) {
43 m_container[rawPtr] = smartPtr;
47 bool doReleaseOne(
void *rawPtr) {
49 size_t found = m_container.erase(rawPtr);
54 typedef std::map<void *, boost::any> Container;
55 Container m_container;
62 void *doInsert(
void *rawPtr, boost::any smartPtr) {
63 m_container.insert(std::make_pair(rawPtr, smartPtr));
67 bool doReleaseOne(
void *rawPtr) {
68 auto it = m_container.find(rawPtr);
69 if (m_container.end() != it) {
70 m_container.erase(it);
77 typedef std::multimap<void *, boost::any> Container;
78 Container m_container;
82 template <
typename Policy = SingleOwnershipPolicy>
89 return Policy::doInsert(ptr.get(), ptr);
100 bool release(
void *ptr) {
return Policy::doReleaseOne(ptr); }
110 #endif // INCLUDED_KeyedOwnershipContainer_h_GUID_002CD118_DF06_45AC_44D8_C37BA99E0E93 Definition: RunLoopManager.h:42
void * acquire(T ptr)
Adds an object held by a smart pointer to our ownership, returning its void * usable to release it be...
Definition: KeyedOwnershipContainer.h:88
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Definition: KeyedOwnershipContainer.h:39
Definition: KeyedOwnershipContainer.h:58
bool release(void *ptr)
Releases the indicated smart pointer in our ownership, if we have it.
Definition: KeyedOwnershipContainer.h:100
Holds on to smart pointers by value, and lets you free them by providing the corresponding void *...
Definition: KeyedOwnershipContainer.h:83