Main MRPT website > C++ reference
MRPT logo
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
mrpt::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 26 of file CColouredPointsMap.h.

#include <mrpt/slam/CColouredPointsMap.h>

Public Types

typedef int 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

◆ atomic_num_t

Definition at line 32 of file CColouredPointsMap.h.

Constructor & Destructor Documentation

◆ CAtomicCounter() [1/2]

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

Definition at line 35 of file CColouredPointsMap.h.

◆ CAtomicCounter() [2/2]

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

Forbidden method.

Member Function Documentation

◆ operator atomic_num_t()

mrpt::mrpt::synch::CAtomicCounter::operator atomic_num_t ( ) const

Get current value.

◆ operator++()

void mrpt::mrpt::synch::CAtomicCounter::operator++ ( )

Atomic increment of value.

◆ operator--()

atomic_num_t mrpt::mrpt::synch::CAtomicCounter::operator-- ( )

Atomic decrement of value and return new value.

◆ operator=()

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

Forbidden method.

Member Data Documentation

◆ m_value

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

Definition at line 43 of file CColouredPointsMap.h.




Page generated by Doxygen 1.8.14 for MRPT 1.1.0 SVN: at lun oct 28 00:54:49 CET 2019 Hosted on:
SourceForge.net Logo