Panda3D
|
A ConstPointerTo is similar to a PointerTo, except it keeps a const pointer to the thing. More...
#include "pointerTo.h"
Public Types | |
typedef PointerToBase< T >::To | To |
Public Member Functions | |
ConstPointerTo (const To *ptr=(const To *) NULL) | |
ConstPointerTo (const PointerTo< T > ©) | |
ConstPointerTo (const ConstPointerTo< T > ©) | |
void | clear () |
A convenient way to set the PointerTo object to NULL. | |
size_t | get_hash () const |
bool | is_null () const |
Returns true if the PointerTo is a NULL pointer, false otherwise. | |
operator const T * () const | |
We also have the typecast operator to automatically convert ConstPointerTo's to the required kind of actual pointer. | |
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 *ptr) |
void * | operator new (size_t size) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
bool | operator!= (const PointerToVoid &other) const |
const To & | operator* () const |
const To * | operator-> () const |
bool | operator< (const void *other) const |
bool | operator< (const PointerToVoid &other) const |
ConstPointerTo< T > & | operator= (const To *ptr) |
ConstPointerTo< T > & | operator= (const PointerTo< T > ©) |
ConstPointerTo< T > & | operator= (const ConstPointerTo< T > ©) |
bool | operator== (const PointerToVoid &other) const |
void | output (ostream &out) const |
A handy function to output PointerTo's as a hex pointer followed by a reference count. | |
const To * | p () const |
Returns an ordinary pointer instead of a ConstPointerTo. | |
Protected Member Functions | |
void | reassign (To *ptr) |
This is the main work of the PointerTo family. | |
void | reassign (const PointerToBase< To > ©) |
Protected Attributes | |
void * | _void_ptr |
A ConstPointerTo is similar to a PointerTo, except it keeps a const pointer to the thing.
(Actually, it keeps a non-const pointer, because it must be allowed to adjust the reference counts, and it must be able to delete it when the reference count goes to zero. But it presents only a const pointer to the outside world.)
Notice that a PointerTo may be assigned to a ConstPointerTo, but a ConstPointerTo may not be assigned to a PointerTo.
Definition at line 137 of file pointerTo.h.
void ConstPointerTo< T >::clear | ( | ) | [inline] |
A convenient way to set the PointerTo object to NULL.
(Assignment to a NULL pointer also works, of course.)
Reimplemented from PointerToBase< T >.
Definition at line 162 of file pointerTo.h.
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().
ConstPointerTo< T >::operator const T * | ( | ) | const [inline] |
We also have the typecast operator to automatically convert ConstPointerTo'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 204 of file pointerTo.I.
void PointerToBase< T >::output | ( | ostream & | out | ) | const [inline, inherited] |
A handy function to output PointerTo's as a hex pointer followed by a reference count.
Definition at line 138 of file pointerToBase.I.
const ConstPointerTo< T >::To * ConstPointerTo< T >::p | ( | ) | const [inline] |
Returns an ordinary pointer instead of a ConstPointerTo.
Useful to work around compiler problems, particularly for implicit upcasts.
Definition at line 217 of file pointerTo.I.
void PointerToBase< T >::reassign | ( | To * | ptr | ) | [inline, protected, inherited] |
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 58 of file pointerToBase.I.