AtomicCounter Class Reference

An integer counter whose value is modified in an atomic fashion. More...

#include <AtomicCounter.h++>

List of all members.

Public Member Functions

 AtomicCounter (int32_t value=0) throw ()
 Construct a new AtomicCounter with the given initial value.
 ~AtomicCounter () throw ()
 Destructor.
 AtomicCounter (const AtomicCounter &other) throw ()
 Copy constructor.
AtomicCounteroperator= (const AtomicCounter &other) throw ()
 Assignment operator.
int32_t operator++ () throw ()
 Increment the counter (prefix).
int32_t operator++ (int) throw ()
 Increment the counter (postfix).
int32_t operator-- () throw ()
 Decrement the counter (prefix).
int32_t operator-- (int) throw ()
 Decrement the counter (postfix).
int32_t operator+= (int32_t delta) throw ()
 Add a value to the counter.
int32_t operator-= (int32_t delta) throw ()
 Subtract a value from the counter.
int32_t operator+ (int32_t delta) const throw ()
 Compute the sum of the counter and a value.
int32_t operator- (int32_t delta) const throw ()
 Compute the difference between the counter and a value.
int32_t operator= (int32_t value) throw ()
 Assign a new value to the counter.
int32_t set (int32_t value) throw ()
 Assign a new value to the counter, returning the new value.
int32_t swap (int32_t value) throw ()
 Assign a new value to the counter, returning the previous value.
int32_t testAndSet (int32_t value, int32_t comparand) throw ()
 Test and set the counter value.
int32_t get () const throw ()
 Get the current value of the counter.
 operator int32_t () const throw ()
 Cast operator.


Detailed Description

An integer counter whose value is modified in an atomic fashion.

Author:
Mark Lindner

Constructor & Destructor Documentation

AtomicCounter ( int32_t  value = 0  )  throw ()

Construct a new AtomicCounter with the given initial value.

Parameters:
value The initial value.

~AtomicCounter (  )  throw ()

Destructor.

AtomicCounter ( const AtomicCounter other  )  throw ()

Copy constructor.


Member Function Documentation

int32_t get (  )  const throw ()

Get the current value of the counter.

operator int32_t (  )  const throw () [inline]

Cast operator.

int32_t operator+ ( int32_t  delta  )  const throw ()

Compute the sum of the counter and a value.

int32_t operator++ ( int   )  throw ()

Increment the counter (postfix).

int32_t operator++ (  )  throw ()

Increment the counter (prefix).

int32_t operator+= ( int32_t  delta  )  throw ()

Add a value to the counter.

int32_t operator- ( int32_t  delta  )  const throw ()

Compute the difference between the counter and a value.

int32_t operator-- ( int   )  throw ()

Decrement the counter (postfix).

int32_t operator-- (  )  throw ()

Decrement the counter (prefix).

int32_t operator-= ( int32_t  delta  )  throw ()

Subtract a value from the counter.

int32_t operator= ( int32_t  value  )  throw ()

Assign a new value to the counter.

AtomicCounter & operator= ( const AtomicCounter other  )  throw ()

Assignment operator.

int32_t set ( int32_t  value  )  throw ()

Assign a new value to the counter, returning the new value.

int32_t swap ( int32_t  value  )  throw ()

Assign a new value to the counter, returning the previous value.

int32_t testAndSet ( int32_t  value,
int32_t  comparand 
) throw ()

Test and set the counter value.

Parameters:
comparand The value to compare the counter to.
value The value to set the counter to, if the current value is equal to the comparand.
Returns:
The original (and possibly unchanged) value of the counter.


The documentation for this class was generated from the following files:

Generated on Sat Apr 17 23:03:07 2010 for libcommonc++ by  doxygen 1.5.9