Skip to content

iox::cxx::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. More...

#include <reference_counter.hpp>

Public Functions🔗

Name
ReferenceCounter(T *const referenceCounter)
increments f_referenceCounter if f_referenceCounter != nullptr
ReferenceCounter(const ReferenceCounter & rhs)
copy constructor, increments the rhs managed reference counter if it is != nullptr
ReferenceCounter(ReferenceCounter && f_rhs)
move constructor, takes over the f_rhs managed reference counter
~ReferenceCounter()
decrements f_referenceCounter if f_referenceCounter != nullptr
ReferenceCounter & operator=(const ReferenceCounter & rhs)
copy assignment, increments the rhs managed reference counter if it is != nullptr
ReferenceCounter & operator=(ReferenceCounter && rhs)
move assignment
T getValue() const
returns the current value of the reference counter

Detailed Description🔗

template <typename T >
class iox::cxx::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 Documentation🔗

function ReferenceCounter🔗

inline ReferenceCounter(
    T *const referenceCounter
)

increments f_referenceCounter if f_referenceCounter != nullptr

Parameters:

  • referenceCounter pointer to the underlying number where the reference count is stored

function ReferenceCounter🔗

inline ReferenceCounter(
    const ReferenceCounter & rhs
)

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

function ReferenceCounter🔗

inline ReferenceCounter(
    ReferenceCounter && f_rhs
)

move constructor, takes over the f_rhs managed reference counter

function ~ReferenceCounter🔗

inline ~ReferenceCounter()

decrements f_referenceCounter if f_referenceCounter != nullptr

function operator=🔗

inline ReferenceCounter & operator=(
    const ReferenceCounter & rhs
)

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

function operator=🔗

inline ReferenceCounter & operator=(
    ReferenceCounter && rhs
)

move assignment

function getValue🔗

inline T getValue() const

returns the current value of the reference counter


Updated on 31 May 2022 at 15:29:15 CEST