OGRE  2.3
Object-Oriented Graphics Rendering Engine
Ogre::SharedPtr< T > Class Template Reference

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

#include <OgreSharedPtr.h>

Public Types

typedef void(* unspecified_bool_type) (SharedPtr ***)
 

Public Member Functions

 SharedPtr ()
 Constructor, does not initialise the SharedPtr. More...
 
 SharedPtr (const SharedPtr &r)
 
template<class Y >
 SharedPtr (const SharedPtr< Y > &r)
 
template<class Y >
 SharedPtr (Y *rep, SharedPtrFreeMethod inFreeMethod=SPFM_DELETE)
 Constructor. More...
 
 ~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
 
 operator unspecified_bool_type () const
 
T & operator* () const
 
T * operator-> () const
 
SharedPtroperator= (const SharedPtr &r)
 
template<class Y >
SharedPtroperator= (const SharedPtr< Y > &r)
 
void reset (T *rep)
 
void reset (void)
 
void setNull ()
 
void setUseCount (unsigned value)
 
template<typename Y >
SharedPtr< Y > staticCast () const
 
bool unique () const
 
unsigned int use_count () const
 
unsigned int useCount () const
 

Static Public Member Functions

static void unspecified_bool (SharedPtr ***)
 

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.

Member Typedef Documentation

◆ unspecified_bool_type

template<class T >
typedef void(* Ogre::SharedPtr< T >::unspecified_bool_type) (SharedPtr ***)

Constructor & Destructor Documentation

◆ SharedPtr() [1/4]

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

Constructor, does not initialise the SharedPtr.

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

◆ SharedPtr() [2/4]

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
inFreeMethodThe mechanism to use to free the pointer

◆ SharedPtr() [3/4]

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

◆ SharedPtr() [4/4]

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

◆ ~SharedPtr()

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

Member Function Documentation

◆ bind()

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!
Warning
The object must not be bound into a SharedPtr elsewhere
Deprecated:
this api will be dropped. use reset(T*) instead

◆ dynamicCast()

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

◆ get()

◆ getPointer()

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

◆ isNull()

◆ operator unspecified_bool_type()

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

◆ operator*()

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

◆ operator->()

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

◆ operator=() [1/2]

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

References std::swap().

◆ operator=() [2/2]

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

References std::swap().

◆ reset() [1/2]

template<class T >
void Ogre::SharedPtr< T >::reset ( T *  rep)
inline

◆ reset() [2/2]

template<class T >
void Ogre::SharedPtr< T >::reset ( void  )
inline

◆ setNull()

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

◆ setUseCount()

template<class T >
void Ogre::SharedPtr< T >::setUseCount ( unsigned  value)
inline
Deprecated:
this API will be dropped

References Ogre::SharedPtrInfo::useCount.

◆ staticCast()

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

◆ unique()

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

◆ unspecified_bool()

template<class T >
static void Ogre::SharedPtr< T >::unspecified_bool ( SharedPtr< T > ***  )
inlinestatic

◆ use_count()

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

◆ useCount()

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

Friends And Related Function Documentation

◆ SharedPtr

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

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