Kanzi 3.9.10
kanzi::ReferenceCountScopeGuard< CounterType, FunctorType > Class Template Reference

Reference count scope guard. More...

#include <kanzi/core/util/reference_count_scope_guard.hpp>

Public Member Functions

 ReferenceCountScopeGuard (CounterType &counter, FunctorType endCallback)
 Constructor.
 
void release ()
 Release the guard, executing the callback if guard reaches 0.
 
 ~ReferenceCountScopeGuard ()
 Destructor.
 

Detailed Description

template<typename CounterType, typename FunctorType>
class kanzi::ReferenceCountScopeGuard< CounterType, FunctorType >

Reference count scope guard.

Increments given counter on creation, decrements on destruction or on explicit call to release.

Constructor & Destructor Documentation

◆ ReferenceCountScopeGuard()

kanzi::ReferenceCountScopeGuard< CounterType, FunctorType >::ReferenceCountScopeGuard ( CounterType & counter,
FunctorType endCallback )
inlineexplicit

Constructor.

Parameters
counterCounter to take ownership of.
endCallbackFunction to run if counter reaches 0 on release.

◆ ~ReferenceCountScopeGuard()

Member Function Documentation

◆ release()

Release the guard, executing the callback if guard reaches 0.


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