MRPT logo

mrpt::synch::CAtomicCounter Class Reference

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

#include <mrpt/synch/atomic_incr.h>

List of all members.

Public Types

typedef int atomic_num_t

Public Member Functions

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

Private Member Functions

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

Private Attributes

atomic_num_t m_value


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 46 of file atomic_incr.h.


Member Typedef Documentation

Definition at line 52 of file atomic_incr.h.


Constructor & Destructor Documentation

mrpt::synch::CAtomicCounter::CAtomicCounter ( long  v  )  [inline, explicit]

Definition at line 55 of file atomic_incr.h.

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

Forbidden method.


Member Function Documentation

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

Get current value.

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

Atomic increment of value.

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

Atomic decrement of value and return new value.

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

Forbidden method.


Member Data Documentation

Definition at line 63 of file atomic_incr.h.




Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 22:58:25 EDT 2009