Face Engine SDK 5.25.0
A face detection, recognition and tracking engine.
Loading...
Searching...
No Matches
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 >:
fsdk::Ref< T >

Public Member Functions

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

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
Tobject interface (must be derived from IRefCounted)

Constructor & Destructor Documentation

◆ RefBase()

template<typename T >
fsdk::RefBase< T >::RefBase ( T * ptr)
inlineexplicitnoexcept

Initializes object pointer with ptr.

Parameters
[in]ptrraw pointer to initialize with.

Member Function Documentation

◆ get()

template<typename T >
T * fsdk::RefBase< T >::get ( ) const
inlinenoexcept

Get current raw object pointer.

Returns
current raw object pointer.

◆ isExpired()

template<typename T >
bool fsdk::RefBase< T >::isExpired ( ) const
inlinenoexcept

Check is object is dead.

Returns
true if referenced object has no references.

◆ isNull()

template<typename T >
bool fsdk::RefBase< T >::isNull ( ) const
inlinenoexcept

Check for nullptr.

Returns
true if referenced object pointer is nullptr.

◆ isUnique()

template<typename T >
bool fsdk::RefBase< T >::isUnique ( ) const
inlinenoexcept

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
inlinenoexcept

Implicit cast to bool.

Returns
true if ref is not null.

◆ operator T*()

template<typename T >
fsdk::RefBase< T >::operator T* ( ) const
inlinenoexcept

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
inlinenoexcept

Check if two refs are not the same.

Returns
true if two refs are not the same.
Parameters
[in]otherref to check against.

◆ operator*()

template<typename T >
T & fsdk::RefBase< T >::operator* ( ) const
inlinenoexcept

Dereference operator.

Returns
reference to object being held.

◆ operator==()

template<typename T >
bool fsdk::RefBase< T >::operator== ( const RefBase< T > & other) const
inlinenoexcept

Check if two refs are the same.

Returns
true if two refs are the same.
Parameters
[in]otherref to check against.

◆ set()

template<typename T >
void fsdk::RefBase< T >::set ( T * ptr)
inlinenoexcept

Replace object pointer without any checks or reference management.

Note
This operation is unsafe!
Parameters
[in]ptrraw object pointer to set.

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