iceoryx2
C++ Language Bindings
Loading...
Searching...
No Matches
iox2::legacy::concurrent::Atomic< T > Class Template Reference

A thin wrapper for a 'std::atomic' which ensures that all atomic operations are always lock-free in order to ensure safe usage across processes in shared memory. For detailed documentation please have a look at https://en.cppreference.com/w/cpp/atomic/atomic. More...

#include <atomic.hpp>

Public Member Functions

constexpr Atomic () noexcept
 Constructs a new 'iox2::legacy::Atomic' with a default value.
 
constexpr Atomic (T value) noexcept
 Constructs a new 'iox2::legacy::Atomic' with the given value.
 
 Atomic (const Atomic &other)=delete
 Similar to the std::atomic, the 'iox2::legacy::Atomic' is not copy constructible.
 
Atomicoperator= (const Atomic &)=delete
 Similar to the std::atomic, the 'iox2::legacy::Atomic' is not copy assignable.
 
 Atomic (Atomic &&rhs) noexcept=default
 
Atomicoperator= (Atomic &&rhs) noexcept=default
 
 ~Atomic ()=default
 
T operator= (T value) noexcept
 Atomically assigns the given value to the 'iox2::legacy::Atomic' and returns the given value. Equivalent to 'store(value)'.
 
T operator= (T value) volatile noexcept
 Atomically assigns the given value to the 'iox2::legacy::Atomic' and returns the given value. Equivalent to 'store(value)'.
 
 operator T () const noexcept
 Atomically loads and returns the stored value. Equivalent to 'load()'.
 
 operator T () const volatile noexcept
 Atomically loads and returns the stored value. Equivalent to 'load()'.
 
bool is_lock_free () const noexcept
 Return true if all operations on an object of this type are lock-free.
 
bool is_lock_free () const volatile noexcept
 Return true if all operations on an object of this type are lock-free.
 
void store (T value, std::memory_order order=std::memory_order_seq_cst) noexcept
 Atomically stores the given value with the given memory order.
 
void store (T value, std::memory_order order=std::memory_order_seq_cst) volatile noexcept
 Atomically stores the given value with the given memory order.
 
T load (std::memory_order order=std::memory_order_seq_cst) const noexcept
 Atomically loads and returns the stored value.
 
T load (std::memory_order order=std::memory_order_seq_cst) const volatile noexcept
 Atomically loads and returns the stored value.
 
T exchange (T value, std::memory_order order=std::memory_order_seq_cst) noexcept
 Atomically exchanges the given value with the stored value using the given memory order and returns the previous value.
 
T exchange (T value, std::memory_order order=std::memory_order_seq_cst) volatile noexcept
 Atomically exchanges the given value with the stored value using the given memory order and returns the previous value.
 
bool compare_exchange_weak (T &expected, T desired, std::memory_order success, std::memory_order failure) noexcept
 Performs an atomic CAS operation on the stored value with the given desired value and the given memory orders for success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure. The operation can fail spuriously even when the current value equals the expected value.
 
bool compare_exchange_weak (T &expected, T desired, std::memory_order success, std::memory_order failure) volatile noexcept
 Performs an atomic CAS operation on the stored value with the given desired value and the given memory orders for success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure. The operation can fail spuriously even when the current value equals the expected value.
 
bool compare_exchange_weak (T &expected, T desired, std::memory_order order=std::memory_order_seq_cst) noexcept
 Performs an atomic CAS operation on the stored value with the given desired value and the given memory order for both success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure. The operation can fail spuriously even when the current value equals the expected value.
 
bool compare_exchange_weak (T &expected, T desired, std::memory_order order=std::memory_order_seq_cst) volatile noexcept
 Performs an atomic CAS operation on the stored value with the given desired value and the given memory order for both success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure. The operation can fail spuriously even when the current value equals the expected value.
 
bool compare_exchange_strong (T &expected, T desired, std::memory_order success, std::memory_order failure) noexcept
 Performs an atomic CAS operation on the stored value with the given desired value and the given memory orders for success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure.
 
bool compare_exchange_strong (T &expected, T desired, std::memory_order success, std::memory_order failure) volatile noexcept
 Performs an atomic CAS operation on the stored value with the given desired value and the given memory orders for success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure.
 
bool compare_exchange_strong (T &expected, T desired, std::memory_order order=std::memory_order_seq_cst) noexcept
 Performs an atomic CAS operation on the stored value with the given desired value and the given memory order for both success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure.
 
