Rebel Fork Framework
Urho3D::RefCount Struct Reference

Reference count structure. More...

#include <Urho3D/Container/RefCounted.h>

Public Member Functions

 ~RefCount ()
 Destruct.
 
int AddRefStrong ()
 
int ReleaseRefStrong ()
 
int AddRefWeak ()
 
int ReleaseRefWeak ()
 
bool TryAddRefStrong ()
 
void MarkObjectDestroyed ()
 Mark object as destroyed.
 
int Refs () const
 Return strong reference count.
 
int WeakRefs () const
 Return weak reference count.
 

Static Public Member Functions

static RefCountAllocate ()
 Allocate RefCount using its default allocator.
 
static void Free (RefCount *instance)
 Free RefCount using its default allocator.
 

Protected Types

using Allocator = EASTLAllocatorType
 

Protected Member Functions

 RefCount ()=default
 Construct.
 

Private Attributes

std::atomic_int32_t refs_ {0}
 Reference count. If below zero, the object has been destroyed.
 
std::atomic_int32_t weakRefs_ {0}
 Weak reference count.
 

Detailed Description

Reference count structure.

Member Function Documentation

◆ AddRefStrong()

int Urho3D::RefCount::AddRefStrong ( )
inline

Add strong reference. Returns new reference count. If the object has been destroyed, behavior is undefined.

◆ AddRefWeak()

int Urho3D::RefCount::AddRefWeak ( )
inline

Add weak reference. Returns new reference count. If the control block has been destroyed, behavior is undefined.

◆ ReleaseRefStrong()

int Urho3D::RefCount::ReleaseRefStrong ( )
inline

Release strong reference. Returns new reference count. If 0 is returned, the object must be destroyed immediately. If the object has been destroyed, behavior is undefined.

◆ ReleaseRefWeak()

int Urho3D::RefCount::ReleaseRefWeak ( )
inline

Release weak reference. Returns new reference count. If 0 is returned, the control block must be destroyed immediately.

◆ TryAddRefStrong()

bool Urho3D::RefCount::TryAddRefStrong ( )
inline

Try add strong reference. The object may be destroyed. Returns true if strong reference was added.


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