OGRE  1.10.12
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...
 
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
 
 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 (void)
 
void reset (T *rep)
 
void setNull ()
 
void setUseCount (unsigned value)
 
template<typename Y >
SharedPtr< Y > staticCast () const
 
bool unique () const
 
long use_count () const
 
unsigned int useCount () const
 

Static Public Member Functions

static void unspecified_bool (SharedPtr ***)
 

Friends

template<typename Y >
class SharedPtr
 
template<typename Y , typename X >
SharedPtr< Y > dynamic_pointer_cast (const SharedPtr< X > &r)
 
template<typename Y , typename X >
SharedPtr< Y > static_pointer_cast (const SharedPtr< X > &r)
 

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

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ staticCast()

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

◆ dynamicCast()

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

◆ operator*()

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

◆ operator->()

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

◆ get()

◆ 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

◆ unique()

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

◆ useCount()

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

◆ use_count()

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

◆ setUseCount()

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

◆ getPointer()

template<class T>
T* Ogre::SharedPtr< T >::getPointer ( ) const
inline
Deprecated:
use get() instead

◆ unspecified_bool()

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

◆ operator unspecified_bool_type()

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

◆ isNull()

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

◆ setNull()

template<class T>
void Ogre::SharedPtr< T >::setNull ( )
inline
Deprecated:
use reset() instead

◆ reset() [1/2]

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

◆ reset() [2/2]

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

Friends And Related Function Documentation

◆ SharedPtr

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

◆ static_pointer_cast

template<class T>
template<typename Y , typename X >
SharedPtr<Y> static_pointer_cast ( const SharedPtr< X > &  r)
friend

◆ dynamic_pointer_cast

template<class T>
template<typename Y , typename X >
SharedPtr<Y> dynamic_pointer_cast ( const SharedPtr< X > &  r)
friend

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