CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::RefCounter< true > Class Referencefinal

A class that implements a simple interface for reference counting. More...

#include <CeresEngine/Foundation/SmartPtr.hpp>

Public Member Functions

 RefCounter ()=default
 
 RefCounter (const UInt64 initialCount)
 
void increment () noexcept
 Increments the reference counter by one.
 
bool decrement () noexcept
 Decrements the reference counter by one.
 

Private Attributes

Atomic< UInt64mCounter = 0
 The object's reference counter.
 

Detailed Description

A class that implements a simple interface for reference counting.

This implementation uses an atomic counter and is thread-safe.

Constructor & Destructor Documentation

◆ RefCounter() [1/2]

CeresEngine::RefCounter< true >::RefCounter ( )
default

◆ RefCounter() [2/2]

CeresEngine::RefCounter< true >::RefCounter ( const UInt64  initialCount)
inlineexplicit

Member Function Documentation

◆ decrement()

bool CeresEngine::RefCounter< true >::decrement ( )
noexcept

Decrements the reference counter by one.

Returns
true if the counter is now 0.

◆ increment()

void CeresEngine::RefCounter< true >::increment ( )
noexcept

Increments the reference counter by one.

Member Data Documentation

◆ mCounter

Atomic<UInt64> CeresEngine::RefCounter< true >::mCounter = 0
private

The object's reference counter.


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