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. | |
Reference count scope guard.
Increments given counter on creation, decrements on destruction or on explicit call to release.
|
inlineexplicit |
Constructor.
| counter | Counter to take ownership of. |
| endCallback | Function to run if counter reaches 0 on release. |
|
inline |
Destructor.
|
inline |
Release the guard, executing the callback if guard reaches 0.