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

A WeakConstPointerTo is similar to a WeakPointerTo, except it keeps a const pointer to the thing, that will be cleared to NULL when the thing deleted. More...

#include "weakPointerTo.h"

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

Public Types

typedef WeakPointerToBase< T >::To To
 
- Public Types inherited from WeakPointerToBase< T >
typedef T To
 

Public Member Functions

 WeakConstPointerTo (const To *ptr)
 
 WeakConstPointerTo (const PointerTo< T > &copy)
 
 WeakConstPointerTo (const ConstPointerTo< T > &copy)
 
 WeakConstPointerTo (const WeakPointerTo< T > &copy)
 
 WeakConstPointerTo (const WeakConstPointerTo< T > &copy)
 
 WeakConstPointerTo (WeakPointerTo< T > &&from) noexcept
 
 WeakConstPointerTo (WeakConstPointerTo< T > &&from) noexcept
 
template<class Y >
 WeakConstPointerTo (const WeakPointerTo< Y > &r) noexcept
 
template<class Y >
 WeakConstPointerTo (const WeakConstPointerTo< Y > &r) noexcept
 
template<class Y >
 WeakConstPointerTo (const PointerTo< Y > &r) noexcept
 
template<class Y >
 WeakConstPointerTo (const ConstPointerTo< Y > &r) noexcept
 
template<class Y >
 WeakConstPointerTo (WeakPointerTo< Y > &&r) noexcept
 
template<class Y >
 WeakConstPointerTo (WeakConstPointerTo< Y > &&r) noexcept
 
void clear ()
 
const To * get_orig () const
 Returns the original pointer value, even if the object has since been deleted. More...
 
bool is_null () const
 
ConstPointerTo< T > lock () const
 A thread-safe way to access the underlying pointer; will silently return null if the underlying pointer was deleted or null. More...
 
const To & operator * () const
 
const To * operator -> () const
 
 operator const T * () const
 We also have the typecast operator to automatically convert WeakConstPointerTo's to the required kind of actual pointer. More...
 
WeakConstPointerTo< T > & operator= (const To *ptr)
 
WeakConstPointerTo< T > & operator= (const PointerTo< T > &copy)
 
WeakConstPointerTo< T > & operator= (const ConstPointerTo< T > &copy)
 
WeakConstPointerTo< T > & operator= (const WeakPointerTo< T > &copy)
 
WeakConstPointerTo< T > & operator= (const WeakConstPointerTo< T > &copy)
 
WeakConstPointerTo< T > & operator= (WeakPointerTo< T > &&from) noexcept
 
WeakConstPointerTo< T > & operator= (WeakConstPointerTo< T > &&from) noexcept
 
template<class Y >
WeakConstPointerTo< T > & operator= (const WeakPointerTo< Y > &r) noexcept
 
template<class Y >
WeakConstPointerTo< T > & operator= (const WeakConstPointerTo< Y > &r) noexcept
 
template<class Y >
WeakConstPointerTo< T > & operator= (const PointerTo< Y > &r) noexcept
 
template<class Y >
WeakConstPointerTo< T > & operator= (const ConstPointerTo< Y > &r) noexcept
 
template<class Y >
WeakConstPointerTo< T > & operator= (WeakPointerTo< Y > &&r) noexcept
 
template<class Y >
WeakConstPointerTo< T > & operator= (WeakConstPointerTo< Y > &&r) noexcept
 
const To * p () const
 Returns an ordinary pointer instead of a WeakConstPointerTo. More...
 
- Public Member Functions inherited from WeakPointerToBase< T >
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 != (std::nullptr_t) const
 
bool operator != (const WeakPointerToBase< To > &other) const
 
bool operator != (const PointerToBase< To > &other) const
 Returns false if both pointers point to the same object. More...
 
bool operator > (const To *other) const
 
bool operator > (To *other) const
 
bool operator > (std::nullptr_t) const
 
bool operator > (const WeakPointerToBase< To > &other) const
 Defines an ordering between WeakPointerTo based on their raw pointer value. More...
 
bool operator > (const PointerToBase< To > &other) const
 
bool operator >= (const To *other) const
 
bool operator >= (To *other) const
 
bool operator >= (std::nullptr_t) const
 
bool operator >= (const WeakPointerToBase< To > &other) const
 Defines an ordering between WeakPointerTo based on their raw pointer value. More...
 
bool operator >= (const PointerToBase< To > &other) const
 
bool operator< (const To *other) const
 
bool operator< (std::nullptr_t) const
 
bool operator< (const WeakPointerToBase< To > &other) const
 Defines an ordering between WeakPointerTo based on their raw pointer value. More...
 
bool operator< (const PointerToBase< To > &other) const
 
bool operator<= (const To *other) const
 
bool operator<= (To *other) const
 
bool operator<= (std::nullptr_t) const
 
bool operator<= (const WeakPointerToBase< To > &other) const
 Defines an ordering between WeakPointerTo based on their raw pointer value. More...
 
bool operator<= (const PointerToBase< To > &other) const
 
bool operator== (const To *other) const
 
bool operator== (To *other) const
 
bool operator== (std::nullptr_t) const
 
bool operator== (const WeakPointerToBase< To > &other) const
 Returns true if both pointers have the same raw pointer value. More...
 
bool operator== (const PointerToBase< To > &other) const
 Returns true if both pointers point to the same object. More...
 
void output (std::ostream &out) const
 A handy function to output PointerTo's as a hex pointer followed by a reference count. More...
 
template<class Y >
bool owner_before (const WeakPointerToBase< Y > &other) const noexcept
 Defines an ordering that is guaranteed to remain consistent even after the weak pointers have expired. More...
 
template<class Y >
bool owner_before (const PointerToBase< Y > &other) const noexcept
 Defines an ordering that is guaranteed to remain consistent even after this weak pointer has expired. More...
 
void refresh () const
 Informs the WeakPointerTo object that its pointer is no longer deleted. More...
 
- Public Member Functions inherited from WeakPointerToVoid
void add_callback (WeakPointerCallback *callback) const
 Sets a callback that will be made when the pointer is deleted. More...
 
bool is_valid_pointer () const
 Returns true if the pointer is not null and the object has not been deleted. More...
 
void remove_callback (WeakPointerCallback *callback) const
 Removes a previously added callback. 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
 
constexpr 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 WeakConstPointerTo< T >

A WeakConstPointerTo is similar to a WeakPointerTo, except it keeps a const pointer to the thing, that will be cleared to NULL when the thing deleted.

Definition at line 86 of file weakPointerTo.h.

Member Function Documentation

◆ get_orig()

template<class T >
const WeakConstPointerTo< T >::To * WeakConstPointerTo< T >::get_orig ( ) const
inline

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

Definition at line 430 of file weakPointerTo.I.

◆ lock()

template<class T >
ConstPointerTo< T > WeakConstPointerTo< T >::lock ( ) const
inline

A thread-safe way to access the underlying pointer; will silently return null if the underlying pointer was deleted or null.

Since
1.10.0

Definition at line 407 of file weakPointerTo.I.

◆ operator const T *()

template<class T >
WeakConstPointerTo< T >::operator const T * ( ) const
inlineexplicit

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

◆ p()

template<class T >
const WeakConstPointerTo< T >::To * WeakConstPointerTo< T >::p ( ) const
inline

Returns an ordinary pointer instead of a WeakConstPointerTo.

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

Definition at line 419 of file weakPointerTo.I.


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