Panda3D
|
This is the base class for PointerTo and ConstPointerTo. More...
#include "weakPointerToBase.h"
Public Types | |
typedef T | To |
Public Member Functions | |
void | clear () |
A convenient way to set the PointerTo object to NULL. | |
WeakPointerCallback * | get_callback () const |
Returns the callback that will be made when the pointer is deleted, or NULL if no callback has been set. | |
size_t | get_hash () const |
bool | is_null () const |
Returns true if the PointerTo is a NULL pointer, false otherwise. | |
bool | is_valid_pointer () const |
Returns true if the pointer is not null and the object has not been deleted. | |
void | mark_deleted () |
This is intended only to be called by the WeakPointerList destructor. | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *, void *) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new[] (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
bool | operator!= (const PointerToBase< To > &other) const |
bool | operator!= (const PointerToVoid &other) const |
bool | operator!= (const To *other) const |
bool | operator!= (const WeakPointerToBase< To > &other) const |
bool | operator!= (To *other) const |
bool | operator< (const void *other) const |
bool | operator< (const PointerToVoid &other) const |
bool | operator< (const To *other) const |
bool | operator< (const PointerToBase< To > &other) const |
bool | operator< (const WeakPointerToBase< To > &other) const |
bool | operator<= (const To *other) const |
bool | operator<= (To *other) const |
bool | operator<= (const PointerToBase< To > &other) const |
bool | operator<= (const WeakPointerToBase< To > &other) const |
bool | operator== (const PointerToVoid &other) const |
bool | operator== (const PointerToBase< To > &other) const |
bool | operator== (const To *other) const |
bool | operator== (To *other) const |
bool | operator== (const WeakPointerToBase< To > &other) const |
bool | operator> (const PointerToBase< To > &other) const |
bool | operator> (To *other) const |
bool | operator> (const To *other) const |
bool | operator> (const WeakPointerToBase< To > &other) const |
bool | operator>= (const WeakPointerToBase< To > &other) const |
bool | operator>= (const PointerToBase< To > &other) const |
bool | operator>= (const To *other) const |
bool | operator>= (To *other) const |
void | output (ostream &out) const |
A handy function to output PointerTo's as a hex pointer followed by a reference count. | |
void | refresh () const |
Informs the WeakPointerTo object that its pointer is no longer deleted. | |
void | set_callback (WeakPointerCallback *callback) |
Sets a callback that will be made when the pointer is deleted. | |
bool | was_deleted () const |
Returns true if the object we are pointing to has been deleted, false otherwise. | |
Protected Member Functions | |
WeakPointerToBase (To *ptr) | |
WeakPointerToBase (const PointerToBase< T > ©) | |
WeakPointerToBase (const WeakPointerToBase< T > ©) | |
void | reassign (const WeakPointerToBase< To > ©) |
void | reassign (const PointerToBase< To > ©) |
void | reassign (To *ptr) |
This is the main work of the PointerTo family. | |
Protected Attributes | |
WeakPointerCallback * | _callback |
bool | _ptr_was_deleted |
void * | _void_ptr |
This is the base class for PointerTo and ConstPointerTo.
Don't try to use it directly; use either derived class instead.
Definition at line 29 of file weakPointerToBase.h.
void WeakPointerToBase< T >::clear | ( | ) | [inline] |
A convenient way to set the PointerTo object to NULL.
(Assignment to a NULL pointer also works, of course.)
Reimplemented in WeakPointerTo< T >, and WeakConstPointerTo< T >.
Definition at line 394 of file weakPointerToBase.I.
WeakPointerCallback * WeakPointerToVoid::get_callback | ( | ) | const [inline, inherited] |
Returns the callback that will be made when the pointer is deleted, or NULL if no callback has been set.
Definition at line 79 of file weakPointerToVoid.I.
bool PointerToVoid::is_null | ( | ) | const [inline, inherited] |
Returns true if the PointerTo is a NULL pointer, false otherwise.
(Direct comparison to a NULL pointer also works.)
Reimplemented in PointerTo< T >, ThreadSafePointerTo< T >, and WeakConstPointerTo< T >.
Definition at line 54 of file pointerToVoid.I.
Referenced by TexturePeeker::is_valid().
bool WeakPointerToVoid::is_valid_pointer | ( | ) | const [inline, inherited] |
Returns true if the pointer is not null and the object has not been deleted.
Definition at line 101 of file weakPointerToVoid.I.
void WeakPointerToVoid::mark_deleted | ( | ) | [inline, inherited] |
This is intended only to be called by the WeakPointerList destructor.
It indicates that the object that we were pointing to has just been deleted.
Definition at line 45 of file weakPointerToVoid.I.
void WeakPointerToBase< T >::output | ( | ostream & | out | ) | const [inline] |
A handy function to output PointerTo's as a hex pointer followed by a reference count.
Definition at line 424 of file weakPointerToBase.I.
void WeakPointerToBase< T >::reassign | ( | To * | ptr | ) | [protected] |
This is the main work of the PointerTo family.
When the pointer is reassigned, decrement the old reference count and increment the new one.
Definition at line 69 of file weakPointerToBase.I.
References TypeHandle::none().
void WeakPointerToBase< T >::refresh | ( | ) | const [inline] |
Informs the WeakPointerTo object that its pointer is no longer deleted.
This may be used after a WeakPointerTo has deleted a deleted pointer, and then a new pointer has been reallocated. It's equivalent to simply reassigning the pointer to its new (i.e. original) value, but has the advantage that it is const, so can be used for WeakPointers used as keys in STL maps and sets.
Definition at line 412 of file weakPointerToBase.I.
void WeakPointerToVoid::set_callback | ( | WeakPointerCallback * | callback | ) | [inline, inherited] |
Sets a callback that will be made when the pointer is deleted.
If a previous callback has already been set, it will be replaced.
If the pointer has already been deleted, the callback will be made immediately.
Definition at line 64 of file weakPointerToVoid.I.
bool WeakPointerToVoid::was_deleted | ( | ) | const [inline, inherited] |
Returns true if the object we are pointing to has been deleted, false otherwise.
Definition at line 90 of file weakPointerToVoid.I.