Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::SharedPtr< T > Class Template Reference

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

#include <OgreSharedPtr.h>

List of all members.

Public Methods

 SharedPtr ()
 Constructor, does not initialise the SharedPtr.

 SharedPtr (T *rep)
 SharedPtr (const SharedPtr &r)
SharedPtr & operator= (const SharedPtr &r)
virtual ~SharedPtr ()
T & operator * () const
T * operator-> () const
T * get () const
void bind (T *rep)
 Binds rep to the SharedPtr.

bool unique () const
unsigned int useCount () const
T * getPointer () const
bool isNull (void) const
void setNull (void)

Protected Methods

void release (void)
virtual void destroy (void)

Protected Attributes

T * pRep
unsigned int * pUseCount


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. OGRE does not use this class very often, because it is usually more efficient to make the destruction of objects more intentional (in blocks, say). However in some cases you really cannot tell how many people are using an object, and this approach is worthwhile (e.g. ControllerValue)

Definition at line 42 of file OgreSharedPtr.h.


Constructor & Destructor Documentation

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

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

Definition at line 52 of file OgreSharedPtr.h.

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

Definition at line 53 of file OgreSharedPtr.h.

template<class T>
virtual Ogre::SharedPtr< T >::~SharedPtr   [virtual]
 

Definition at line 72 of file OgreSharedPtr.h.


Member Function Documentation

template<class T>
void Ogre::SharedPtr< T >::bind T *    rep
 

Binds rep to the SharedPtr.

Remarks:
Assumes that the SharedPtr is uninitialised!

Definition at line 85 of file OgreSharedPtr.h.

Referenced by Ogre::ControllerManager::createGpuProgramTimerParam(), Ogre::ControllerManager::createTextureRotater(), Ogre::ControllerManager::createTextureScroller(), and Ogre::ControllerManager::createTextureWaveTransformer().

template<class T>
virtual void Ogre::SharedPtr< T >::destroy void    [protected, virtual]
 

Definition at line 115 of file OgreSharedPtr.h.

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

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

Definition at line 79 of file OgreSharedPtr.h.

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

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

Definition at line 94 of file OgreSharedPtr.h.

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

Definition at line 96 of file OgreSharedPtr.h.

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

Definition at line 77 of file OgreSharedPtr.h.

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

Definition at line 78 of file OgreSharedPtr.h.

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

Definition at line 60 of file OgreSharedPtr.h.

template<class T>
void Ogre::SharedPtr< T >::release void    [protected]
 

Definition at line 106 of file OgreSharedPtr.h.

Referenced by Ogre::SharedPtr< GpuProgramParameters >::operator=(), Ogre::SharedPtr< GpuProgramParameters >::setNull(), and Ogre::SharedPtr< GpuProgramParameters >::~SharedPtr().

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

Definition at line 98 of file OgreSharedPtr.h.

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

Definition at line 91 of file OgreSharedPtr.h.

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

Definition at line 92 of file OgreSharedPtr.h.


Member Data Documentation

template<class T>
T* Ogre::SharedPtr< T >::pRep [protected]
 

Definition at line 44 of file OgreSharedPtr.h.

Referenced by Ogre::SharedPtr< GpuProgramParameters >::bind(), Ogre::SharedPtr< GpuProgramParameters >::destroy(), Ogre::SharedPtr< GpuProgramParameters >::get(), Ogre::SharedPtr< GpuProgramParameters >::getPointer(), Ogre::SharedPtr< GpuProgramParameters >::isNull(), Ogre::SharedPtr< GpuProgramParameters >::operator *(), Ogre::SharedPtr< GpuProgramParameters >::operator->(), Ogre::SharedPtr< GpuProgramParameters >::operator=(), Ogre::SharedPtr< GpuProgramParameters >::setNull(), and Ogre::SharedPtr< GpuProgramParameters >::SharedPtr().

template<class T>
unsigned int* Ogre::SharedPtr< T >::pUseCount [protected]
 

Definition at line 45 of file OgreSharedPtr.h.

Referenced by Ogre::SharedPtr< GpuProgramParameters >::bind(), Ogre::SharedPtr< GpuProgramParameters >::destroy(), Ogre::SharedPtr< GpuProgramParameters >::operator=(), Ogre::SharedPtr< GpuProgramParameters >::setNull(), Ogre::SharedPtr< GpuProgramParameters >::SharedPtr(), Ogre::SharedPtr< GpuProgramParameters >::unique(), and Ogre::SharedPtr< GpuProgramParameters >::useCount().


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

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:51:38 2004