bool compare_exchange_strong (T &expected, T desired, std::memory_order order=std::memory_order_seq_cst) volatile noexcept
 Performs an atomic CAS operation on the stored value with the given desired value and the given memory order for both success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure.
 
template<typename U = T>
enable_if_integral_t< Ufetch_add (T value, std::memory_order order=std::memory_order_seq_cst) noexcept
 Atomically adds the given value to the stored value with the given memory order and returns the previous value.
 
template<typename U = T>
enable_if_integral_t< Ufetch_add (T value, std::memory_order order=std::memory_order_seq_cst) volatile noexcept
 Atomically adds the given value to the stored value with the given memory order and returns the previous value.
 
template<typename U = T>
enable_if_pointer_t< Ufetch_add (std::ptrdiff_t value, std::memory_order order=std::memory_order_seq_cst) noexcept
 
template<typename U = T>
enable_if_pointer_t< Ufetch_add (std::ptrdiff_t value, std::memory_order order=std::memory_order_seq_cst) volatile noexcept
 
template<typename U = T>
enable_if_integral_t< Ufetch_sub (T value, std::memory_order order=std::memory_order_seq_cst) noexcept
 Atomically substracts the given value to the stored value with the given memory order and returns the previous value.
 
template<typename U = T>
enable_if_integral_t< Ufetch_sub (T value, std::memory_order order=std::memory_order_seq_cst) volatile noexcept
 Atomically substracts the given value to the stored value with the given memory order and returns the previous value.
 
template<typename U = T>
enable_if_pointer_t< Ufetch_sub (std::ptrdiff_t value, std::memory_order order=std::memory_order_seq_cst) noexcept
 
template<typename U = T>
enable_if_pointer_t< Ufetch_sub (std::ptrdiff_t value, std::memory_order order=std::memory_order_seq_cst) volatile noexcept
 
template<typename U = T>
enable_if_integral_t< Uoperator+= (T value) noexcept
 Atomically adds the given value to the stored value and returns the resulting value. Equivalent to 'fetch_add(value) + value'.
 
template<typename U = T>
enable_if_integral_t< Uoperator+= (T value) volatile noexcept
 Atomically adds the given value to the stored value and returns the resulting value. Equivalent to 'fetch_add(value) + value'.
 
template<typename U = T>
enable_if_integral_t< Uoperator-= (T value) noexcept
 Atomically substracts the given value to the stored value and returns the resulting value. Equivalent to 'fetch_sub(value) - value'.
 
template<typename U = T>
enable_if_integral_t< Uoperator-= (T value) volatile noexcept
 Atomically substracts the given value to the stored value and returns the resulting value. Equivalent to 'fetch_sub(value) - value'.
 
template<typename U = T>
enable_if_pointer_t< Uoperator+= (std::ptrdiff_t value) noexcept
 Atomically adds the given difference to the stored pointer value and returns the resulting new pointer value. Equivalent to 'fetch_add(value) + value'.
 
template<typename U = T>
enable_if_pointer_t< Uoperator+= (std::ptrdiff_t value) volatile noexcept
 Atomically adds the given difference to the stored pointer value and returns the resulting new pointer value. Equivalent to 'fetch_add(value) + value'.
 
template<typename U = T>
enable_if_pointer_t< Uoperator-= (std::ptrdiff_t value) noexcept
 Atomically substracts the given difference to the stored pointer value and returns the resulting new pointer value. Equivalent to 'fetch_sub(value) - value'.
 
template<typename U = T>
enable_if_pointer_t< Uoperator-= (std::ptrdiff_t value) volatile noexcept
 Atomically substracts the given difference to the stored pointer value and returns the resulting new pointer value. Equivalent to 'fetch_sub(value) - value'.
 
template<typename U = T>
enable_if_integral_or_pointer_t< Uoperator++ () noexcept
 Atomic pre-increment operator, equivalent to 'return fetch_add(1) + 1'.
 
template<typename U = T>
enable_if_integral_or_pointer_t< Uoperator++ () volatile noexcept
 Atomic pre-increment operator, equivalent to 'return fetch_add(1) + 1'.
 
template<typename U = T>
enable_if_integral_or_pointer_t< Uoperator++ (int) noexcept
 Atomic post-increment operator, equivalent to 'return fetch_add(1)'.
 
