An integer counter whose value is modified in an atomic fashion. More...
#include <InterlockCounter.h>
Public Member Functions | |
InterlockCounter (int32 value=0) throw () | |
~InterlockCounter () throw () | |
InterlockCounter (const InterlockCounter &other) throw () | |
InterlockCounter & | operator= (const InterlockCounter &other) throw () |
int32 | operator++ () throw () |
int32 | operator++ (int) throw () |
int32 | operator-- () throw () |
int32 | operator-- (int) throw () |
int32 | operator+= (int32 delta) throw () |
int32 | operator-= (int32 delta) throw () |
int32 | operator+ (int32 delta) const throw () |
int32 | operator- (int32 delta) const throw () |
int32 | operator= (int32 value) throw () |
int32 | Set (int32 value) throw () |
int32 | Swap (int32 value) throw () |
bool | operator> (int32 i) const |
bool | operator>= (int32 i) const |
bool | operator< (int32 i) const |
bool | operator<= (int32 i) const |
bool | operator!= (int32 i) const |
int32 | TestAndSet (int32 value, int32 comparand) throw () |
int32 | Get () const throw () |
operator int32 () const throw () |
An integer counter whose value is modified in an atomic fashion.
Definition at line 39 of file InterlockCounter.h.
InterlockCounter::InterlockCounter | ( | int32 | value = 0 |
) | throw () |
Construct a new AtomicCounter with the given initial value.
value | The initial value. |
Definition at line 213 of file InterlockCounter.cpp.
InterlockCounter::~InterlockCounter | ( | ) | throw () |
Destructor.
Definition at line 221 of file InterlockCounter.cpp.
InterlockCounter::InterlockCounter | ( | const InterlockCounter & | other | ) | throw () |
Copy constructor.
Definition at line 344 of file InterlockCounter.cpp.
int32 InterlockCounter::Get | ( | ) | const throw () |
Get the current value of the counter.
Definition at line 316 of file InterlockCounter.cpp.
Referenced by operator int32().
InterlockCounter::operator int32 | ( | ) | const throw () [inline] |
int32 InterlockCounter::operator+ | ( | int32 | delta | ) | const throw () |
Compute the sum of the counter and a value.
Definition at line 282 of file InterlockCounter.cpp.
int32 InterlockCounter::operator++ | ( | int | ) | throw () |
Increment the counter (postfix).
Definition at line 237 of file InterlockCounter.cpp.
int32 InterlockCounter::operator++ | ( | ) | throw () |
Increment the counter (prefix).
Definition at line 228 of file InterlockCounter.cpp.
int32 InterlockCounter::operator+= | ( | int32 | delta | ) | throw () |
Add a value to the counter.
Definition at line 266 of file InterlockCounter.cpp.
int32 InterlockCounter::operator- | ( | int32 | delta | ) | const throw () |
Compute the difference between the counter and a value.
Definition at line 290 of file InterlockCounter.cpp.
int32 InterlockCounter::operator-- | ( | int | ) | throw () |
Decrement the counter (postfix).
Definition at line 256 of file InterlockCounter.cpp.
int32 InterlockCounter::operator-- | ( | ) | throw () |
Decrement the counter (prefix).
Definition at line 247 of file InterlockCounter.cpp.
int32 InterlockCounter::operator-= | ( | int32 | delta | ) | throw () |
Subtract a value from the counter.
Definition at line 274 of file InterlockCounter.cpp.
int32 InterlockCounter::operator= | ( | int32 | value | ) | throw () |
Assign a new value to the counter.
Definition at line 298 of file InterlockCounter.cpp.
InterlockCounter & InterlockCounter::operator= | ( | const InterlockCounter & | other | ) | throw () |
Assignment operator.
Definition at line 352 of file InterlockCounter.cpp.
int32 InterlockCounter::Set | ( | int32 | value | ) | throw () |
Assign a new value to the counter, returning the new value.
Definition at line 308 of file InterlockCounter.cpp.
int32 InterlockCounter::Swap | ( | int32 | value | ) | throw () |
Assign a new value to the counter, returning the previous value.
Definition at line 328 of file InterlockCounter.cpp.
int32 InterlockCounter::TestAndSet | ( | int32 | value, | |
int32 | comparand | |||
) | throw () |
Test and set the counter value.
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. |
Definition at line 336 of file InterlockCounter.cpp.