DUNE: Uniform Navigational Environment  2016.09.0
DUNE::Concurrency::AtomicInteger Class Reference

Public Member Functions

 AtomicInteger (void)
 
 AtomicInteger (long val)
 
 AtomicInteger (const AtomicInteger &other)
 
AtomicIntegeroperator= (long val)
 
AtomicIntegeroperator= (const AtomicInteger &other)
 
long value (void)
 
long increment (void)
 
long decrement (void)
 
bool incrementAndCompare (long val=0)
 
bool decrementAndCompare (long val=0)
 
long swap (long val)
 
bool compareAndSwap (long expected, long val)
 

Constructor & Destructor Documentation

DUNE::Concurrency::AtomicInteger::AtomicInteger ( void  )
inline

Initialize the internal value with 0.

DUNE::Concurrency::AtomicInteger::AtomicInteger ( long  val)
inline

Initialize the internal value of the object.

Parameters
valinitialization value.
DUNE::Concurrency::AtomicInteger::AtomicInteger ( const AtomicInteger other)
inline

References value().

Member Function Documentation

bool DUNE::Concurrency::AtomicInteger::compareAndSwap ( long  expected,
long  val 
)
inline

Exchange the internal value with a new one if it matches an expected value.

Parameters
expectedexpected value.
valexchange value.
Returns
true if an exchange took place, false otherwise.
long DUNE::Concurrency::AtomicInteger::decrement ( void  )
inline

Decrement the internal value by 1.

Returns
new value of the integer.

Referenced by decrementAndCompare().

bool DUNE::Concurrency::AtomicInteger::decrementAndCompare ( long  val = 0)
inline

Decrement the internal value by 1 and compare with a value.

Parameters
valcomparison value.
Returns
true if the result of the decrementation and comparison value are equal, false otherwise.

References decrement().

long DUNE::Concurrency::AtomicInteger::increment ( void  )
inline

Increment the internal value by 1.

Returns
new value of the integer.

Referenced by incrementAndCompare().

bool DUNE::Concurrency::AtomicInteger::incrementAndCompare ( long  val = 0)
inline

Increment the internal value by 1 and compare with a value.

Parameters
valcomparison value.
Returns
true if the result of the incrementation and comparison value are equal, false otherwise.

References increment().

AtomicInteger& DUNE::Concurrency::AtomicInteger::operator= ( long  val)
inline
AtomicInteger& DUNE::Concurrency::AtomicInteger::operator= ( const AtomicInteger other)
inline

References value().

long DUNE::Concurrency::AtomicInteger::swap ( long  val)
inline

Exchange the internal value with a new one.

Parameters
valexchange value.
Returns
internal value before the exchange.
long DUNE::Concurrency::AtomicInteger::value ( void  )
inline

Retrieve internal value.

Returns
internal value.

Referenced by AtomicInteger(), and operator=().

Collaboration diagram for DUNE::Concurrency::AtomicInteger:
Collaboration graph