# Frost::s_wptr< T > Class Template Reference

Weak pointer. More...

`#include <frost_utils_wptr.h>`

List of all members.

## Public Types

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

## Public Member Functions

| s_wptr ()
| Default constructor.
| s_wptr (const s_wptr &pPtr)
| Copy constructor.
| s_wptr (const s_nullptr &pNull)
| Conversion from nullptr.
| ~s_wptr ()
| Destructor.
template<class N >
| s_wptr (const s_refptr< N > &pRefPtr)
| s_refptr conversion.
template<class N >
| s_wptr (const s_wptr< N > &pPtr)
| s_wptr conversion.
s_bool | IsValid () const
| Checks if this pointer points to a valid object.
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_refptr< const T > | Lock () const
| Creates a s_refptr pointing to the object (if any).
s_refptr< T > | Lock ()
| Creates a s_refptr pointing to the object (if any).
const T * | operator-> () const
| Dereferences the pointer.
T * | operator-> ()
| Dereferences the pointer.
PtrTraits< T >::CRef | operator* () const
| Returns a reference to the contained value.
PtrTraits< T >::Ref | operator* ()
| Returns a reference to the contained value.
s_wptr & | operator= (const s_nullptr &pPtr)
| nullptr assignation operator.
s_wptr & | operator= (const s_wptr &pPtr)
| Copy operator.
template<class N >
s_wptr & | operator= (const s_wptr< N > &pPtr)
| Copy operator.
template<class N >
s_bool | operator== (const s_wptr< N > &pValue) const
| Checks if this pointer equals another.
template<class N >
s_bool | operator== (const s_refptr< N > &pValue) const
| Checks if this pointer equals another.
template<class N >
s_bool | operator== (N *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_wptr< N > &pValue) const
| Checks if this pointer is different from another.
template<class N >
s_bool | operator!= (const s_refptr< N > &pValue) const
| Checks if this pointer is different from another.
template<class N >
s_bool | operator!= (N *pValue) const
| Checks if this pointer is different from another.
s_bool | operator!= (s_nullptr pValue) const
| Checks if this pointer is not null.
template<class N >
s_bool | operator< (const s_wptr< N > &pValue) const
| Checks if this pointer's value is lower than the other.
template<class N >
s_bool | operator< (const s_refptr< N > &pValue) const
| Checks if this pointer's value is lower than the other.
template<class N >
s_bool | operator< (N *pValue) const
| Checks if this pointer's value is lower than the other.
template<class N >
s_bool | operator<= (const s_wptr< N > &pValue) const
| Checks if this pointer's value is lower or equal than the other.
template<class N >
s_bool | operator<= (const s_refptr< N > &pValue) const
| Checks if this pointer's value is lower or equal than the other.
template<class N >
s_bool | operator<= (N *pValue) const
| Checks if this pointer's value is lower or equal than the other.
template<class N >
s_bool | operator> (const s_wptr< N > &pValue) const
| Checks if this pointer's value is greater than the other.
template<class N >
s_bool | operator> (const s_refptr< N > &pValue) const
| Checks if this pointer's value is greater than the other.
template<class N >
s_bool | operator> (N *pValue) const
| Checks if this pointer's value is greater than the other.
template<class N >
s_bool | operator>= (const s_wptr< N > &pValue) const
| Checks if this pointer's value is greater or equal than the other.
template<class N >
s_bool | operator>= (const s_refptr< N > &pValue) const
| Checks if this pointer's value is greater or equal than the other.
template<class N >
s_bool | operator>= (N *pValue) const
| Checks if this pointer's value is greater or equal than the other.
bool | operator! () const
| Allows : "if (!pPointer)".
| operator MemberFn () const
| Allows : "if (pPointer)".
s_ctnr< s_wptr< T > > | operator, (const s_wptr< T > &pValue) const

## Static Public Member Functions

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

## Private Member Functions

