FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
FIFE::SharedPtr< T > Class Template Reference

#include <sharedptr.h>

Inheritance diagram for FIFE::SharedPtr< T >:
Inheritance graph
Collaboration diagram for FIFE::SharedPtr< T >:
Collaboration graph

Public Member Functions

 SharedPtr ()
 
template<typename U >
 SharedPtr (U *ptr)
 
 SharedPtr (const SharedPtr &rhs)
 
template<typename U >
 SharedPtr (const SharedPtr< U > &rhs)
 
 ~SharedPtr ()
 
SharedPtroperator= (const SharedPtr &rhs)
 
template<typename U >
SharedPtroperator= (const SharedPtr< U > &rhs)
 
T & operator* () const
 
T * operator-> () const
 
T * get () const
 
void reset (T *ptr=0)
 
uint32_t useCount () const
 
uint32_t * useCountPtr () const
 
bool unique () const
 
 operator bool () const
 
bool operator! () const
 

Detailed Description

template<typename T>
class FIFE::SharedPtr< T >

shared pointer implementation to provide automatic reference counting and deletion when last reference falls out of scope.

Definition at line 42 of file sharedptr.h.

Constructor & Destructor Documentation

template<typename T>
FIFE::SharedPtr< T >::SharedPtr ( )
inline

Constructor default constructor creates a null shared pointer

Definition at line 49 of file sharedptr.h.

template<typename T>
template<typename U >
FIFE::SharedPtr< T >::SharedPtr ( U *  ptr)
inlineexplicit

Constructor takes over ownership of the provided pointer and will delete it automatically when last reference falls out of scope.

Definition at line 60 of file sharedptr.h.

template<typename T>
FIFE::SharedPtr< T >::SharedPtr ( const SharedPtr< T > &  rhs)
inline

Copy Constructor provides ability to properly copy a shared resource

Definition at line 68 of file sharedptr.h.

template<typename T>
template<typename U >
FIFE::SharedPtr< T >::SharedPtr ( const SharedPtr< U > &  rhs)
inline

Constructor shares ownership with the value passed into rhs the pointer type passed in must be convertible to this shared pointer type

Definition at line 80 of file sharedptr.h.

template<typename T>
FIFE::SharedPtr< T >::~SharedPtr ( )
inline

Destructor handles deletion of underlying pointer if the reference count reaches 0

Definition at line 90 of file sharedptr.h.

Member Function Documentation

template<typename T>
FIFE::SharedPtr< T >::operator bool ( ) const
inline

provides the ability to convert a shared pointer to a bool, this is a convenience for checking validity of a shared pointer in a conditional

Definition at line 207 of file sharedptr.h.

template<typename T>
bool FIFE::SharedPtr< T >::operator! ( ) const
inline

negation operator overload

Definition at line 213 of file sharedptr.h.

template<typename T>
T& FIFE::SharedPtr< T >::operator* ( ) const
inline

allows dereferencing of shared pointer to act identical to dereferencing the underlying pointer

Definition at line 140 of file sharedptr.h.

template<typename T>
T* FIFE::SharedPtr< T >::operator-> ( ) const
inline

allows dereferencing of shared pointer to act identical to dereferencing the underlying pointer

Definition at line 148 of file sharedptr.h.

template<typename T>
SharedPtr& FIFE::SharedPtr< T >::operator= ( const SharedPtr< T > &  rhs)
inline

provides functionality for the equality operator

Definition at line 106 of file sharedptr.h.

template<typename T>
template<typename U >
SharedPtr& FIFE::SharedPtr< T >::operator= ( const SharedPtr< U > &  rhs)
inline

provides functionality for the equality operator the passed in pointer type must be convertible to this pointer type

Definition at line 124 of file sharedptr.h.

template<typename T>
void FIFE::SharedPtr< T >::reset ( T *  ptr = 0)
inline

reset this pointer to a null shared pointer this can be used to lower the reference count of the shared resource or set the underlying pointer to different pointer.

Definition at line 164 of file sharedptr.h.

Referenced by FIFE::SoundEmitter::reset(), FIFE::Cursor::resetDrag(), FIFE::Camera::resetOverlayAnimation(), FIFE::Cursor::set(), and FIFE::Cursor::setDrag().

Here is the caller graph for this function:

template<typename T>
bool FIFE::SharedPtr< T >::unique ( ) const
inline

provides the ability to see if a shared resource is currently only held by a single shared pointer this should only be called on a non-null shared pointer

Definition at line 197 of file sharedptr.h.

template<typename T>
uint32_t FIFE::SharedPtr< T >::useCount ( ) const
inline

returns the current reference count this should only be called on a non-null shared pointer

Definition at line 173 of file sharedptr.h.

template<typename T>
uint32_t* FIFE::SharedPtr< T >::useCountPtr ( ) const
inline

returns the current reference count provides direct access to the user count pointer this should really only be used internally

Definition at line 187 of file sharedptr.h.

Referenced by FIFE::SharedPtr< RenderTarget >::SharedPtr().

Here is the caller graph for this function:


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