| OGRE 1.10.11 Object-Oriented Graphics Rendering Engine

Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
Ogre::SharedPtr< T > Class Template Reference
Core » General

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
SharedPtr & | operator= (const SharedPtr &r)
template<class Y >
SharedPtr & | operator= (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.

Referenced by Ogre::SharedPtr< Skeleton >::reset().

## ◆ SharedPtr() [2/4]

template<class T>
template<class Y >

Ogre::SharedPtr< T >::SharedPtr | ( | Y * | rep,
|  | SharedPtrFreeMethod | inFreeMethod = `SPFM_DELETE`
| ) |  |
| inline explicit

Constructor.

Parameters

  rep | The pointer to take ownership of
  inFreeMethod | The 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

Deprecated:
  use Ogre::static_pointer_cast instead

## ◆ dynamicCast()

template<class T>
template<typename Y >

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

Deprecated:
  use Ogre::dynamic_pointer_cast instead

## ◆ operator*()

template<class T>

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

## ◆ operator->()

template<class T>

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

## ◆ get()

template<class T>

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

Referenced by Ogre::HighLevelGpuProgram::_getBindingDelegate(), Ogre::GpuProgram::getConstantDefinitions(), Ogre::GpuProgram::hasDefaultParameters(), Ogre::GpuProgramParameters::hasLogicalIndexedParameters(), Ogre::GpuProgramParameters::hasNamedParameters(), and Ogre::Lod0Stripifier::StripLod0Vertices().

## ◆ 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

Deprecated:
  use use_count() instead

## ◆ use_count()

template<class T>

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

Referenced by Ogre::SharedPtr< Skeleton >::useCount().

## ◆ 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 > *** |  | ) |
| inline static

Referenced by Ogre::SharedPtr< Skeleton >::operator unspecified_bool_type().

## ◆ 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

Deprecated:
  use SharedPtr::operator unspecified_bool_type() instead

## ◆ 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

Referenced by Ogre::SharedPtr< Skeleton >::setNull().

## ◆ 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

Referenced by Ogre::SharedPtr< Skeleton >::staticCast().

## ◆ dynamic_pointer_cast

template<class T>
template<typename Y , typename X >

SharedPtr<Y> dynamic_pointer_cast | ( | const SharedPtr< X > & | r | ) |
| friend

Referenced by Ogre::SharedPtr< Skeleton >::dynamicCast().

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

- OgrePrerequisites.h
- OgreSharedPtr.h