Panda3D
Public Types | Public Member Functions
WeakPointerTo< T > Class Template Reference

WeakPointerTo is similar to PointerTo, except that it does not actually prevent the referenced pointer from deleting. More...

#include "weakPointerTo.h"

Inheritance diagram for WeakPointerTo< T >:
WeakPointerToBase< T > WeakPointerToVoid PointerToVoid MemoryBase

List of all members.

Public Types

typedef WeakPointerToBase< T >::To To

Public Member Functions

 WeakPointerTo (To *ptr=(To *) NULL)
 WeakPointerTo (const PointerTo< T > &copy)
 WeakPointerTo (const WeakPointerTo< T > &copy)
void clear ()
 A convenient way to set the PointerTo object to NULL.
To * get_orig () const
 Returns the original pointer value, even if the object has since been deleted.
 operator T * () const
 We also have the typecast operator to automatically convert WeakPointerTo's to the required kind of actual pointer.
To & operator* () const
To * operator-> () const
WeakPointerTo< T > & operator= (To *ptr)
WeakPointerTo< T > & operator= (const PointerTo< T > &copy)
WeakPointerTo< T > & operator= (const WeakPointerTo< T > &copy)
To * p () const
 Returns an ordinary pointer instead of a WeakPointerTo.

Detailed Description

template<class T>
class WeakPointerTo< T >

WeakPointerTo is similar to PointerTo, except that it does not actually prevent the referenced pointer from deleting.

Instead, the referenced pointer is allowed to delete, but if this happens then was_deleted() will return true, and it will be an assertion error to dereference the pointer thereafter.

Definition at line 32 of file weakPointerTo.h.


Member Function Documentation

template<class T>
void WeakPointerTo< T >::clear ( ) [inline]

A convenient way to set the PointerTo object to NULL.

(Assignment to a NULL pointer also works, of course.)

Reimplemented from WeakPointerToBase< T >.

Definition at line 58 of file weakPointerTo.h.

template<class T >
WeakPointerTo< T >::To * WeakPointerTo< T >::get_orig ( ) const [inline]

Returns the original pointer value, even if the object has since been deleted.

Definition at line 113 of file weakPointerTo.I.

template<class T >
WeakPointerTo< T >::operator T * ( ) const [inline]

We also have the typecast operator to automatically convert WeakPointerTo'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 86 of file weakPointerTo.I.

template<class T >
WeakPointerTo< T >::To * WeakPointerTo< T >::p ( ) const [inline]

Returns an ordinary pointer instead of a WeakPointerTo.

Useful to work around compiler problems, particularly for implicit upcasts.

Definition at line 100 of file weakPointerTo.I.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations