28 void *GlobalPointerRegistry::
30 if (type == TypeHandle::none()) {
32 <<
"GlobalPointerRegistry::get_pointer() called on empty TypeHandle\n";
34 Pointers::const_iterator pi;
35 pi = _pointers.find(type);
36 if (pi == _pointers.end()) {
48 void GlobalPointerRegistry::
50 if (type == TypeHandle::none()) {
52 <<
"GlobalPointerRegistry::store_pointer() called on empty TypeHandle\n";
56 <<
"Invalid attempt to store a NULL pointer for " << type <<
"\n";
60 std::pair<Pointers::iterator, bool> result =
61 _pointers.insert(Pointers::value_type(type, ptr));
65 if ((*result.first).second == ptr) {
67 <<
"Invalid attempt to store pointer " << ptr
68 <<
" twice for " << type <<
"\n";
71 <<
"Invalid attempt to store additional pointer " << ptr
72 <<
" for " << type <<
"; " << (*result.first).second
73 <<
" stored previously.\n";
83 void GlobalPointerRegistry::
85 if (type == TypeHandle::none()) {
87 <<
"GlobalPointerRegistry::clear_pointer() called on empty TypeHandle\n";
92 _pointers.erase(type);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void clear_pointer(TypeHandle type)
Removes the association of the given pointer with the indicated TypeHandle.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class maintains a one-to-one mapping from TypeHandle to a void * pointer.
TypeHandle is the identifier used to differentiate C++ class types.