template<typename U = T>
enable_if_integral_or_pointer_t< Uoperator++ (int) volatile noexcept
 Atomic post-increment operator, equivalent to 'return fetch_add(1)'.
 
template<typename U = T>
enable_if_integral_or_pointer_t< Uoperator-- () noexcept
 Atomic pre-decrement operator, equivalent to 'return fetch_sub(1) - 1'.
 
template<typename U = T>
enable_if_integral_or_pointer_t< Uoperator-- () volatile noexcept
 Atomic pre-decrement operator, equivalent to 'return fetch_sub(1) - 1'.
 
template<typename U = T>
enable_if_integral_or_pointer_t< Uoperator-- (int) noexcept
 Atomic post-decrement operator, equivalent to 'return fetch_sub(1)'.
 
template<typename U = T>
enable_if_integral_or_pointer_t< Uoperator-- (int) volatile noexcept
 Atomic post-decrement operator, equivalent to 'return fetch_sub(1)'.
 
template<typename U = T>
enable_if_integral_t< Ufetch_and (T value, std::memory_order order=std::memory_order_seq_cst) noexcept
 Atomically performs a bitwise 'AND' operation to the stored value with the given memory order and returns the previous value.
 
template<typename U = T>
enable_if_integral_t< Ufetch_and (T value, std::memory_order order=std::memory_order_seq_cst) volatile noexcept
 Atomically performs a bitwise 'AND' operation to the stored value with the given memory order and returns the previous value.
 
template<typename U = T>
enable_if_integral_t< Ufetch_or (T value, std::memory_order order=std::memory_order_seq_cst) noexcept
 Atomically performs a bitwise 'OR' operation to the stored value with the given memory order and returns the previous value.
 
template<typename U = T>
enable_if_integral_t< Ufetch_or (T value, std::memory_order order=std::memory_order_seq_cst) volatile noexcept
 Atomically performs a bitwise 'OR' operation to the stored value with the given memory order and returns the previous value.
 
template<typename U = T>
enable_if_integral_t< Ufetch_xor (T value, std::memory_order order=std::memory_order_seq_cst) noexcept
 Atomically performs a bitwise 'XOR' operation to the stored value with the given memory order and returns the previous value.
 
template<typename U = T>
enable_if_integral_t< Ufetch_xor (T value, std::memory_order order=std::memory_order_seq_cst) volatile noexcept
 Atomically performs a bitwise 'XOR' operation to the stored value with the given memory order and returns the previous value.
 
template<typename U = T>
enable_if_integral_t< Uoperator&= (T value) noexcept
 Atomically performs a bitwise 'AND' operation to the stored value and returns the resulting value, Equivalent to 'return fetch_and(value) & value;'.
 
template<typename U = T>
enable_if_integral_t< Uoperator&= (T value) volatile noexcept
 Atomically performs a bitwise 'AND' operation to the stored value and returns the resulting value, Equivalent to 'return fetch_and(value) & value;'.
 
template<typename U = T>
enable_if_integral_t< Uoperator|= (T value) noexcept
 Atomically performs a bitwise 'OR' operation to the stored value and returns the resulting value, Equivalent to 'return fetch_or(value) & value;'.
 
template<typename U = T>
enable_if_integral_t< Uoperator|= (T value) volatile noexcept
 Atomically performs a bitwise 'OR' operation to the stored value and returns the resulting value, Equivalent to 'return fetch_or(value) & value;'.
 
template<typename U = T>
enable_if_integral_t< Uoperator^= (T value) noexcept
 Atomically performs a bitwise 'OR' operation to the stored value and returns the resulting value, Equivalent to 'return fetch_xor(value) & value;'.
 
template<typename U = T>
enable_if_integral_t< Uoperator^= (T value) volatile noexcept
 Atomically performs a bitwise 'OR' operation to the stored value and returns the resulting value, Equivalent to 'return fetch_xor(value) & value;'.
 

Detailed Description

template<typename T>
class iox2::legacy::concurrent::Atomic< T >

A thin wrapper for a 'std::atomic' which ensures that all atomic operations are always lock-free in order to ensure safe usage across processes in shared memory. For detailed documentation please have a look at https://en.cppreference.com/w/cpp/atomic/atomic.

Definition at line 32 of file atomic.hpp.

Constructor & Destructor Documentation

◆ Atomic() [1/4]

template<typename T >
constexpr iox2::legacy::concurrent::Atomic< T >::Atomic ( )
inlineconstexprnoexcept

