15 #include "globalPointerRegistry.h"
16 #include "config_util.h"
32 void *GlobalPointerRegistry::
36 <<
"GlobalPointerRegistry::get_pointer() called on empty TypeHandle\n";
38 Pointers::const_iterator pi;
39 pi = _pointers.find(type);
40 if (pi == _pointers.end()) {
56 void GlobalPointerRegistry::
60 <<
"GlobalPointerRegistry::store_pointer() called on empty TypeHandle\n";
62 if (ptr == (
void *)NULL) {
64 <<
"Invalid attempt to store a NULL pointer for " << type <<
"\n";
68 pair<Pointers::iterator, bool> result =
69 _pointers.insert(Pointers::value_type(type, ptr));
73 if ((*result.first).second == ptr) {
75 <<
"Invalid attempt to store pointer " << ptr
76 <<
" twice for " << type <<
"\n";
79 <<
"Invalid attempt to store additional pointer " << ptr
80 <<
" for " << type <<
"; " << (*result.first).second
81 <<
" stored previously.\n";
94 void GlobalPointerRegistry::
98 <<
"GlobalPointerRegistry::clear_pointer() called on empty TypeHandle\n";
103 _pointers.erase(type);
static TypeHandle none()
Returns a special zero-valued TypeHandle that is used to indicate no type.
static void clear_pointer(TypeHandle type)
Removes the association of the given pointer with the indicated TypeHandle.
This class maintains a one-to-one mapping from TypeHandle to a void * pointer.
TypeHandle is the identifier used to differentiate C++ class types.