cds  2.3.2
cds::atomicity::event_counter Class Reference

Atomic event counter. More...

#include <cds/algo/atomic.h>

Public Types

typedef size_t value_type
 Type of counter.
 

Public Member Functions

value_type operator= (value_type n) noexcept
 Assign operator. More...
 
size_t operator+= (size_t n) noexcept
 Addition. More...
 
size_t operator-= (size_t n) noexcept
 Substraction. More...
 
 operator size_t () const noexcept
 Get current value of the counter.
 
size_t operator++ () noexcept
 Preincrement.
 
size_t operator++ (int) noexcept
 Postincrement.
 
size_t operator-- () noexcept
 Predecrement.
 
size_t operator-- (int) noexcept
 Postdecrement.
 
size_t get () const noexcept
 Get current value of the counter.
 
void reset () noexcept
 Resets the counter to 0.
 

Detailed Description

Atomic event counter.

This class is based on std::atomic_size_t. It uses relaxed memory ordering memory_order_relaxed and may be used as a statistic counter.

Member Function Documentation

◆ operator+=()

size_t cds::atomicity::event_counter::operator+= ( size_t  n)
inlinenoexcept

Addition.

Returns new value of the atomic counter.

Parameters
naddendum

◆ operator-=()

size_t cds::atomicity::event_counter::operator-= ( size_t  n)
inlinenoexcept

Substraction.

Returns new value of the atomic counter.

Parameters
nsubtrahend

◆ operator=()

value_type cds::atomicity::event_counter::operator= ( value_type  n)
inlinenoexcept

Assign operator.

Returns n.

Parameters
nnew value of the counter

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

cds 2.3.2 Developed by Maxim Khizhinsky aka khizmax and other contributors 2007 - 2017
Autogenerated Sun Dec 31 2017 12:10:15 by Doxygen 1.8.13