Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::ReferenceCounter Class Reference

Class to track an object using SmartPointer. More...

Inheritance diagram for Burger::ReferenceCounter:
Collaboration diagram for Burger::ReferenceCounter:

Public Member Functions

const Burger::StaticRTTIget_StaticRTTI (void) const noexcept override
 Get the description to the class.
 
 ReferenceCounter () noexcept
 Sets the reference count to zero.
 
virtual ~ReferenceCounter ()
 Destructor.
 
void AddRef (void) noexcept
 Increase the reference count by 1.
 
void Release (void) noexcept
 Decrease the reference count by 1.
 
- Public Member Functions inherited from Burger::Base
const char * get_class_name (void) const noexcept
 Get the name of the class.
 
virtual ~Base () noexcept=default
 Destructor.
 

Static Public Attributes

static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 
- Static Public Attributes inherited from Burger::Base
static const Burger::StaticRTTI g_StaticRTTI
 The global description of the class.
 

Private Member Functions

 ReferenceCounter (const ReferenceCounter &)=delete
 
ReferenceCounteroperator= (const ReferenceCounter &)=delete
 
 ReferenceCounter (ReferenceCounter &&)=delete
 
ReferenceCounteroperator= (ReferenceCounter &&)=delete
 

Private Attributes

uint_t m_uRefCount
 Number of smart pointers that are claiming ownership of this object.
 

Detailed Description

Class to track an object using SmartPointer.


When using a SmartPointer, it needs to be able to keep track of an object's reference count to know when the object should be deleted. Once all SmartPointer objects release ownership of this object, the reference count will reach zero and this object will immediately self-destruct.

See also
WeakPointer, ProxyReferenceCounter and SmartPointer

Constructor & Destructor Documentation

◆ ReferenceCounter() [1/3]

Burger::ReferenceCounter::ReferenceCounter ( const ReferenceCounter & )
privatedelete

◆ ReferenceCounter() [2/3]

Burger::ReferenceCounter::ReferenceCounter ( ReferenceCounter && )
privatedelete

◆ ReferenceCounter() [3/3]

Burger::ReferenceCounter::ReferenceCounter ( )
inlinenoexcept

Sets the reference count to zero.


◆ ~ReferenceCounter()

Burger::ReferenceCounter::~ReferenceCounter ( )
virtual

Destructor.


Does absolutely nothing

Member Function Documentation

◆ AddRef()

void Burger::ReferenceCounter::AddRef ( void )
inlinenoexcept

Increase the reference count by 1.


Take an ownership of this object by calling this function. Call Release() to give up ownership. Once the reference count reaches zero, the object will self destruct.

See also
Release()

◆ get_StaticRTTI()

const Burger::StaticRTTI * Burger::ReferenceCounter::get_StaticRTTI ( void ) const
overridevirtualnoexcept

Get the description to the class.


This virtual function will pull the pointer to the StaticRTTI instance that has the name of the class. Due to it being virtual, it will be the name of the most derived class.

Returns
Pointer to a global, read only instance of StaticRTTI for the true class

Reimplemented from Burger::Base.

Reimplemented in Burger::Flash::SharedBuffer, Burger::Shader2DCColor, Burger::Shader2DCColorDX9, Burger::Shader2DCColorOpenGL, Burger::Shader2DColorVertex, Burger::Shader2DColorVertexDX9, Burger::Shader2DColorVertexOpenGL, Burger::SoundBufferRez, Burger::Texture, Burger::TextureDirectX9, Burger::TextureOpenGL, Burger::VertexBuffer, Burger::VertexBufferDirectX9, Burger::VertexBufferOpenGL, and Burger::WeakAndStrongBase.

◆ operator=() [1/2]

ReferenceCounter & Burger::ReferenceCounter::operator= ( const ReferenceCounter & )
privatedelete

◆ operator=() [2/2]

ReferenceCounter & Burger::ReferenceCounter::operator= ( ReferenceCounter && )
privatedelete

◆ Release()

void Burger::ReferenceCounter::Release ( void )
inlinenoexcept

Decrease the reference count by 1.


Give up ownership of this object by calling this function. Once the reference count reaches zero, the object will immediately self destruct. Call AddRef() to take ownership of this object.

See also
AddRef()

Member Data Documentation

◆ g_StaticRTTI

const Burger::StaticRTTI Burger::ReferenceCounter::g_StaticRTTI
static

The global description of the class.


This record contains the name of this class and a reference to the parent

◆ m_uRefCount

uint_t Burger::ReferenceCounter::m_uRefCount
private

Number of smart pointers that are claiming ownership of this object.