Cross-Platform C++

ot
class AtomicCounter

#include "ot/base/AtomicCounter.h"

Integer value that can be incremented and decremented. In a multi-threaded environment, access to the counter is synchronized to prevent lost updates.




Constructor/Destructor Summary
AtomicCounter()
         Default constructor.
AtomicCounter(long n)
         Constructs an AtomicCounter with an initial value.

Method Summary
 unsigned long operator--()
         Prefix decrement operator.
 unsigned long operator--(int )
         Postfix decrement operator.
  operator unsigned long() const
         Conversion operator.
 unsigned long operator++()
         Prefix increment operator.
 unsigned long operator++(int )
         Postfix increment operator.
 unsigned long operator=(long n)
         Assignment operator.

Constructor/Destructor Detail

AtomicCounter

 AtomicCounter()
Default constructor. Initializes the counter to zero.


AtomicCounter

 AtomicCounter(long n)
Constructs an AtomicCounter with an initial value.

Parameters:
n - the initial value of the counter.

Method Detail

operator--

unsigned long operator--()
Prefix decrement operator. Decrements the counter by one and returns the new value as a synchronized atomic operation.


operator--

unsigned long operator--(int )
Postfix decrement operator. Decrements the counter by one and returns the original value as a synchronized atomic operation.


operator unsigned long

 operator unsigned long() const
Conversion operator. Returns the current value of the counter.


operator++

unsigned long operator++()
Prefix increment operator. Increments the counter by one and returns the new value as a single atomic operation.


operator++

unsigned long operator++(int )
Postfix increment operator. Increments the counter by one and returns the original value as a synchronized atomic operation.


operator=

unsigned long operator=(long n)
Assignment operator. Assigns a new value to the AtomicCounter.

Parameters:
n - the new value of the counter.
Returns:
the new value


Cross-Platform C++

Found a bug or missing feature? Please email us at support@elcel.com

Copyright © 2000-2003 ElCel Technology   Trademark Acknowledgements