OGRE  2.0
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 <OgrePrerequisites.h>

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

Public Member Functions

 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)
 
 ~SharedPtr ()
 
void bind (T *rep, SharedPtrFreeMethod inFreeMethod=SPFM_DELETE)
 Binds rep to the SharedPtr. More...
 
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. More...
 
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<typename 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 346 of file OgrePrerequisites.h.

Constructor & Destructor Documentation

template<typename T>
Ogre::SharedPtr< T >::SharedPtr ( T *  rep,
SharedPtrInfo info 
)
inlineprotected

Definition at line 130 of file OgreSharedPtr.h.

template<typename T>
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 139 of file OgreSharedPtr.h.

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

Constructor.

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

Definition at line 160 of file OgreSharedPtr.h.

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

Definition at line 166 of file OgreSharedPtr.h.

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

Definition at line 200 of file OgreSharedPtr.h.

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

Definition at line 228 of file OgreSharedPtr.h.

Member Function Documentation

template<typename 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!
Warning
The object must not be bound into a SharedPtr elsewhere

Definition at line 263 of file OgreSharedPtr.h.

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

Definition at line 143 of file OgreSharedPtr.h.

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

template<typename T>
void Ogre::SharedPtr< T >::destroy ( void  )
inlineprotected

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

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

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

Definition at line 243 of file OgreSharedPtr.h.

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

Definition at line 254 of file OgreSharedPtr.h.

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

Definition at line 273 of file OgreSharedPtr.h.

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

Definition at line 275 of file OgreSharedPtr.h.

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

Definition at line 252 of file OgreSharedPtr.h.

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

Definition at line 253 of file OgreSharedPtr.h.

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

Definition at line 176 of file OgreSharedPtr.h.

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

Definition at line 217 of file OgreSharedPtr.h.

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

Definition at line 277 of file OgreSharedPtr.h.

Referenced by Ogre::D3D11HLSLProgram::BufferInfo::BufferInfo().

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

Definition at line 271 of file OgreSharedPtr.h.

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

Definition at line 234 of file OgreSharedPtr.h.

template<typename T>
void Ogre::SharedPtr< T >::swap ( SharedPtr< T > &  other)
inlineprotected

Definition at line 309 of file OgreSharedPtr.h.

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

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

Definition at line 269 of file OgreSharedPtr.h.

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

Definition at line 270 of file OgreSharedPtr.h.

Friends And Related Function Documentation

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

Definition at line 113 of file OgreSharedPtr.h.

Member Data Documentation


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