Constructs a new 'iox2::legacy::Atomic' with a default value.

Definition at line 55 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ Atomic() [2/4]

template<typename T >
constexpr iox2::legacy::concurrent::Atomic< T >::Atomic ( T  value)
inlineexplicitconstexprnoexcept

Constructs a new 'iox2::legacy::Atomic' with the given value.

Definition at line 68 of file atomic.hpp.

◆ Atomic() [3/4]

template<typename T >
iox2::legacy::concurrent::Atomic< T >::Atomic ( const Atomic< T > &  other)
delete

Similar to the std::atomic, the 'iox2::legacy::Atomic' is not copy constructible.

◆ Atomic() [4/4]

template<typename T >
iox2::legacy::concurrent::Atomic< T >::Atomic ( Atomic< T > &&  rhs)
defaultnoexcept

◆ ~Atomic()

template<typename T >
iox2::legacy::concurrent::Atomic< T >::~Atomic ( )
default

Member Function Documentation

◆ compare_exchange_strong() [1/4]

template<typename T >
bool iox2::legacy::concurrent::Atomic< T >::compare_exchange_strong ( T expected,
T  desired,
std::memory_order  order = std::memory_order_seq_cst 
)
inlinenoexcept

Performs an atomic CAS operation on the stored value with the given desired value and the given memory order for both success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure.

Definition at line 208 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ compare_exchange_strong() [2/4]

template<typename T >
bool iox2::legacy::concurrent::Atomic< T >::compare_exchange_strong ( T expected,
T  desired,
std::memory_order  order = std::memory_order_seq_cst 
) volatile
inlinenoexcept

Performs an atomic CAS operation on the stored value with the given desired value and the given memory order for both success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure.

Definition at line 215 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ compare_exchange_strong() [3/4]

template<typename T >
bool iox2::legacy::concurrent::Atomic< T >::compare_exchange_strong ( T expected,
T  desired,
std::memory_order  success,
std::memory_order  failure 
)
inlinenoexcept

Performs an atomic CAS operation on the stored value with the given desired value and the given memory orders for success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure.

Definition at line 191 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ compare_exchange_strong() [4/4]

template<typename T >
bool iox2::legacy::concurrent::Atomic< T >::compare_exchange_strong ( T expected,
T  desired,
std::memory_order  success,
std::memory_order  failure 
) volatile
inlinenoexcept

Performs an atomic CAS operation on the stored value with the given desired value and the given memory orders for success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure.

Definition at line 198 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ compare_exchange_weak() [1/4]

template<typename T >
bool iox2::legacy::concurrent::Atomic< T >::compare_exchange_weak ( T expected,
T  desired,
std::memory_order  order = std::memory_order_seq_cst 
)
inlinenoexcept

Performs an atomic CAS operation on the stored value with the given desired value and the given memory order for both success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure. The operation can fail spuriously even when the current value equals the expected value.

Definition at line 173 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ compare_exchange_weak() [2/4]

template<typename T >
bool iox2::legacy::concurrent::Atomic< T >::compare_exchange_weak ( T expected,
T  desired,
std::memory_order  order = std::memory_order_seq_cst 
) volatile
inlinenoexcept

Performs an atomic CAS operation on the stored value with the given desired value and the given memory order for both success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure. The operation can fail spuriously even when the current value equals the expected value.

Definition at line 181 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ compare_exchange_weak() [3/4]

template<typename T >
bool iox2::legacy::concurrent::Atomic< T >::compare_exchange_weak ( T expected,
T  desired,
std::memory_order  success,
std::memory_order  failure 
)
inlinenoexcept

Performs an atomic CAS operation on the stored value with the given desired value and the given memory orders for success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure. The operation can fail spuriously even when the current value equals the expected value.

Definition at line 154 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ compare_exchange_weak() [4/4]

template<typename T >
bool iox2::legacy::concurrent::Atomic< T >::compare_exchange_weak ( T expected,
T  desired,
std::memory_order  success,
std::memory_order  failure 
) volatile
inlinenoexcept

Performs an atomic CAS operation on the stored value with the given desired value and the given memory orders for success and failure. If current value is not the expected value, the CAS operation fails and updates the expected value with the current value. Returns true on success and false on failure. The operation can fail spuriously even when the current value equals the expected value.

Definition at line 162 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ exchange() [1/2]

template<typename T >
T iox2::legacy::concurrent::Atomic< T >::exchange ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
)
inlinenoexcept

