Template Class ReferenceCounter

Class Documentation

template<typename T>
class ReferenceCounter

reference counter abstraction for the usage in constructs like a shared_ptr. A pointer to a memory position where the reference counter is stored is put into the constructor and then this object performs reference counting on it.

Public Functions

ReferenceCounter(T *const referenceCounter) noexcept

increments f_referenceCounter if f_referenceCounter != nullptr

Parameters:

referenceCounter[in] pointer to the underlying number where the reference count is stored

ReferenceCounter(const ReferenceCounter &rhs) noexcept

copy constructor, increments the rhs managed reference counter if it is != nullptr

ReferenceCounter(ReferenceCounter &&f_rhs) noexcept

move constructor, takes over the f_rhs managed reference counter

~ReferenceCounter() noexcept

decrements f_referenceCounter if f_referenceCounter != nullptr

ReferenceCounter &operator=(const ReferenceCounter &rhs) noexcept

copy assignment, increments the rhs managed reference counter if it is != nullptr

ReferenceCounter &operator=(ReferenceCounter &&rhs) noexcept

move assignment

T getValue() const noexcept

returns the current value of the reference counter