Panda3D
Public Types | Public Member Functions
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

List of all members.

Public Types

typedef PointerToBase< T >::To To

Public Member Functions

 PointerTo (To *ptr=(To *) NULL)
 PointerTo (const PointerTo< T > &copy)
void clear ()
 A convenient way to set the PointerTo object to NULL.
bool is_null () const
 Returns true if the PointerTo is a NULL pointer, false otherwise.
 operator T * () const
 We also have the typecast operator to automatically convert PointerTo's to the required kind of actual pointer.
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.

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

template<class T>
void PointerTo< 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 117 of file pointerTo.h.

template<class T>
bool PointerTo< T >::is_null ( ) const [inline]

Returns true if the PointerTo is a NULL pointer, false otherwise.

(Direct comparison to a NULL pointer also works.)

Reimplemented from PointerToVoid.

Definition at line 116 of file pointerTo.h.

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 82 of file pointerTo.I.

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 95 of file pointerTo.I.


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