RefCounted
RefCounted
#include <icy/memory.h>template<typename T>
class RefCountedDefined in src/base/include/icy/memory.h:57
Subclassed by:
PacketTransaction< Message >,Context< uv_pipe_t >,Context< uv_tcp_t >,Context< uv_udp_t >,Context< uv_idle_t >,Context< uv_process_t >,Context< uv_async_t >,Context< uv_timer_t >
Base class for intrusive reference counting.
Embeds the refcount in the object itself - no separate control block allocation, no atomic operations. Safe for single-threaded libuv loops.
Usage: inherit from RefCounted
List of all members
| Name | Kind | Owner |
|---|---|---|
RefCounted | function | Declared here |
RefCounted | function | Declared here |
operator= | function | Declared here |
addRef | function | Declared here |
releaseRef | function | Declared here |
refCount | function | Declared here |
~RefCounted | function | Declared here |
_refCount | variable | Declared here |
Public Methods
| Return | Name | Description |
|---|---|---|
RefCounted | Defaulted constructor. | |
RefCounted inline noexcept | ||
void | addRef const inline noexcept | Increments the reference count. Called by IntrusivePtr on acquisition. |
bool | releaseRef const inline noexcept | Decrements the reference count. |
int | refCount const inline noexcept | Returns the current reference count. |
RefCounted
RefCounted() = defaultDefined in src/base/include/icy/memory.h:60
Defaulted constructor.
RefCounted
inline noexcept
inline RefCounted(const RefCounted &) noexceptDefined in src/base/include/icy/memory.h:61
addRef
const inline noexcept
inline void addRef() const noexceptDefined in src/base/include/icy/memory.h:65
Increments the reference count. Called by IntrusivePtr on acquisition.
releaseRef
const inline noexcept
inline bool releaseRef() const noexceptDefined in src/base/include/icy/memory.h:69
Decrements the reference count.
Returns
true if the count reached zero (caller should delete the object).
refCount
const inline noexcept
inline int refCount() const noexceptDefined in src/base/include/icy/memory.h:73
Returns the current reference count.
Returns
Current reference count.
Private Attributes
| Return | Name | Description |
|---|---|---|
int | _refCount |
_refCount
int _refCount = 0