| Face Engine SDK 5.34.0 A face detection, recognition and tracking engine.

Public Member Functions | Protected Attributes | List of all members
fsdk::RefBase< T > Struct Template Reference

Generic base class of a pointer for reference counted objects. More...

`#include <RefBase.h>`

Inheritance diagram for fsdk::RefBase< T >:

## Public Member Functions
| RefBase () noexcept=default
| Initializes object pointer to nullptr.
| RefBase (T *ptr) noexcept
| Initializes object pointer with ptr. More...
| operator T* () const noexcept
| Get raw object pointer. More...
T & | operator* () const noexcept
| Dereference operator. More...
| operator bool () const noexcept
| Implicit cast to bool. More...
bool | operator== (const RefBase &other) const noexcept
| Check if two refs are the same. More...
bool | operator!= (const RefBase &other) const noexcept
| Check if two refs are not the same. More...
bool | isNull () const noexcept
| Check for nullptr. More...
bool | isExpired () const noexcept
| Check is object is dead. More...
bool | isUnique () const noexcept
| Check if object has only one strong reference. More...
T * | get () const noexcept
| Get current raw object pointer. More...
void | set (T *ptr) noexcept
| Replace object pointer without any checks or reference management. More...

## Protected Attributes
T * | m_ptr {nullptr}
| Raw pointer.

## Detailed Description

### template<typename T>
struct fsdk::RefBase< T >

Generic base class of a pointer for reference counted objects.

Implements common features of Ref and WeakRef and is not meant to be used directly.

Note
  This is to eliminate code duplication and should not be used directly.

Template Parameters

  T | object interface (must be derived from IRefCounted)

## Constructor & Destructor Documentation

## ◆ RefBase()

template<typename T >

fsdk::RefBase< T >::RefBase | ( | T * | ptr | ) |
| inline explicit noexcept

Initializes object pointer with ptr.

Parameters

  [in] | ptr | raw pointer to initialize with.

## Member Function Documentation

## ◆ get()

template<typename T >

T* fsdk::RefBase< T >::get | ( |  | ) | const
| inline noexcept

Get current raw object pointer.

Returns
  current raw object pointer.

## ◆ isExpired()

template<typename T >

bool fsdk::RefBase< T >::isExpired | ( |  | ) | const
| inline noexcept

Check is object is dead.

Returns
  true if referenced object has no references.

## ◆ isNull()

template<typename T >

bool fsdk::RefBase< T >::isNull | ( |  | ) | const
| inline noexcept

Check for nullptr.

Returns
  true if referenced object pointer is nullptr.

## ◆ isUnique()

template<typename T >

bool fsdk::RefBase< T >::isUnique | ( |  | ) | const
| inline noexcept

Check if object has only one strong reference.

Returns
  true if referenced object has exactly one reference.

## ◆ operator bool()

template<typename T >

fsdk::RefBase< T >::operator bool | ( |  | ) | const
| inline noexcept

Implicit cast to bool.

Returns
  true if ref is not null.

## ◆ operator T*()

template<typename T >

fsdk::RefBase< T >::operator T* | ( |  | ) | const
| inline noexcept

Get raw object pointer.

Note
  No checks are performed.

Returns
  raw object pointer.

## ◆ operator!=()

template<typename T >

bool fsdk::RefBase< T >::operator!= | ( | const RefBase< T > & | other | ) | const
| inline noexcept

Check if two refs are not the same.

Returns
  true if two refs are not the same.

Parameters

  [in] | other | ref to check against.

## ◆ operator*()

template<typename T >

T& fsdk::RefBase< T >::operator* | ( |  | ) | const
| inline noexcept

Dereference operator.

Returns
  reference to object being held.

## ◆ operator==()

template<typename T >

bool fsdk::RefBase< T >::operator== | ( | const RefBase< T > & | other | ) | const
| inline noexcept

Check if two refs are the same.

Returns
  true if two refs are the same.

Parameters

  [in] | other | ref to check against.

## ◆ set()

template<typename T >

void fsdk::RefBase< T >::set | ( | T * | ptr | ) |
| inline noexcept

Replace object pointer without any checks or reference management.

Note
  This operation is unsafe!

Parameters

  [in] | ptr | raw object pointer to set.

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

- include/fsdk/Types/RefBase.h