UQTk: Uncertainty Quantification Toolkit 3.1.5
RefPtr< T > Class Template Reference

#include <RefPtr.h>

Public Types

typedef T Type
 Make the typename that this pointer holds accessible to other objects.
 

Public Member Functions

 RefPtr ()
 Construct a new RefPtr and initialize the pointee to NULL.
 
 RefPtr (T *p)
 Construct a new RefPtr and initialize the pointee as given.
 
 RefPtr (const RefPtr< T > &p)
 Construct a new RefPtr and initialize to the given RefPtr pointee.
 
template<class Other >
 RefPtr (RefPtr< Other > p)
 
 ~RefPtr ()
 Destroy this RefPtr.
 
RefPtr< T > & operator= (T *p)
 Assign the value of this RefPtr to the given pointee.
 
RefPtr< T > & operator= (const RefPtr< T > &p)
 Assign the value of this RefPtr to the pointee of the given RefPtr.
 
template<class Other >
RefPtr< T > & cast (Other *p)
 
template<class Other >
RefPtr< T > & cast (RefPtr< Other > p)
 
T * operator-> () const
 
T & operator* () const
 
T * pointee ()
 Return the pointee of this RefPtr.
 
const T * pointee () const
 Return the pointee of this RefPtr in a const context.
 
bool operator== (const T *p) const
 Compare the pointee of this RefPtr with the given pointer.
 
bool operator== (const RefPtr< T > &p) const
 Compare the value of this pointee with the pointee of the given RefPtr.
 
bool operator!= (const T *p) const
 Test inequality.
 
bool operator!= (const RefPtr< T > &p) const
 Test inequality.
 
bool operator< (const RefPtr< T > &p) const
 Convenience routine to sort pointer values in standard containers.
 
template<class Other >
bool operator< (const RefPtr< Other > &p) const
 Convenience routine to sort pointer values in standard containers.
 

Private Member Functions

void grab ()
 Grab a reference to the current pointee if it is not NULL.
 
void release ()
 

Private Attributes

T * ptr_
 

Detailed Description

template<class T>
class RefPtr< T >

Reference counted pointer that gives the holder modification privileges to the pointee.

Part of the Particle Simulation Toolkit (pst)

Member Typedef Documentation

◆ Type

template<class T >
T RefPtr< T >::Type

Make the typename that this pointer holds accessible to other objects.

Constructor & Destructor Documentation

◆ RefPtr() [1/4]

template<class T >
RefPtr< T >::RefPtr ( )
inline

Construct a new RefPtr and initialize the pointee to NULL.

◆ RefPtr() [2/4]

template<class T >
RefPtr< T >::RefPtr ( T * p)
inline

Construct a new RefPtr and initialize the pointee as given.

◆ RefPtr() [3/4]

template<class T >
RefPtr< T >::RefPtr ( const RefPtr< T > & p)
inline

Construct a new RefPtr and initialize to the given RefPtr pointee.

◆ RefPtr() [4/4]

template<class T >
template<class Other >
RefPtr< T >::RefPtr ( RefPtr< Other > p)
inline

Perform a static cast to initialize this pointee. This cast is only valid if T is a parent class of Other

◆ ~RefPtr()

template<class T >
RefPtr< T >::~RefPtr ( )
inline

Destroy this RefPtr.

Member Function Documentation

◆ cast() [1/2]

template<class T >
template<class Other >
RefPtr< T > & RefPtr< T >::cast ( Other * p)
inline

Use dynamic_cast to set the pointee to the pointer that was passed in, and return *this. The returned value is NULL if the cast fails.

◆ cast() [2/2]

template<class T >
template<class Other >
RefPtr< T > & RefPtr< T >::cast ( RefPtr< Other > p)
inline

Use dynamic_cast to set the pointee to the pointee of the RefPtr given, and return *this. The returned value is NULL if the cast fails.

◆ grab()

template<class T >
void RefPtr< T >::grab ( )
inlineprivate

Grab a reference to the current pointee if it is not NULL.

◆ operator!=() [1/2]

template<class T >
bool RefPtr< T >::operator!= ( const RefPtr< T > & p) const
inline

Test inequality.

◆ operator!=() [2/2]

template<class T >
bool RefPtr< T >::operator!= ( const T * p) const
inline

Test inequality.

◆ operator*()

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

Return a reference to the pointee of this RefPtr. This will not work right if the pointee is NULL.

◆ operator->()

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

Return the pointee of this RefPtr. This will throw an exception if the pointee is NULL.

◆ operator<() [1/2]

template<class T >
template<class Other >
bool RefPtr< T >::operator< ( const RefPtr< Other > & p) const
inline

Convenience routine to sort pointer values in standard containers.

◆ operator<() [2/2]

template<class T >
bool RefPtr< T >::operator< ( const RefPtr< T > & p) const
inline

Convenience routine to sort pointer values in standard containers.

◆ operator=() [1/2]

template<class T >
RefPtr< T > & RefPtr< T >::operator= ( const RefPtr< T > & p)
inline

Assign the value of this RefPtr to the pointee of the given RefPtr.

◆ operator=() [2/2]

template<class T >
RefPtr< T > & RefPtr< T >::operator= ( T * p)
inline

Assign the value of this RefPtr to the given pointee.

◆ operator==() [1/2]

template<class T >
bool RefPtr< T >::operator== ( const RefPtr< T > & p) const
inline

Compare the value of this pointee with the pointee of the given RefPtr.

◆ operator==() [2/2]

template<class T >
bool RefPtr< T >::operator== ( const T * p) const
inline

Compare the pointee of this RefPtr with the given pointer.

◆ pointee() [1/2]

template<class T >
T * RefPtr< T >::pointee ( )
inline

Return the pointee of this RefPtr.

◆ pointee() [2/2]

template<class T >
const T * RefPtr< T >::pointee ( ) const
inline

Return the pointee of this RefPtr in a const context.

◆ release()

template<class T >
void RefPtr< T >::release ( )
inlineprivate

Release the reference to the current pointee if it is not NULL. If this results in the reference count of the pointee dropping to zero, delete the object pointed to.

Member Data Documentation

◆ ptr_

template<class T >
T* RefPtr< T >::ptr_
private

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