AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agx::AtomicValueT< T > Class Template Reference

AtomicValueT template for integral types, all operations are atomic. More...

#include <AtomicValue.h>

Public Member Functions

 AtomicValueT (const agx::AtomicValueT< T > &av)
 
 AtomicValueT (T initialValue=0)
 
T add (T value)
 Add a value.
 
T compareAndSet (T test, T newValue)
 Compares the current value with a test value and if they are equal the value is replaced by a new value.
 
T dec ()
 Decrement the value.
 
T get () const
 Get the current value.
 
T inc ()
 Increment the value.
 
AtomicValueT< T > & operator= (const agx::AtomicValueT< T > &rhs)
 
AtomicValueT< T > & operator= (T value)
 Set the value ignoring the previous value, thus avoiding synchronization.
 
T set (T value)
 Set the value.
 
T sub (T value)
 Subtract a value.
 

Detailed Description

template<class T>
class agx::AtomicValueT< T >

AtomicValueT template for integral types, all operations are atomic.

Definition at line 30 of file AtomicValue.h.

Constructor & Destructor Documentation

◆ AtomicValueT() [1/2]

template<class T >
agx::AtomicValueT< T >::AtomicValueT ( T  initialValue = 0)
inlineexplicit

Definition at line 118 of file AtomicValue.h.

◆ AtomicValueT() [2/2]

template<class T >
agx::AtomicValueT< T >::AtomicValueT ( const agx::AtomicValueT< T > &  av)
inline

Definition at line 123 of file AtomicValue.h.

Member Function Documentation

◆ add()

template<class T >
T agx::AtomicValueT< T >::add ( T  value)
inline

Add a value.

Returns
The previous value

Definition at line 156 of file AtomicValue.h.

◆ compareAndSet()

template<class T >
T agx::AtomicValueT< T >::compareAndSet ( T  test,
T  newValue 
)
inline

Compares the current value with a test value and if they are equal the value is replaced by a new value.

Parameters
testThe value to compare with
newValueThe new value
Returns
The previous value

Definition at line 180 of file AtomicValue.h.

◆ dec()

template<class T >
T agx::AtomicValueT< T >::dec
inline

Decrement the value.

Returns
The previous value

Definition at line 174 of file AtomicValue.h.

◆ get()

template<class T >
T agx::AtomicValueT< T >::get
inline

Get the current value.

Definition at line 136 of file AtomicValue.h.

Referenced by agx::operator<<().

◆ inc()

template<class T >
T agx::AtomicValueT< T >::inc
inline

Increment the value.

Returns
The previous value

Definition at line 168 of file AtomicValue.h.

◆ operator=() [1/2]

template<class T >
AtomicValueT< T > & agx::AtomicValueT< T >::operator= ( const agx::AtomicValueT< T > &  rhs)
inline

Definition at line 129 of file AtomicValue.h.

◆ operator=() [2/2]

template<class T >
AtomicValueT< T > & agx::AtomicValueT< T >::operator= ( T  value)
inline

Set the value ignoring the previous value, thus avoiding synchronization.

Definition at line 148 of file AtomicValue.h.

◆ set()

template<class T >
T agx::AtomicValueT< T >::set ( T  value)
inline

Set the value.

Returns
The previous value

Definition at line 142 of file AtomicValue.h.

◆ sub()

template<class T >
T agx::AtomicValueT< T >::sub ( T  value)
inline

Subtract a value.

Returns
The previous value

Definition at line 162 of file AtomicValue.h.


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