Panda3D
Public Types | Public Member Functions | List of all members
WeakPointerToBase< T > Class Template Reference

This is the base class for PointerTo and ConstPointerTo. More...

#include "weakPointerToBase.h"

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

Public Types

typedef T To
 

Public Member Functions

void clear ()
 A convenient way to set the PointerTo object to NULL. More...
 
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< (const 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
 
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
 
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
 
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
 
bool operator>= (const WeakPointerToBase< To > &other) const
 
bool operator>= (const PointerToBase< To > &other) const
 
void output (ostream &out) const
 A handy function to output PointerTo's as a hex pointer followed by a reference count. More...
 
void refresh () const
 Informs the WeakPointerTo object that its pointer is no longer deleted. More...
 
- Public Member Functions inherited from WeakPointerToVoid
WeakPointerCallbackget_callback () const
 Returns the callback that will be made when the pointer is deleted, or NULL if no callback has been set. More...
 
bool is_valid_pointer () const
 Returns true if the pointer is not null and the object has not been deleted. More...
 
void mark_deleted ()
 This is intended only to be called by the WeakPointerList destructor. More...
 
void set_callback (WeakPointerCallback *callback)
 Sets a callback that will be made when the pointer is deleted. More...
 
bool was_deleted () const
 Returns true if the object we are pointing to has been deleted, false otherwise. More...
 
- Public Member Functions inherited from PointerToVoid
size_t get_hash () const
 
bool is_null () const
 Returns true if the PointerTo is a NULL pointer, false otherwise. More...
 
bool operator!= (const PointerToVoid &other) const
 
bool operator< (const void *other) const
 
bool operator< (const PointerToVoid &other) const
 
bool operator== (const PointerToVoid &other) const
 
void swap (PointerToVoid &other) NOEXCEPT
 Swaps the contents of this PointerTo with the other, without touching the reference counts. More...
 

Detailed Description

template<class T>
class WeakPointerToBase< T >

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.

Member Function Documentation

◆ clear()

template<class T >
void WeakPointerToBase< T >::clear ( )
inline

A convenient way to set the PointerTo object to NULL.

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

Definition at line 400 of file weakPointerToBase.I.

References WeakPointerToBase< T >::refresh().

◆ output()

template<class T >
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 430 of file weakPointerToBase.I.

Referenced by WeakPointerToBase< T >::refresh().

◆ refresh()

template<class T >
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 418 of file weakPointerToBase.I.

References WeakPointerToBase< T >::output().

Referenced by WeakPointerToBase< T >::clear().


The documentation for this class was generated from the following files: