Panda3D
|
This works exactly like PointerTo, except that the object is designed to be thread-safe: it is generally safe to make unprotected assignments to this pointer, in the sense that the last assignment will win and the reference counts will be properly maintained. More...
#include "threadSafePointerTo.h"
Public Types | |
typedef ThreadSafePointerToBase< T > ::To | To |
Public Member Functions | |
ThreadSafePointerTo (To *ptr=(To *) NULL) | |
ThreadSafePointerTo (const ThreadSafePointerTo< T > ©) | |
void | clear () |
A convenient way to set the ThreadSafePointerTo object to NULL. | |
size_t | get_hash () const |
bool | is_null () const |
Returns true if the PointerTo is a NULL pointer, false otherwise. | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
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) |
operator T * () const | |
We also have the typecast operator to automatically convert ThreadSafePointerTo's to the required kind of actual pointer. | |
bool | operator!= (const PointerToVoid &other) const |
To & | operator* () const |
To * | operator-> () const |
bool | operator< (const PointerToVoid &other) const |
bool | operator< (const void *other) const |
ThreadSafePointerTo< T > & | operator= (const ThreadSafePointerTo< T > ©) |
ThreadSafePointerTo< T > & | operator= (To *ptr) |
bool | operator== (const PointerToVoid &other) const |
void | output (ostream &out) const |
A handy function to output ThreadSafePointerTo's as a hex pointer followed by a reference count. | |
To * | p () const |
Returns an ordinary pointer instead of a ThreadSafePointerTo. | |
Protected Member Functions | |
void | reassign (To *ptr) |
This is the main work of the ThreadSafePointerTo family. | |
void | reassign (const ThreadSafePointerToBase< To > ©) |
Protected Attributes | |
void * | _void_ptr |
This works exactly like PointerTo, except that the object is designed to be thread-safe: it is generally safe to make unprotected assignments to this pointer, in the sense that the last assignment will win and the reference counts will be properly maintained.
Definition at line 30 of file threadSafePointerTo.h.
void ThreadSafePointerTo< T >::clear | ( | ) | [inline] |
A convenient way to set the ThreadSafePointerTo object to NULL.
(Assignment to a NULL pointer also works, of course.)
Reimplemented from ThreadSafePointerToBase< T >.
Definition at line 68 of file threadSafePointerTo.h.
bool ThreadSafePointerTo< T >::is_null | ( | ) | const [inline] |
Returns true if the PointerTo is a NULL pointer, false otherwise.
(Direct comparison to a NULL pointer also works.)
Reimplemented from PointerToVoid.
Definition at line 67 of file threadSafePointerTo.h.
ThreadSafePointerTo< T >::operator T * | ( | ) | const [inline] |
We also have the typecast operator to automatically convert ThreadSafePointerTo's to the required kind of actual pointer.
This introduces ambiguities which the compiler will resolve one way or the other, but we don't care which way it goes because either will be correct.
Definition at line 82 of file threadSafePointerTo.I.
void ThreadSafePointerToBase< T >::output | ( | ostream & | out | ) | const [inline, inherited] |
A handy function to output ThreadSafePointerTo's as a hex pointer followed by a reference count.
Definition at line 148 of file threadSafePointerToBase.I.
ThreadSafePointerTo< T >::To * ThreadSafePointerTo< T >::p | ( | ) | const [inline] |
Returns an ordinary pointer instead of a ThreadSafePointerTo.
Useful to work around compiler problems, particularly for implicit upcasts.
Definition at line 95 of file threadSafePointerTo.I.
void ThreadSafePointerToBase< T >::reassign | ( | To * | ptr | ) | [inline, protected, inherited] |
This is the main work of the ThreadSafePointerTo family.
When the pointer is reassigned, decrement the old reference count and increment the new one.
Definition at line 58 of file threadSafePointerToBase.I.