strusBase  0.17
Public Member Functions | List of all members
strus::AtomicCounter< IntegralCounterType > Class Template Reference

#include <atomic.hpp>

Inheritance diagram for strus::AtomicCounter< IntegralCounterType >:
strus::atomic< IntegralCounterType >

Public Member Functions

 AtomicCounter (IntegralCounterType initialValue_=0)
 Constructor. More...
 
void increment (IntegralCounterType val=1)
 Increment of the counter. More...
 
void decrement (IntegralCounterType val=1)
 Decrement of the counter. More...
 
IntegralCounterType allocIncrement (IntegralCounterType val=1)
 Increment of the counter. More...
 
IntegralCounterType value () const
 Increment of the counter. More...
 
void set (const IntegralCounterType &val)
 Initialization of the counter. More...
 
bool test_and_set (IntegralCounterType testval, IntegralCounterType newval)
 Compare current value with 'testval', change it to 'newval' if matches. More...
 
- Public Member Functions inherited from strus::atomic< IntegralCounterType >
 atomic (IntegralCounterTypevalue)
 
 atomic (const atomic &o)
 

Constructor & Destructor Documentation

template<typename IntegralCounterType >
strus::AtomicCounter< IntegralCounterType >::AtomicCounter ( IntegralCounterType  initialValue_ = 0)
inline

Constructor.

Member Function Documentation

template<typename IntegralCounterType >
IntegralCounterType strus::AtomicCounter< IntegralCounterType >::allocIncrement ( IntegralCounterType  val = 1)
inline

Increment of the counter.

Returns
the new value of the counter after the increment operation
template<typename IntegralCounterType >
void strus::AtomicCounter< IntegralCounterType >::decrement ( IntegralCounterType  val = 1)
inline

Decrement of the counter.

template<typename IntegralCounterType >
void strus::AtomicCounter< IntegralCounterType >::increment ( IntegralCounterType  val = 1)
inline

Increment of the counter.

template<typename IntegralCounterType >
void strus::AtomicCounter< IntegralCounterType >::set ( const IntegralCounterType &  val)
inline

Initialization of the counter.

Parameters
[in]valthe value of the counter
template<typename IntegralCounterType >
bool strus::AtomicCounter< IntegralCounterType >::test_and_set ( IntegralCounterType  testval,
IntegralCounterType  newval 
)
inline

Compare current value with 'testval', change it to 'newval' if matches.

Parameters
[in]testvalthe value of the counter
[in]newvalthe value of the counter
Returns
true on success
template<typename IntegralCounterType >
IntegralCounterType strus::AtomicCounter< IntegralCounterType >::value ( ) const
inline

Increment of the counter.

Returns
the current value of the counter

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