OGRE  1.9.0
Ogre::SharedPtr< T > Class Template Reference

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

#include <OgreSharedPtr.h>

Public Member Functions

 SharedPtr ()
 Constructor, does not initialise the SharedPtr.
 
 SharedPtr (const SharedPtr &r)
 
template<class Y>
 SharedPtr (const SharedPtr< Y > &r)
 
template<class Y>
 SharedPtr (Y *rep, SharedPtrFreeMethod inFreeMethod=SPFM_DELETE)
 Constructor.
 
 ~SharedPtr ()
 
void bind (T *rep, SharedPtrFreeMethod inFreeMethod=SPFM_DELETE)
 Binds rep to the SharedPtr.
 
template<typename Y>
SharedPtr< Y > dynamicCast () 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)
 
void setUseCount (unsigned value)
 
template<typename Y>
SharedPtr< Y > staticCast () const
 
bool unique () const
 
unsigned int useCount () const
 

Protected Member Functions

 SharedPtr (T *rep, SharedPtrInfo *info)
 
void destroy (void)
 IF YOU GET A CRASH HERE, YOU FORGOT TO FREE UP POINTERS BEFORE SHUTTING OGRE DOWN Use setNull() before shutdown or make sure your pointer goes out of scope before OGRE shuts down to avoid this.
 
void release (void)
 
void swap (SharedPtr< T > &other)
 

Protected Attributes

SharedPtrInfopInfo
 
T * pRep
 

Static Private Member Functions

static SharedPtrInfocreateInfoForMethod (T *rep, SharedPtrFreeMethod method)
 

Friends

template<typename Y>
class SharedPtr
 

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 117 of file OgreSharedPtr.h.

Constructor & Destructor Documentation

◆ SharedPtr() [1/5]

template<class T>
Ogre::SharedPtr< T >::SharedPtr ( T * rep,
SharedPtrInfo * info )
protected

Definition at line 136 of file OgreSharedPtr.h.

◆ SharedPtr() [2/5]

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

Constructor, does not initialise the SharedPtr.

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

Definition at line 145 of file OgreSharedPtr.h.

◆ SharedPtr() [3/5]

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

Constructor.

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

Definition at line 167 of file OgreSharedPtr.h.

◆ SharedPtr() [4/5]

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

Definition at line 173 of file OgreSharedPtr.h.

◆ SharedPtr() [5/5]

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

Definition at line 207 of file OgreSharedPtr.h.

◆ ~SharedPtr()

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

Definition at line 238 of file OgreSharedPtr.h.

Member Function Documentation

◆ bind()

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

Binds rep to the SharedPtr.

Remarks
Assumes that the SharedPtr is uninitialised!
Warning
The object must not be bound into a SharedPtr elsewhere

Definition at line 273 of file OgreSharedPtr.h.

◆ createInfoForMethod()

template<class T>
static SharedPtrInfo * Ogre::SharedPtr< T >::createInfoForMethod ( T * rep,
SharedPtrFreeMethod method )
staticprivate

Definition at line 149 of file OgreSharedPtr.h.

Referenced by Ogre::SharedPtr< AnimableValue >::bind().

◆ destroy()

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

IF YOU GET A CRASH HERE, YOU FORGOT TO FREE UP POINTERS BEFORE SHUTTING OGRE DOWN Use setNull() before shutdown or make sure your pointer goes out of scope before OGRE shuts down to avoid this.

Definition at line 313 of file OgreSharedPtr.h.

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

◆ dynamicCast()

template<class T>
template<typename Y>
SharedPtr< Y > Ogre::SharedPtr< T >::dynamicCast ( ) const

Definition at line 253 of file OgreSharedPtr.h.

◆ get()

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

Definition at line 264 of file OgreSharedPtr.h.

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

◆ getPointer()

template<class T>
T * Ogre::SharedPtr< T >::getPointer ( ) const

Definition at line 283 of file OgreSharedPtr.h.

◆ isNull()

template<class T>
bool Ogre::SharedPtr< T >::isNull ( void ) const

Definition at line 285 of file OgreSharedPtr.h.

◆ operator*()

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

Definition at line 262 of file OgreSharedPtr.h.

◆ operator->()

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

Definition at line 263 of file OgreSharedPtr.h.

◆ operator=() [1/2]

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

Definition at line 183 of file OgreSharedPtr.h.

◆ operator=() [2/2]

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

Definition at line 224 of file OgreSharedPtr.h.

◆ release()

template<class T>
void Ogre::SharedPtr< T >::release ( void )
protected

◆ setNull()

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

Definition at line 287 of file OgreSharedPtr.h.

◆ setUseCount()

template<class T>
void Ogre::SharedPtr< T >::setUseCount ( unsigned value)

Definition at line 281 of file OgreSharedPtr.h.

◆ staticCast()

template<class T>
template<typename Y>
SharedPtr< Y > Ogre::SharedPtr< T >::staticCast ( ) const

Definition at line 244 of file OgreSharedPtr.h.

◆ swap()

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

◆ unique()

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

Definition at line 279 of file OgreSharedPtr.h.

◆ useCount()

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

Definition at line 280 of file OgreSharedPtr.h.

Friends And Related Symbol Documentation

◆ SharedPtr

template<class T>
template<typename Y>
friend class SharedPtr
friend

Member Data Documentation

◆ pInfo

◆ pRep


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