kanzi::ScopedRefCounter Class Reference

Scoped reference counter, which takes an unsigned integer value as argument on construction to track. More...

#include <kanzi/core/cpp/utility.hpp>

Public Member Functions

 ScopedRefCounter (size_t &counter)
 Constructs the reference counter and increments its value. More...
 
 ~ScopedRefCounter ()
 Destroys the reference counter and decrements the tracked counter. More...
 
size_t count () const
 Returns the reference counter tracked. More...
 

Detailed Description

Scoped reference counter, which takes an unsigned integer value as argument on construction to track.

Use the class to guard incremental calls on an object.

Constructor & Destructor Documentation

kanzi::ScopedRefCounter::ScopedRefCounter ( size_t &  counter)
inlineexplicit

Constructs the reference counter and increments its value.

Parameters
counterReference to the counter to track.
kanzi::ScopedRefCounter::~ScopedRefCounter ( )
inline

Destroys the reference counter and decrements the tracked counter.

Member Function Documentation

size_t kanzi::ScopedRefCounter::count ( ) const
inline

Returns the reference counter tracked.


The documentation for this class was generated from the following file: