# Frost::s_refptr< T > Class Template Reference

Reference counting pointer. More...

`#include <frost_utils_refptr.h>`

List of all members.

## Public Types

typedef void(s_refptr::* | MemberFn )()

## Public Member Functions

| s_refptr ()
| Default constructor.
| s_refptr (const s_refptr &mValue)
| Copy constructor.
| s_refptr (const s_nullptr &pNull)
| Conversion from nullptr.
| s_refptr (T *pValue)
| Constructor.
template<class N >
| s_refptr (const s_refptr< N > &mValue)
| Conversion constructor.
| ~s_refptr ()
| Destructor.
const T * | Get () const
| Returns the contained pointer.
T * | Get ()
| Returns the contained pointer.
s_bool | IsValid () const
| Checks if this pointer is usable.
s_uint_t< default_uint > | GetCount () const
| Returns the number of s_refptr pointing to the object.
s_uint_t< default_uint > | GetWeakCount () const
| Returns the number of s_wptr pointing to the object.
void | SetNull ()
| Sets this pointer to NULL.
s_wptr< T > | CreateWeak () const
| Creates a s_wptr pointing at the same object.
PtrTraits< T >::CRef | operator* () const
| Returns a reference to the contained value.
PtrTraits< T >::Ref | operator* ()
| Returns a reference to the contained value.
const T * | operator-> () const
| Dereferences the pointer.
T * | operator-> ()
| Dereferences the pointer.
s_refptr & | operator= (const s_refptr &mValue)
| Copy operator.
template<class N >
s_refptr & | operator= (const s_refptr< N > &mValue)
| Copy operator.
template<class N >
s_bool | operator== (const s_refptr< N > &mValue)
| Checks if this pointer equals another.
s_bool | operator== (T *pValue) const
| Checks if this pointer equals another.
s_bool | operator== (s_nullptr pValue) const
| Checks if this pointer is null.
template<class N >
s_bool | operator!= (const s_refptr< N > &mValue)
| Checks if this pointer is different from another.
s_bool | operator!= (T *pValue) const
| Checks if this pointer is different from another.
s_bool | operator!= (s_nullptr pValue) const
| Checks if this pointer is not null.
bool | operator! () const
| Allows : "if (!pPointer)".
| operator MemberFn () const
| Allows : "if (pPointer)".
template<class N >
| operator s_refptr< const N > () const
| Allows limited implicit inheritance conversion.
template<class N >
| operator s_refptr< N > ()
| Allows limited implicit inheritance conversion.
s_ctnr< s_refptr< T > > | operator, (const s_refptr< T > &pValue) const

## Static Public Member Functions

template<class N >
static s_refptr< T > | StaticCast (const s_refptr< N > &pValue)
| Casts the provided pointer to this one's type.
template<class N >
static s_refptr< T > | DynamicCast (const s_refptr< N > &pValue)
| Tries to dynamic cast the provided pointer to this one's type.

## Protected Member Functions

| s_refptr (T *pValue, default_uint *pCounter, default_uint *pWCounter)
| Constructor.

## Private Member Functions

void | Increment_ ()
void | Decrement_ ()

## Private Attributes

T * | pValue_
default_uint * | pCounter_
default_uint * | pWCounter_

## Friends

class | s_refptr
class | s_wptr

## Detailed Description

### template<class T>
class Frost::s_refptr< T >

Reference counting pointer.

This is a pointer that automatically deletes its content when not used anymore.
Can be used in conjunction with s_wptr. Uses reference counting.

Definition at line 11 of file frost_utils_refptr.h.

## Member Typedef Documentation

template<class T>

typedef void(s_refptr::* Frost::s_refptr< T >::MemberFn)()

Definition at line 284 of file frost_utils_refptr.h.

## Constructor & Destructor Documentation

template<class T>

Frost::s_refptr< T >::s_refptr | ( |  | ) | `[inline]`

Default constructor.

Note:
  Initializes the pointer to NULL.

Definition at line 21 of file frost_utils_refptr.h.

template<class T>

Frost::s_refptr< T >::s_refptr | ( | const s_refptr< T > & | mValue | ) | `[inline]`

Copy constructor.

Parameters:

  | mValue | the s_refptr to copy

Definition at line 31 of file frost_utils_refptr.h.

template<class T>

Frost::s_refptr< T >::s_refptr | ( | const s_nullptr & | pNull | ) | `[inline]`

Conversion from nullptr.

Definition at line 41 of file frost_utils_refptr.h.

template<class T>

Frost::s_refptr< T >::s_refptr | ( | T * | pValue | ) | `[inline, explicit]`

Constructor.

Parameters:

  | pValue | The pointer to assign

