Tkrzw
Public Member Functions | List of all members
tkrzw::ScopedCounter< T > Class Template Referencefinal

Scoped counter for auto increment and decrement. More...

#include <tkrzw_thread_util.h>

Public Member Functions

 ScopedCounter (T *count, int32_t increment=1)
 Constructor. More...
 
 ~ScopedCounter ()
 Destructor. More...
 
 ScopedCounter (const ScopedCounter &rhs)=delete
 Copy and assignment are disabled. More...
 
ScopedCounteroperator= (const ScopedCounter &rhs)=delete
 

Detailed Description

template<typename T>
class tkrzw::ScopedCounter< T >

Scoped counter for auto increment and decrement.

Constructor & Destructor Documentation

◆ ScopedCounter() [1/2]

template<typename T >
tkrzw::ScopedCounter< T >::ScopedCounter ( T *  count,
int32_t  increment = 1 
)
explicit

Constructor.

Parameters
countThe pointer to the counter object.
incrementThe value to add in the constructor and subtract in the destructor.

◆ ~ScopedCounter()

template<typename T >
tkrzw::ScopedCounter< T >::~ScopedCounter

Destructor.

◆ ScopedCounter() [2/2]

template<typename T >
tkrzw::ScopedCounter< T >::ScopedCounter ( const ScopedCounter< T > &  rhs)
explicitdelete

Copy and assignment are disabled.