| s_wptr (T *pValue, default_uint *pCounter, default_uint *pWCounter)
void | Increment_ ()
void | Decrement_ ()

## Private Attributes

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

## Friends

class | s_wptr

## Detailed Description

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

Weak pointer.

This is a companion of the reference counter pointer.
Use the Lock() function to get a valid pointer, or a NULL one if it has been deleted.

Definition at line 10 of file frost_utils_wptr.h.

## Member Typedef Documentation

template<class T>

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

Definition at line 427 of file frost_utils_wptr.h.

## Constructor & Destructor Documentation

template<class T>

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

Default constructor.

Note:
  Initializes the pointer to NULL.

Definition at line 19 of file frost_utils_wptr.h.

template<class T>

Frost::s_wptr< T >::s_wptr | ( | const s_wptr< T > & | pPtr | ) | `[inline]`

Copy constructor.

Definition at line 27 of file frost_utils_wptr.h.

template<class T>

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

Conversion from nullptr.

Definition at line 37 of file frost_utils_wptr.h.

template<class T>

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

Destructor.

Note:
  This function will never delete the pointed object (if any).

Definition at line 47 of file frost_utils_wptr.h.

template<class T>
template<class N >

Frost::s_wptr< T >::s_wptr | ( | const s_refptr< N > & | pRefPtr | ) | `[inline]`

s_refptr conversion.

Definition at line 54 of file frost_utils_wptr.h.

template<class T>
template<class N >

Frost::s_wptr< T >::s_wptr | ( | const s_wptr< N > & | pPtr | ) | `[inline]`

s_wptr conversion.

Definition at line 65 of file frost_utils_wptr.h.

template<class T>

Frost::s_wptr< T >::s_wptr | ( | T * | pValue,
|  | default_uint * | pCounter,
|  | default_uint * | pWCounter |
| ) |  |  | `[inline, private]`

Definition at line 473 of file frost_utils_wptr.h.

## Member Function Documentation

template<class T>

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

Definition at line 486 of file frost_utils_wptr.h.

template<class T>
template<class N >