Note:
  This is the only way to assign a classic pointer to a s_refptr.

Definition at line 53 of file frost_utils_refptr.h.

template<class T>
template<class N >

Frost::s_refptr< T >::s_refptr | ( | const s_refptr< N > & | mValue | ) | `[inline, explicit]`

Conversion constructor.

Parameters:

  | mValue | the s_refptr to copy

Definition at line 66 of file frost_utils_refptr.h.

template<class T>

Frost::s_refptr< T >::~s_refptr | ( |  | ) | `[inline]`

Destructor.

Note:
  Can cause deletion of the contained pointer.

Definition at line 79 of file frost_utils_refptr.h.

template<class T>

Frost::s_refptr< T >::s_refptr | ( | T * | pValue,
|  | default_uint * | pCounter,
|  | default_uint * | pWCounter |
| ) |  |  | `[inline, explicit, protected]`

Constructor.

Parameters:

  | pValue | The pointer to assign
  | pCounter | The counter to use
  | pWCounter | The weak ptr counter to use

Note:
  This function should not be called by anyone else than itself (and other template specializations).

Definition at line 352 of file frost_utils_refptr.h.

## Member Function Documentation

template<class T>

s_wptr<T> Frost::s_refptr< T >::CreateWeak | ( |  | ) | const`[inline]`

Creates a s_wptr pointing at the same object.

Definition at line 146 of file frost_utils_refptr.h.

template<class T>

void Frost::s_refptr< T >::Decrement_ | ( |  | ) | `[inline, private]`

Definition at line 369 of file frost_utils_refptr.h.

template<class T>
template<class N >

static s_refptr<T> Frost::s_refptr< T >::DynamicCast | ( | const s_refptr< N > & | pValue | ) | `[inline, static]`

Tries to dynamic cast the provided pointer to this one's type.

Parameters:

  | pValue | The pointer to cast

Returns:
  The new casted pointer

Note:
  Dynamic cast can fail, and in this case, will result in a NULL pointer.

Definition at line 333 of file frost_utils_refptr.h.

template<class T>

T* Frost::s_refptr< T >::Get | ( |  | ) | `[inline]`

Returns the contained pointer.

Returns:
  The contained pointer

Definition at line 95 of file frost_utils_refptr.h.

template<class T>

const T* Frost::s_refptr< T >::Get | ( |  | ) | const`[inline]`

Returns the contained pointer.

Returns:
  The contained pointer

Definition at line 87 of file frost_utils_refptr.h.

template<class T>

s_uint_t<default_uint> Frost::s_refptr< T >::GetCount | ( |  | ) | const`[inline]`

Returns the number of s_refptr pointing to the object.

Returns:
  The number of s_refptr pointing to the object

Note:
  This function returns 0 if the pointer is NULL.

Definition at line 112 of file frost_utils_refptr.h.

template<class T>

s_uint_t<default_uint> Frost::s_refptr< T >::GetWeakCount | ( |  | ) | const`[inline]`

Returns the number of s_wptr pointing to the object.

Returns:
  The number of s_wptr pointing to the object

Note:
  This function returns 0 if the pointer is NULL.

Definition at line 124 of file frost_utils_refptr.h.

template<class T>

void Frost::s_refptr< T >::Increment_ | ( |  | ) | `[inline, private]`

Definition at line 363 of file frost_utils_refptr.h.

template<class T>

s_bool Frost::s_refptr< T >::IsValid | ( |  | ) | const`[inline]`

Checks if this pointer is usable.

Returns:
  'true' is this pointer is usable

Definition at line 103 of file frost_utils_refptr.h.

template<class T>

Frost::s_refptr< T >::operator MemberFn | ( |  | ) | const`[inline]`

Allows : "if (pPointer)".

Definition at line 286 of file frost_utils_refptr.h.

template<class T>
template<class N >

Frost::s_refptr< T >::operator s_refptr< const N > | ( |  | ) | const`[inline]`

Allows limited implicit inheritance conversion.

Definition at line 296 of file frost_utils_refptr.h.

template<class T>
template<class N >

Frost::s_refptr< T >::operator s_refptr< N > | ( |  | ) | `[inline]`

Allows limited implicit inheritance conversion.

Definition at line 303 of file frost_utils_refptr.h.

template<class T>

bool Frost::s_refptr< T >::operator! | ( |  | ) | const`[inline]`

Allows : "if (!pPointer)".

Definition at line 279 of file frost_utils_refptr.h.

template<class T>

s_bool Frost::s_refptr< T >::operator!= | ( | s_nullptr | pValue | ) | const`[inline]`

Checks if this pointer is not null.

Parameters:

  | pValue | The null pointer

Returns:
  'true' if this pointer is not null

