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

PointerTo is a template class which implements a smart pointer to an object derived from ReferenceCount. More...

#include "pointerTo.h"

Inheritance diagram for PointerTo< T >:
PointerToBase< T > PointerToVoid MemoryBase

Public Types

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

Public Member Functions

 PointerTo (To *ptr=(To *) NULL)
 
 PointerTo (const PointerTo< T > &copy)
 
T *& cheat ()
 Returns a reference to the underlying pointer. More...
 
void clear ()
 
bool is_null () const
 
 operator T* () const
 We also have the typecast operator to automatically convert PointerTo's to the required kind of actual pointer. More...
 
To & operator* () const
 
To * operator-> () const
 
PointerTo< T > & operator= (To *ptr)
 
PointerTo< T > & operator= (const PointerTo< T > &copy)
 
To * p () const
 Returns an ordinary pointer instead of a PointerTo. More...
 
- Public Member Functions inherited from PointerToBase< T >
void clear ()
 A convenient way to set the PointerTo object to NULL. More...
 
void output (ostream &out) const
 A handy function to output PointerTo's as a hex pointer followed by a reference count. 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 PointerTo< T >

PointerTo is a template class which implements a smart pointer to an object derived from ReferenceCount.

Definition at line 79 of file pointerTo.h.

Member Function Documentation

◆ cheat()

template<class T >
T *& PointerTo< T >::cheat ( )
inline

Returns a reference to the underlying pointer.

This is a very unsafe method. It's only used by some interrogate code. If you think this method might be useful to you, you're probably wrong.

Promise me you won't use this, okay?

Definition at line 124 of file pointerTo.I.

Referenced by PointerTo< T >::operator T*().

◆ operator T*()

template<class T >
PointerTo< T >::operator T* ( ) const
inline

We also have the typecast operator to automatically convert PointerTo'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 108 of file pointerTo.I.

References PointerTo< T >::cheat().

◆ p()

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

Returns an ordinary pointer instead of a PointerTo.

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

Definition at line 137 of file pointerTo.I.

Referenced by PointerTo< Multifile >::cheat().


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