Atomically exchanges the given value with the stored value using the given memory order and returns the previous value.

Definition at line 140 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ exchange() [2/2]

template<typename T >
T iox2::legacy::concurrent::Atomic< T >::exchange ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
) volatile
inlinenoexcept

Atomically exchanges the given value with the stored value using the given memory order and returns the previous value.

Definition at line 146 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_add() [1/4]

template<typename T >
template<typename U = T>
enable_if_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_add ( std::ptrdiff_t  value,
std::memory_order  order = std::memory_order_seq_cst 
)
inlinenoexcept

@brie Atomically adds the given difference to the stored pointer value with the given memory order and returns the previous pointer value

Definition at line 238 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_add() [2/4]

template<typename T >
template<typename U = T>
enable_if_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_add ( std::ptrdiff_t  value,
std::memory_order  order = std::memory_order_seq_cst 
) volatile
inlinenoexcept

@brie Atomically adds the given difference to the stored pointer value with the given memory order and returns the previous pointer value

Definition at line 246 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_add() [3/4]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_add ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
)
inlinenoexcept

Atomically adds the given value to the stored value with the given memory order and returns the previous value.

Definition at line 224 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_add() [4/4]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_add ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
) volatile
inlinenoexcept

Atomically adds the given value to the stored value with the given memory order and returns the previous value.

Definition at line 231 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_and() [1/2]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_and ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
)
inlinenoexcept

Atomically performs a bitwise 'AND' operation to the stored value with the given memory order and returns the previous value.

Definition at line 388 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_and() [2/2]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_and ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
) volatile
inlinenoexcept

Atomically performs a bitwise 'AND' operation to the stored value with the given memory order and returns the previous value.

Definition at line 395 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_or() [1/2]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_or ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
)
inlinenoexcept

Atomically performs a bitwise 'OR' operation to the stored value with the given memory order and returns the previous value.

Definition at line 402 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_or() [2/2]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_or ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
) volatile
inlinenoexcept

Atomically performs a bitwise 'OR' operation to the stored value with the given memory order and returns the previous value.

Definition at line 409 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_sub() [1/4]

template<typename T >
template<typename U = T>
enable_if_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_sub ( std::ptrdiff_t  value,
std::memory_order  order = std::memory_order_seq_cst 
)
inlinenoexcept

@brie Atomically substracts the given difference to the stored pointer value with the given memory order and returns the previous pointer value

Definition at line 268 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_sub() [2/4]

template<typename T >
template<typename U = T>
enable_if_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_sub ( std::ptrdiff_t  value,
std::memory_order  order = std::memory_order_seq_cst 
) volatile
inlinenoexcept

@brie Atomically substracts the given difference to the stored pointer value with the given memory order and returns the previous pointer value

Definition at line 276 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_sub() [3/4]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_sub ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
)
inlinenoexcept

Atomically substracts the given value to the stored value with the given memory order and returns the previous value.

Definition at line 254 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_sub() [4/4]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_sub ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
) volatile
inlinenoexcept

Atomically substracts the given value to the stored value with the given memory order and returns the previous value.

Definition at line 261 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_xor() [1/2]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_xor ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
)
inlinenoexcept

Atomically performs a bitwise 'XOR' operation to the stored value with the given memory order and returns the previous value.

Definition at line 416 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ fetch_xor() [2/2]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::fetch_xor ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
) volatile
inlinenoexcept

Atomically performs a bitwise 'XOR' operation to the stored value with the given memory order and returns the previous value.

Definition at line 423 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ is_lock_free() [1/2]

template<typename T >
bool iox2::legacy::concurrent::Atomic< T >::is_lock_free ( ) const
inlinenoexcept

Return true if all operations on an object of this type are lock-free.

Definition at line 109 of file atomic.hpp.

◆ is_lock_free() [2/2]

template<typename T >
bool iox2::legacy::concurrent::Atomic< T >::is_lock_free ( ) const volatile
inlinenoexcept

Return true if all operations on an object of this type are lock-free.

Definition at line 114 of file atomic.hpp.

◆ load() [1/2]

template<typename T >
T iox2::legacy::concurrent::Atomic< T >::load ( std::memory_order  order = std::memory_order_seq_cst) const
inlinenoexcept

Atomically loads and returns the stored value.

Definition at line 129 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ load() [2/2]