Definition at line 273 of file frost_utils_refptr.h.

template<class T>

s_bool Frost::s_refptr< T >::operator!= | ( | T * | pValue | ) | const`[inline]`

Checks if this pointer is different from another.

Parameters:

  | pValue | The pointer to test

Definition at line 264 of file frost_utils_refptr.h.

template<class T>
template<class N >

s_bool Frost::s_refptr< T >::operator!= | ( | const s_refptr< N > & | mValue | ) | `[inline]`

Checks if this pointer is different from another.

Parameters:

  | mValue | The pointer to test

Definition at line 256 of file frost_utils_refptr.h.

template<class T>

PtrTraits<T>::Ref Frost::s_refptr< T >::operator* | ( |  | ) | `[inline]`

Returns a reference to the contained value.

Returns:
  A reference to the contained value

Definition at line 162 of file frost_utils_refptr.h.

template<class T>

PtrTraits<T>::CRef Frost::s_refptr< T >::operator* | ( |  | ) | const`[inline]`

Returns a reference to the contained value.

Returns:
  A reference to the contained value

Definition at line 154 of file frost_utils_refptr.h.

template<class T>

s_ctnr< s_refptr<T> > Frost::s_refptr< T >::operator, | ( | const s_refptr< T > & | pValue | ) | const`[inline]`

Definition at line 308 of file frost_utils_refptr.h.

template<class T>

T* Frost::s_refptr< T >::operator-> | ( |  | ) | `[inline]`

Dereferences the pointer.

Returns:
  The contained pointer

Definition at line 178 of file frost_utils_refptr.h.

template<class T>

const T* Frost::s_refptr< T >::operator-> | ( |  | ) | const`[inline]`

Dereferences the pointer.

Returns:
  The contained pointer

Definition at line 170 of file frost_utils_refptr.h.

template<class T>
template<class N >

s_refptr& Frost::s_refptr< T >::operator= | ( | const s_refptr< N > & | mValue | ) | `[inline]`

Copy operator.

Parameters:

  | mValue | The value to copy

Note:
  Can cause deletion of the contained pointer.

Definition at line 210 of file frost_utils_refptr.h.

template<class T>

s_refptr& Frost::s_refptr< T >::operator= | ( | const s_refptr< T > & | mValue | ) | `[inline]`

Copy operator.

Parameters:

  | mValue | The value to copy

Note:
  Can cause deletion of the contained pointer.

Definition at line 188 of file frost_utils_refptr.h.

template<class T>

s_bool Frost::s_refptr< T >::operator== | ( | s_nullptr | pValue | ) | const`[inline]`

Checks if this pointer is null.

Parameters:

  | pValue | The null pointer

Returns:
  'true' if this pointer is null

Definition at line 247 of file frost_utils_refptr.h.

template<class T>

s_bool Frost::s_refptr< T >::operator== | ( | T * | pValue | ) | const`[inline]`

Checks if this pointer equals another.

Parameters:

  | pValue | The pointer to test

Definition at line 238 of file frost_utils_refptr.h.

template<class T>
template<class N >

s_bool Frost::s_refptr< T >::operator== | ( | const s_refptr< N > & | mValue | ) | `[inline]`

Checks if this pointer equals another.

Parameters:

  | mValue | The pointer to test

Definition at line 230 of file frost_utils_refptr.h.

template<class T>

void Frost::s_refptr< T >::SetNull | ( |  | ) | `[inline]`

Sets this pointer to NULL.

Note:
  Can cause deletion of the contained pointer.

Definition at line 136 of file frost_utils_refptr.h.

template<class T>
template<class N >

static s_refptr<T> Frost::s_refptr< T >::StaticCast | ( | const s_refptr< N > & | pValue | ) | `[inline, static]`

Casts the provided pointer to this one's type.

Parameters:

  | pValue | The pointer to cast

Returns:
  The new casted pointer

Definition at line 321 of file frost_utils_refptr.h.

## Friends And Related Function Documentation

template<class T>

friend class s_refptr`[friend]`

Definition at line 15 of file frost_utils_refptr.h.

template<class T>

friend class s_wptr`[friend]`

Definition at line 16 of file frost_utils_refptr.h.

## Member Data Documentation

template<class T>

default_uint* Frost::s_refptr< T >::pCounter_`[private]`

Definition at line 391 of file frost_utils_refptr.h.

template<class T>

T* Frost::s_refptr< T >::pValue_`[private]`

Definition at line 390 of file frost_utils_refptr.h.

template<class T>

default_uint* Frost::s_refptr< T >::pWCounter_`[private]`

Definition at line 392 of file frost_utils_refptr.h.

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

- D:/Programmation/Sources/Tensor2/Utils/include/frost_utils_refptr.h