Main MRPT website > C++ reference for MRPT 1.5.7
List of all members | Public Member Functions | Private Member Functions | Private Attributes
mrpt::synch::CAtomicCounter Class Reference

Detailed Description

This class acts exactly as an int (or long) variable, but with atomic increment and decrement operators.

This is a useful component of thread-safe smart pointers.

Definition at line 24 of file atomic_incr.h.

#include <mrpt/synch/atomic_incr.h>

Public Member Functions

 CAtomicCounter ()
 
 CAtomicCounter (long v)
 
 ~CAtomicCounter ()
 
void operator++ ()
 Atomic increment of value. More...
 
long operator-- ()
 Atomic decrement of value and return new value. More...
 
 operator long () const
 Get current value. More...
 

Private Member Functions

 CAtomicCounter (CAtomicCounter const &)
 Forbidden method. More...
 
CAtomicCounteroperator= (CAtomicCounter const &)
 Forbidden method. More...
 

Private Attributes

long * m_atomic
 opaque ptr to C++11 std::atomic_long More...
 

Constructor & Destructor Documentation

◆ CAtomicCounter() [1/3]

CAtomicCounter::CAtomicCounter ( )

Definition at line 21 of file atomic_incr.cpp.

◆ CAtomicCounter() [2/3]

CAtomicCounter::CAtomicCounter ( long  v)
explicit

Definition at line 23 of file atomic_incr.cpp.

References MY_ATOMIC.

◆ ~CAtomicCounter()

CAtomicCounter::~CAtomicCounter ( )

Definition at line 27 of file atomic_incr.cpp.

References m_atomic.

◆ CAtomicCounter() [3/3]

mrpt::synch::CAtomicCounter::CAtomicCounter ( CAtomicCounter const &  )
private

Forbidden method.

Member Function Documentation

◆ operator long()

CAtomicCounter::operator long ( ) const

Get current value.

Definition at line 34 of file atomic_incr.cpp.

References MY_ATOMIC.

◆ operator++()

void CAtomicCounter::operator++ ( )

Atomic increment of value.

Definition at line 32 of file atomic_incr.cpp.

References MY_ATOMIC.

◆ operator--()

long CAtomicCounter::operator-- ( )

Atomic decrement of value and return new value.

Definition at line 33 of file atomic_incr.cpp.

References MY_ATOMIC.

◆ operator=()

CAtomicCounter& mrpt::synch::CAtomicCounter::operator= ( CAtomicCounter const &  )
private

Forbidden method.

Member Data Documentation

◆ m_atomic

long* mrpt::synch::CAtomicCounter::m_atomic
private

opaque ptr to C++11 std::atomic_long

Definition at line 35 of file atomic_incr.h.

Referenced by ~CAtomicCounter().




Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 8277875f6 Mon Jun 11 02:47:32 2018 +0200 at lun oct 28 01:50:49 CET 2019