![]() |
ezEngine Release 25.08
|
Integer class that can be manipulated in an atomic (i.e. thread-safe) fashion. More...
#include <AtomicInteger.h>
Public Member Functions | |
| EZ_DECLARE_POD_TYPE () | |
| ezAtomicInteger () | |
| Initializes the value to zero. | |
| ezAtomicInteger (const T value) | |
| Initializes the object with a value. | |
| ezAtomicInteger (const ezAtomicInteger< T > &value) | |
| Copy-constructor. | |
| ezAtomicInteger & | operator= (T value) |
| Assigns a new integer value to this object. | |
| ezAtomicInteger & | operator= (const ezAtomicInteger &value) |
| Assignment operator. | |
| T | Increment () |
| Increments the internal value and returns the incremented value. | |
| T | Decrement () |
| Decrements the internal value and returns the decremented value. | |
| T | PostIncrement () |
| Increments the internal value and returns the value immediately before the increment. | |
| T | 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) |
| T | 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. | |
| T | 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 | |
Integer class that can be manipulated in an atomic (i.e. thread-safe) fashion.