UraniumCompute 0.1.0
A GPU accelerated parallel task scheduler
UN::Object< TInterface, > Class Template Reference

Base class for dynamic reference counted objects. More...

#include <Object.h>

Inheritance diagram for UN::Object< TInterface, >:
UN::DeviceObjectBase< TInterface, >

Public Member Functions

 Object (const Object &)=delete
 
 Object (Object &&)=delete
 
UInt32 AddRef () override
 Add a strong reference to the object. More...
 
UInt32 Release () override
 
void AttachRefCounter (ReferenceCounter *pRefCounter) override
 Attach a reference counter to the object. More...
 
ReferenceCounterGetRefCounter () override
 Get reference counter attached to this object.
 

Protected Member Functions

template<class F >
UInt32 Release (F &&destroyCallback)
 

Detailed Description

template<class TInterface, std::enable_if_t< std::is_base_of_v< IObject, TInterface >, bool > = true>
class UN::Object< TInterface, >

Base class for dynamic reference counted objects.

Example:

class IObject {};
class IMyInterface : public IObject {};
class MyObject : public Object<IMyInterface> {};
Base interface for dynamic reference counted objects.
Definition: Object.h:8
Template Parameters
TInterface- The type of interface the object must implement.

Member Function Documentation

◆ AddRef()

template<class TInterface , std::enable_if_t< std::is_base_of_v< IObject, TInterface >, bool > = true>
UInt32 UN::Object< TInterface, >::AddRef ( )
inlineoverride

Add a strong reference to the object.

Returns
The new (incremented) number of strong references.

◆ AttachRefCounter()

template<class TInterface , std::enable_if_t< std::is_base_of_v< IObject, TInterface >, bool > = true>
void UN::Object< TInterface, >::AttachRefCounter ( ReferenceCounter pRefCounter)
inlineoverride

Attach a reference counter to the object.

Parameters
pRefCounter- Reference counter to attach.

◆ Release()

template<class TInterface , std::enable_if_t< std::is_base_of_v< IObject, TInterface >, bool > = true>
UInt32 UN::Object< TInterface, >::Release ( )
inlineoverride

Directly uses ReferenceCounter::ReleaseStrongRef, but also calls the virtual destructor of itself (commits suicide) when the reference counter reaches zero.


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