CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::RefCounted< T, Counter, Deleter > Class Template Reference

A simple reference counter base class. More...

#include <CeresEngine/Foundation/SmartPtr.hpp>

Public Member Functions

template<typename... Args>
 RefCounted (Args &&... args)
 Creates a new RefCounted object and constructs a new Deleter by forwarding Args to it.
 
void retain () noexcept
 Retains the object by increment it's reference count by one.
 
bool release () noexcept
 Relases the object by decrementing it's reference count by one.
 

Private Attributes

Counter mRefCounter
 The object's reference counter.
 
Deleter mDeleter
 The deleter object type.
 

Detailed Description

template<typename T, typename Counter, typename Deleter>
class CeresEngine::RefCounted< T, Counter, Deleter >

A simple reference counter base class.

Can be inherited by classes to provide reference counting semantics that can be used by CountedPtr.

Template Parameters
TThe type that is inheriting from RefCounted
DeleterA deleter class to be called when deallocating the object.
CounterA type used to perform the reference counting.

Constructor & Destructor Documentation

◆ RefCounted()

template<typename T , typename Counter , typename Deleter >
template<typename... Args>
CeresEngine::RefCounted< T, Counter, Deleter >::RefCounted ( Args &&...  args)
inlineexplicit

Creates a new RefCounted object and constructs a new Deleter by forwarding Args to it.

Template Parameters
Argsthe arg types to forward to the Deleter constructor
Parameters
argsThe arguments to forward to the Deleter constructor

Member Function Documentation

◆ release()

template<typename T , typename Counter , typename Deleter >
bool CeresEngine::RefCounted< T, Counter, Deleter >::release ( )
inlinenoexcept

Relases the object by decrementing it's reference count by one.

Returns
true if the object has been destroyed

◆ retain()

template<typename T , typename Counter , typename Deleter >
void CeresEngine::RefCounted< T, Counter, Deleter >::retain ( )
inlinenoexcept

Retains the object by increment it's reference count by one.

Member Data Documentation

◆ mDeleter

template<typename T , typename Counter , typename Deleter >
Deleter CeresEngine::RefCounted< T, Counter, Deleter >::mDeleter
private

The deleter object type.

◆ mRefCounter

template<typename T , typename Counter , typename Deleter >
Counter CeresEngine::RefCounted< T, Counter, Deleter >::mRefCounter
private

The object's reference counter.


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