Plasma Engine  2.0
Loading...
Searching...
No Matches
plAtomicInteger< T > Class Template Reference

Integer class that can be manipulated in an atomic (i.e. thread-safe) fashion. More...

#include <AtomicInteger.h>

Public Member Functions

 PL_DECLARE_POD_TYPE ()
 
 plAtomicInteger ()
 Initializes the value to zero.
 
 plAtomicInteger (const T value)
 Initializes the object with a value.
 
 plAtomicInteger (const plAtomicInteger< T > &value)
 Copy-constructor.
 
plAtomicIntegeroperator= (T value)
 Assigns a new integer value to this object.
 
plAtomicIntegeroperator= (const plAtomicInteger &value)
 Assignment operator.
 
Increment ()
 Increments the internal value and returns the incremented value.
 
Decrement ()
 Decrements the internal value and returns the decremented value.
 
PostIncrement ()
 Increments the internal value and returns the value immediately before the increment.
 
PostDecrement ()
 Decrements the internal value and returns the value immediately before the decrement.
 
void Add (T x)
 
void Subtract (T x)
 
void And (T x)
 
void Or (T x)
 
void Xor (T x)
 
void Min (T x)
 
void Max (T x)
 
Set (T x)
 Sets the internal value to x and returns the original internal value.
 
bool TestAndSet (T expected, T x)
 Sets the internal value to x if the internal value is equal to expected and returns true, otherwise does nothing and returns false.
 
CompareAndSwap (T expected, T x)
 If this is equal to expected, it is set to value. Otherwise it won't be modified. Always returns the previous value of this before the modification.
 
 operator T () const
 

Detailed Description

template<typename T>
class plAtomicInteger< T >

Integer class that can be manipulated in an atomic (i.e. thread-safe) fashion.


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