static s_wptr<T> Frost::s_wptr< T >::DynamicCast | ( | const s_wptr< 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 462 of file frost_utils_wptr.h.

template<class T>

s_uint_t<default_uint> Frost::s_wptr< 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:
  If this function returns 0, then the object has been deleted and this pointer is invalid, or it is simply NULL.

Definition at line 89 of file frost_utils_wptr.h.

template<class T>

s_uint_t<default_uint> Frost::s_wptr< 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 101 of file frost_utils_wptr.h.

template<class T>

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

Definition at line 478 of file frost_utils_wptr.h.

template<class T>

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

Checks if this pointer points to a valid object.

Note:
  The pointer can be invalid if the object has been deleted somewhere else.

Definition at line 78 of file frost_utils_wptr.h.

template<class T>

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

Creates a s_refptr pointing to the object (if any).

Returns:
  A s_refptr pointing to the object (if any)

Note:
  If this pointer is invalid, this function returns an empty s_refptr.

Definition at line 139 of file frost_utils_wptr.h.

template<class T>

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

Creates a s_refptr pointing to the object (if any).

Returns:
  A s_refptr pointing to the object (if any)

Note:
  If this pointer is invalid, this function returns an empty s_refptr.

Definition at line 126 of file frost_utils_wptr.h.

template<class T>

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

Allows : "if (pPointer)".

Definition at line 429 of file frost_utils_wptr.h.

template<class T>

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

Allows : "if (!pPointer)".

Definition at line 422 of file frost_utils_wptr.h.

template<class T>

s_bool Frost::s_wptr< 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 296 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer is different from another.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer is different from another

Definition at line 287 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer is different from another.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer is different from another

Definition at line 277 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer is different from another.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer is different from another

Definition at line 267 of file frost_utils_wptr.h.

template<class T>

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

Returns a reference to the contained value.

Returns:
  A reference to the contained value

Definition at line 180 of file frost_utils_wptr.h.

template<class T>

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

Returns a reference to the contained value.

Returns:
  A reference to the contained value

Definition at line 172 of file frost_utils_wptr.h.

template<class T>

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

Definition at line 437 of file frost_utils_wptr.h.

template<class T>

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

Dereferences the pointer.

Returns:
  The contained pointer

Note:
  You should test for the pointer's validity before using this operator, unless you're sure the object is still alive.

Definition at line 164 of file frost_utils_wptr.h.

template<class T>

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

Dereferences the pointer.

Returns:
  The contained pointer

Note:
  You should test for the pointer's validity before using this operator, unless you're sure the object is still alive.

Definition at line 153 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer's value is lower than the other.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer's value is lower than the other

Definition at line 326 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer's value is lower than the other.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer's value is lower than the other

Definition at line 316 of file frost_utils_wptr.h.

template<class T>
template<class N >

s_bool Frost::s_wptr< T >::operator< | ( | const s_wptr< N > & | pValue | ) | const`[inline]`

Checks if this pointer's value is lower than the other.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer's value is lower than the other

Definition at line 306 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer's value is lower or equal than the other.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer's value is lower or equal than the other

Definition at line 356 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer's value is lower or equal than the other.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer's value is lower or equal than the other

Definition at line 346 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer's value is lower or equal than the other.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer's value is lower or equal than the other

Definition at line 336 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Copy operator.

Parameters:

  | pPtr | The value to copy

Definition at line 215 of file frost_utils_wptr.h.

template<class T>

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

Copy operator.

Parameters:

  | pPtr | The value to copy

Definition at line 200 of file frost_utils_wptr.h.

template<class T>

s_wptr& Frost::s_wptr< T >::operator= | ( | const s_nullptr & | pPtr | ) | `[inline]`

nullptr assignation operator.

Parameters:

  | pPtr | The value to copy

Definition at line 188 of file frost_utils_wptr.h.

template<class T>

s_bool Frost::s_wptr< 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 257 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer equals another.

Parameters:

  | pValue | The pointer to test

Definition at line 248 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer equals another.

Parameters:

  | pValue | The pointer to test

Definition at line 239 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer equals another.

Parameters:

  | pValue | The pointer to test

Definition at line 230 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer's value is greater than the other.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer's value is greater than the other

Definition at line 386 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer's value is greater than the other.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer's value is greater than the other

Definition at line 376 of file frost_utils_wptr.h.

template<class T>
template<class N >

s_bool Frost::s_wptr< T >::operator> | ( | const s_wptr< N > & | pValue | ) | const`[inline]`

Checks if this pointer's value is greater than the other.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer's value is greater than the other

Definition at line 366 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer's value is greater or equal than the other.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer's value is greater or equal than the other

Definition at line 416 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer's value is greater or equal than the other.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer's value is greater or equal than the other

Definition at line 406 of file frost_utils_wptr.h.

template<class T>
template<class N >

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

Checks if this pointer's value is greater or equal than the other.

Parameters:

  | pValue | The pointer to test

Returns:
  'true' if this pointer's value is greater or equal than the other

Definition at line 396 of file frost_utils_wptr.h.

template<class T>

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

Sets this pointer to NULL.

Note:
  This function will never delete the pointed object (if any).

Definition at line 112 of file frost_utils_wptr.h.

template<class T>
template<class N >

static s_wptr<T> Frost::s_wptr< T >::StaticCast | ( | const s_wptr< 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 450 of file frost_utils_wptr.h.

## Friends And Related Function Documentation

template<class T>

friend class s_wptr`[friend]`

Definition at line 14 of file frost_utils_wptr.h.

## Member Data Documentation

template<class T>

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

Definition at line 502 of file frost_utils_wptr.h.

template<class T>

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

Definition at line 501 of file frost_utils_wptr.h.

template<class T>

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

Definition at line 503 of file frost_utils_wptr.h.

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

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