OGRE: Ogre::SharedPtr< T > Class Template Reference

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

  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

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

Deprecated:
  use Ogre::dynamic_pointer_cast instead

## ◆ get()

template<class T >

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

Referenced by Ogre::v1::HardwareBufferLockGuard::HardwareBufferLockGuard(), Ogre::GpuProgram::getConstantDefinitions(), Ogre::v1::HardwareBufferLockGuard::lock(), Ogre::operator!=(), std::tr1::hash< Ogre::SharedPtr< T > >::operator()(), Ogre::operator<(), Ogre::operator==(), and Ogre::Lod0Stripifier::StripLod0Vertices().

## ◆ getPointer()

template<class T >

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

Deprecated:
  use get() instead

Referenced by Ogre::HighLevelGpuProgram::_getBindingDelegate().

## ◆ isNull()

template<class T >

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

Deprecated:
  use SharedPtr::operator unspecified_bool_type() instead

Referenced by Ogre::GpuProgram::hasDefaultParameters(), Ogre::GpuProgramParameters::hasLogicalIndexedParameters(), and Ogre::GpuProgramParameters::hasNamedParameters().

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

## ◆ operator=() [2/2]

template<class T >
template<class Y >

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

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

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

## ◆ setNull()

template<class T >

void Ogre::SharedPtr< T >::setNull | ( |  | ) |
| inline

Deprecated:
  use reset() instead

## ◆ setUseCount()

template<class T >

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

Deprecated:
  this API will be dropped

## ◆ staticCast()

template<class T >
template<typename Y >

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

Deprecated:
  use Ogre::static_pointer_cast instead

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

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

## ◆ use_count()

template<class T >

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

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

## ◆ useCount()

template<class T >

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

Deprecated:
  use use_count() instead

## Friends And Related Function Documentation

## ◆ SharedPtr

template<class T >
template<typename Y >

friend class SharedPtr
| friend

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

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

- OgrePrerequisites.h
- OgreSharedPtr.h