22 WeakReferenceList() : _count(_alive_offset) {
30 nassertv(_count == 0);
45 nassertv(callback !=
nullptr);
52 _callbacks.insert(std::make_pair(callback, data));
57 callback->wp_callback(data);
71 nassertv(callback !=
nullptr);
73 _callbacks.erase(callback);
83 void WeakReferenceList::
86 Callbacks::iterator ci;
87 for (ci = _callbacks.begin(); ci != _callbacks.end(); ++ci) {
88 (*ci).first->wp_callback((*ci).second);
100 nassertv(result >= 0);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void add_callback(WeakPointerCallback *callback, void *data)
Adds the callback to the list of callbacks that will be called when the underlying pointer is deleted...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static Integer add(Integer &var, Integer delta)
Atomically computes var += delta.
bool was_deleted() const
Returns true if the object represented has been deleted, ie.
Derive from this class and override the callback() method if you want to get an immediate callback fr...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
~WeakReferenceList()
The destructor tells all of the owned references that we're gone.
void remove_callback(WeakPointerCallback *callback)
Intended to be called only by WeakPointerTo (or by any class implementing a weak reference-counting p...