OGRE  1.8
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::SharedPtr< T > Class Template Reference

Reference-counted shared pointer, used for objects where implicit destruction is required. More...

#include <OgreSharedPtr.h>

+ Collaboration diagram for Ogre::SharedPtr< T >:

Public Member Functions

OGRE_AUTO_SHARED_MUTEX SharedPtr ()
 Constructor, does not initialise the SharedPtr. More...
 
template<class Y >
 SharedPtr (Y *rep, SharedPtrFreeMethod inFreeMethod=SPFM_DELETE)
 Constructor. More...
 
 SharedPtr (const SharedPtr &r)
 
template<class Y >
 SharedPtr (const SharedPtr< Y > &r)
 
virtual ~SharedPtr ()
 
void bind (T *rep, SharedPtrFreeMethod inFreeMethod=SPFM_DELETE)
 Binds rep to the SharedPtr. More...
 
SharedPtrFreeMethod freeMethod () const
 
T * get () const
 
T * getPointer () const
 
bool isNull (void) const
 
T & operator* () const
 
T * operator-> () const
 
SharedPtroperator= (const SharedPtr &r)
 
template<class Y >
SharedPtroperator= (const SharedPtr< Y > &r)
 
void setNull (void)
 
bool unique () const
 
unsigned int useCount () const
 
unsigned int * useCountPointer () const
 

Protected Member Functions

virtual void destroy (void)
 
void release (void)
 
virtual void swap (SharedPtr< T > &other)
 

Protected Attributes

T * pRep
 
unsigned int * pUseCount
 
SharedPtrFreeMethod useFreeMethod
 

Detailed Description

template<class T>
class Ogre::SharedPtr< T >

Reference-counted shared pointer, used for objects where implicit destruction is required.

Remarks
This is a standard shared pointer implementation which uses a reference count to work out when to delete the object.
If OGRE_THREAD_SUPPORT is defined to be 1, use of this class is thread-safe.

Definition at line 60 of file OgreSharedPtr.h.

Constructor & Destructor Documentation

template<class T>
OGRE_AUTO_SHARED_MUTEX Ogre::SharedPtr< T >::SharedPtr ( )
inline

Constructor, does not initialise the SharedPtr.

Remarks
Dangerous! You have to call bind() before using the SharedPtr.

Definition at line 72 of file OgreSharedPtr.h.

template<class T>
template<class Y >
Ogre::SharedPtr< T >::SharedPtr ( Y *  rep,
SharedPtrFreeMethod  inFreeMethod = SPFM_DELETE 
)
inlineexplicit

Constructor.

Parameters
repThe pointer to take ownership of
freeModeThe mechanism to use to free the pointer

Definition at line 82 of file OgreSharedPtr.h.

template<class T>
Ogre::SharedPtr< T >::SharedPtr ( const SharedPtr< T > &  r)
inline

Definition at line 93 of file OgreSharedPtr.h.

template<class T>
template<class Y >
Ogre::SharedPtr< T >::SharedPtr ( const SharedPtr< Y > &  r)
inline

Definition at line 124 of file OgreSharedPtr.h.

template<class T>
virtual Ogre::SharedPtr< T >::~SharedPtr ( )
inlinevirtual

Definition at line 154 of file OgreSharedPtr.h.

Member Function Documentation

template<class T>
void Ogre::SharedPtr< T >::bind ( T *  rep,
SharedPtrFreeMethod  inFreeMethod = SPFM_DELETE 
)
inline

Binds rep to the SharedPtr.

Remarks
Assumes that the SharedPtr is uninitialised!

Definition at line 167 of file OgreSharedPtr.h.

template<class T>
virtual void Ogre::SharedPtr< T >::destroy ( void  )
inlineprotectedvirtual

Reimplemented in Ogre::MeshPtr.

Definition at line 223 of file OgreSharedPtr.h.

Referenced by Ogre::SharedPtr< D3D11GpuProgram >::release().

template<class T>
SharedPtrFreeMethod Ogre::SharedPtr< T >::freeMethod ( ) const
inline

Definition at line 181 of file OgreSharedPtr.h.

Referenced by Ogre::SharedPtr< D3D11GpuProgram >::SharedPtr().

template<class T>
T* Ogre::SharedPtr< T >::get ( void  ) const
inline

Definition at line 161 of file OgreSharedPtr.h.

Referenced by Ogre::operator!=(), and Ogre::operator==().

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

Definition at line 159 of file OgreSharedPtr.h.

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

Definition at line 160 of file OgreSharedPtr.h.

template<class T>
SharedPtr& Ogre::SharedPtr< T >::operator= ( const SharedPtr< T > &  r)
inline

Definition at line 113 of file OgreSharedPtr.h.

template<class T>
template<class Y >
SharedPtr& Ogre::SharedPtr< T >::operator= ( const SharedPtr< Y > &  r)
inline

Definition at line 145 of file OgreSharedPtr.h.

template<class T>
void Ogre::SharedPtr< T >::release ( void  )
inlineprotected
template<class T>
void Ogre::SharedPtr< T >::setNull ( void  )
inline

Definition at line 185 of file OgreSharedPtr.h.

template<class T>
virtual void Ogre::SharedPtr< T >::swap ( SharedPtr< T > &  other)
inlineprotectedvirtual

Definition at line 247 of file OgreSharedPtr.h.

Referenced by Ogre::SharedPtr< D3D11GpuProgram >::operator=().

template<class T>
bool Ogre::SharedPtr< T >::unique ( ) const
inline

Definition at line 176 of file OgreSharedPtr.h.

template<class T>
unsigned int Ogre::SharedPtr< T >::useCount ( ) const
inline

Definition at line 177 of file OgreSharedPtr.h.

Member Data Documentation


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