Main MRPT website > C++ reference for MRPT 1.5.6
List of all members | Public Types | 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.

Note
Based on code from the Boost library.

Definition at line 37 of file atomic_incr.h.

#include <mrpt/synch/atomic_incr.h>

Public Types

typedef long atomic_num_t
 

Public Member Functions

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

Private Member Functions

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

Private Attributes

atomic_num_t m_value
 

Member Typedef Documentation

Definition at line 43 of file atomic_incr.h.

Constructor & Destructor Documentation

mrpt::synch::CAtomicCounter::CAtomicCounter ( long  v)
inlineexplicit

Definition at line 48 of file atomic_incr.h.

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

Forbidden method.

Member Function Documentation

CAtomicCounter::operator CAtomicCounter::atomic_num_t ( ) const

Get current value.

Definition at line 105 of file atomic_incr.cpp.

References m_value.

void CAtomicCounter::operator++ ( )

Atomic increment of value.

Definition at line 95 of file atomic_incr.cpp.

References m_value.

CAtomicCounter::atomic_num_t CAtomicCounter::operator-- ( )

Atomic decrement of value and return new value.

Definition at line 100 of file atomic_incr.cpp.

References m_value.

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

Forbidden method.

Member Data Documentation

atomic_num_t mrpt::synch::CAtomicCounter::m_value
mutableprivate

Definition at line 56 of file atomic_incr.h.

Referenced by operator atomic_num_t(), operator++(), and operator--().




Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018