template<typename T >
T iox2::legacy::concurrent::Atomic< T >::load ( std::memory_order  order = std::memory_order_seq_cst) const volatile
inlinenoexcept

Atomically loads and returns the stored value.

Definition at line 134 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ operator T() [1/2]

template<typename T >
iox2::legacy::concurrent::Atomic< T >::operator T ( ) const
inlineexplicitnoexcept

Atomically loads and returns the stored value. Equivalent to 'load()'.

Definition at line 99 of file atomic.hpp.

◆ operator T() [2/2]

template<typename T >
iox2::legacy::concurrent::Atomic< T >::operator T ( ) const volatile
inlineexplicitnoexcept

Atomically loads and returns the stored value. Equivalent to 'load()'.

Definition at line 104 of file atomic.hpp.

◆ operator&=() [1/2]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::operator&= ( T  value)
inlinenoexcept

Atomically performs a bitwise 'AND' operation to the stored value and returns the resulting value, Equivalent to 'return fetch_and(value) & value;'.

Definition at line 430 of file atomic.hpp.

◆ operator&=() [2/2]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::operator&= ( T  value) volatile
inlinenoexcept

Atomically performs a bitwise 'AND' operation to the stored value and returns the resulting value, Equivalent to 'return fetch_and(value) & value;'.

Definition at line 437 of file atomic.hpp.

◆ operator++() [1/4]

template<typename T >
template<typename U = T>
enable_if_integral_or_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::operator++ ( )
inlinenoexcept

Atomic pre-increment operator, equivalent to 'return fetch_add(1) + 1'.

Definition at line 339 of file atomic.hpp.

◆ operator++() [2/4]

template<typename T >
template<typename U = T>
enable_if_integral_or_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::operator++ ( ) volatile
inlinenoexcept

Atomic pre-increment operator, equivalent to 'return fetch_add(1) + 1'.

Definition at line 345 of file atomic.hpp.

◆ operator++() [3/4]

template<typename T >
template<typename U = T>
enable_if_integral_or_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::operator++ ( int  )
inlinenoexcept

Atomic post-increment operator, equivalent to 'return fetch_add(1)'.

Definition at line 351 of file atomic.hpp.

◆ operator++() [4/4]

template<typename T >
template<typename U = T>
enable_if_integral_or_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::operator++ ( int  ) volatile
inlinenoexcept

Atomic post-increment operator, equivalent to 'return fetch_add(1)'.

Definition at line 357 of file atomic.hpp.

◆ operator+=() [1/4]

template<typename T >
template<typename U = T>
enable_if_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::operator+= ( std::ptrdiff_t  value)
inlinenoexcept

Atomically adds the given difference to the stored pointer value and returns the resulting new pointer value. Equivalent to 'fetch_add(value) + value'.

Definition at line 312 of file atomic.hpp.

◆ operator+=() [2/4]

template<typename T >
template<typename U = T>
enable_if_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::operator+= ( std::ptrdiff_t  value) volatile
inlinenoexcept

Atomically adds the given difference to the stored pointer value and returns the resulting new pointer value. Equivalent to 'fetch_add(value) + value'.

Definition at line 319 of file atomic.hpp.

◆ operator+=() [3/4]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::operator+= ( T  value)
inlinenoexcept

Atomically adds the given value to the stored value and returns the resulting value. Equivalent to 'fetch_add(value) + value'.

Definition at line 284 of file atomic.hpp.

◆ operator+=() [4/4]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::operator+= ( T  value) volatile
inlinenoexcept

Atomically adds the given value to the stored value and returns the resulting value. Equivalent to 'fetch_add(value) + value'.

Definition at line 291 of file atomic.hpp.

◆ operator--() [1/4]

template<typename T >
template<typename U = T>
enable_if_integral_or_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::operator-- ( )
inlinenoexcept

Atomic pre-decrement operator, equivalent to 'return fetch_sub(1) - 1'.

Definition at line 363 of file atomic.hpp.

◆ operator--() [2/4]

template<typename T >
template<typename U = T>
enable_if_integral_or_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::operator-- ( ) volatile
inlinenoexcept

Atomic pre-decrement operator, equivalent to 'return fetch_sub(1) - 1'.

Definition at line 369 of file atomic.hpp.

◆ operator--() [3/4]

template<typename T >
template<typename U = T>
enable_if_integral_or_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::operator-- ( int  )
inlinenoexcept

Atomic post-decrement operator, equivalent to 'return fetch_sub(1)'.

Definition at line 375 of file atomic.hpp.

