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. More...
 
 ~ReferenceCountScopeGuard ()
 Destructor. More...
 
void release ()
 Release the guard, executing the callback if guard reaches 0. More...
 

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

template<typename CounterType , typename FunctorType >
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.
template<typename CounterType , typename FunctorType >
kanzi::ReferenceCountScopeGuard< CounterType, FunctorType >::~ReferenceCountScopeGuard ( )
inline

Destructor.

Member Function Documentation

template<typename CounterType , typename FunctorType >
void kanzi::ReferenceCountScopeGuard< CounterType, FunctorType >::release ( )
inline

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


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