◆ operator--() [4/4]

template<typename T >
template<typename U = T>
enable_if_integral_or_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::operator-- ( int  ) volatile
inlinenoexcept

Atomic post-decrement operator, equivalent to 'return fetch_sub(1)'.

Definition at line 381 of file atomic.hpp.

◆ operator-=() [1/4]

template<typename T >
template<typename U = T>
enable_if_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::operator-= ( std::ptrdiff_t  value)
inlinenoexcept

Atomically substracts the given difference to the stored pointer value and returns the resulting new pointer value. Equivalent to 'fetch_sub(value) - value'.

Definition at line 326 of file atomic.hpp.

◆ operator-=() [2/4]

template<typename T >
template<typename U = T>
enable_if_pointer_t< U > iox2::legacy::concurrent::Atomic< T >::operator-= ( std::ptrdiff_t  value) volatile
inlinenoexcept

Atomically substracts the given difference to the stored pointer value and returns the resulting new pointer value. Equivalent to 'fetch_sub(value) - value'.

Definition at line 333 of file atomic.hpp.

◆ operator-=() [3/4]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::operator-= ( T  value)
inlinenoexcept

Atomically substracts the given value to the stored value and returns the resulting value. Equivalent to 'fetch_sub(value) - value'.

Definition at line 298 of file atomic.hpp.

◆ operator-=() [4/4]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::operator-= ( T  value) volatile
inlinenoexcept

Atomically substracts the given value to the stored value and returns the resulting value. Equivalent to 'fetch_sub(value) - value'.

Definition at line 305 of file atomic.hpp.

◆ operator=() [1/4]

template<typename T >
Atomic & iox2::legacy::concurrent::Atomic< T >::operator= ( Atomic< T > &&  rhs)
defaultnoexcept

◆ operator=() [2/4]

Similar to the std::atomic, the 'iox2::legacy::Atomic' is not copy assignable.

◆ operator=() [3/4]

template<typename T >
T iox2::legacy::concurrent::Atomic< T >::operator= ( T  value)
inlinenoexcept

Atomically assigns the given value to the 'iox2::legacy::Atomic' and returns the given value. Equivalent to 'store(value)'.

Definition at line 85 of file atomic.hpp.

◆ operator=() [4/4]

template<typename T >
T iox2::legacy::concurrent::Atomic< T >::operator= ( T  value) volatile
inlinenoexcept

Atomically assigns the given value to the 'iox2::legacy::Atomic' and returns the given value. Equivalent to 'store(value)'.

Definition at line 93 of file atomic.hpp.

◆ operator^=() [1/2]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::operator^= ( T  value)
inlinenoexcept

Atomically performs a bitwise 'OR' operation to the stored value and returns the resulting value, Equivalent to 'return fetch_xor(value) & value;'.

Definition at line 458 of file atomic.hpp.

◆ operator^=() [2/2]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::operator^= ( T  value) volatile
inlinenoexcept

Atomically performs a bitwise 'OR' operation to the stored value and returns the resulting value, Equivalent to 'return fetch_xor(value) & value;'.

Definition at line 465 of file atomic.hpp.

◆ operator|=() [1/2]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::operator|= ( T  value)
inlinenoexcept

Atomically performs a bitwise 'OR' operation to the stored value and returns the resulting value, Equivalent to 'return fetch_or(value) & value;'.

Definition at line 444 of file atomic.hpp.

◆ operator|=() [2/2]

template<typename T >
template<typename U = T>
enable_if_integral_t< U > iox2::legacy::concurrent::Atomic< T >::operator|= ( T  value) volatile
inlinenoexcept

Atomically performs a bitwise 'OR' operation to the stored value and returns the resulting value, Equivalent to 'return fetch_or(value) & value;'.

Definition at line 451 of file atomic.hpp.

◆ store() [1/2]

template<typename T >
void iox2::legacy::concurrent::Atomic< T >::store ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
)
inlinenoexcept

Atomically stores the given value with the given memory order.

Definition at line 119 of file atomic.hpp.

References iox2::legacy::always_false_v.

◆ store() [2/2]

template<typename T >
void iox2::legacy::concurrent::Atomic< T >::store ( T  value,
std::memory_order  order = std::memory_order_seq_cst 
) volatile
inlinenoexcept

Atomically stores the given value with the given memory order.

Definition at line 124 of file atomic.hpp.

References iox2::legacy::always_false_v.


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