QtBase  v6.3.1
Public Member Functions | List of all members
QAtomicInteger< T > Class Template Reference

The QAtomicInteger class provides platform-independent atomic operations on integers. More...

#include <qatomic.h>

Inheritance diagram for QAtomicInteger< T >:
Inheritance graph
[legend]
Collaboration diagram for QAtomicInteger< T >:
Collaboration graph
[legend]

Public Member Functions

 QAtomicInteger (T value=0) noexcept
 
 QAtomicInteger (const QAtomicInteger &other) noexcept
 
QAtomicIntegeroperator= (const QAtomicInteger &other) noexcept
 
- Public Member Functions inherited from QBasicAtomicInteger< T >
T loadRelaxed () const noexcept
 
void storeRelaxed (T newValue) noexcept
 
T loadAcquire () const noexcept
 
void storeRelease (T newValue) noexcept
 
 operator T () const noexcept
 
T operator= (T newValue) noexcept
 
bool ref () noexcept
 
bool deref () noexcept
 
bool testAndSetRelaxed (T expectedValue, T newValue) noexcept
 
bool testAndSetAcquire (T expectedValue, T newValue) noexcept
 
bool testAndSetRelease (T expectedValue, T newValue) noexcept
 
bool testAndSetOrdered (T expectedValue, T newValue) noexcept
 
bool testAndSetRelaxed (T expectedValue, T newValue, T &currentValue) noexcept
 
bool testAndSetAcquire (T expectedValue, T newValue, T &currentValue) noexcept
 
bool testAndSetRelease (T expectedValue, T newValue, T &currentValue) noexcept
 
bool testAndSetOrdered (T expectedValue, T newValue, T &currentValue) noexcept
 
T fetchAndStoreRelaxed (T newValue) noexcept
 
T fetchAndStoreAcquire (T newValue) noexcept
 
T fetchAndStoreRelease (T newValue) noexcept
 
T fetchAndStoreOrdered (T newValue) noexcept
 
T fetchAndAddRelaxed (T valueToAdd) noexcept
 
T fetchAndAddAcquire (T valueToAdd) noexcept
 
T fetchAndAddRelease (T valueToAdd) noexcept
 
T fetchAndAddOrdered (T valueToAdd) noexcept
 
T fetchAndSubRelaxed (T valueToAdd) noexcept
 
T fetchAndSubAcquire (T valueToAdd) noexcept
 
T fetchAndSubRelease (T valueToAdd) noexcept
 
T fetchAndSubOrdered (T valueToAdd) noexcept
 
T fetchAndAndRelaxed (T valueToAdd) noexcept
 
T fetchAndAndAcquire (T valueToAdd) noexcept
 
T fetchAndAndRelease (T valueToAdd) noexcept
 
T fetchAndAndOrdered (T valueToAdd) noexcept
 
T fetchAndOrRelaxed (T valueToAdd) noexcept
 
T fetchAndOrAcquire (T valueToAdd) noexcept
 
T fetchAndOrRelease (T valueToAdd) noexcept
 
T fetchAndOrOrdered (T valueToAdd) noexcept
 
T fetchAndXorRelaxed (T valueToAdd) noexcept
 
T fetchAndXorAcquire (T valueToAdd) noexcept
 
T fetchAndXorRelease (T valueToAdd) noexcept
 
T fetchAndXorOrdered (T valueToAdd) noexcept
 
T operator++ () noexcept
 
T operator++ (int) noexcept
 
T operator-- () noexcept
 
T operator-- (int) noexcept
 
T operator+= (T v) noexcept
 
T operator-= (T v) noexcept
 
T operator&= (T v) noexcept
 
T operator|= (T v) noexcept
 
T operator^= (T v) noexcept
 
 QBasicAtomicInteger ()=default
 
constexpr QBasicAtomicInteger (T value) noexcept
 
 QBasicAtomicInteger (const QBasicAtomicInteger &)=delete
 
QBasicAtomicIntegeroperator= (const QBasicAtomicInteger &)=delete
 
QBasicAtomicIntegeroperator= (const QBasicAtomicInteger &) volatile=delete
 

Additional Inherited Members

- Public Types inherited from QBasicAtomicInteger< T >
typedef T Type
 
typedef QAtomicOps< TOps
 
- Static Public Member Functions inherited from QBasicAtomicInteger< T >
static constexpr bool isReferenceCountingNative () noexcept
 
static constexpr bool isReferenceCountingWaitFree () noexcept
 
static constexpr bool isTestAndSetNative () noexcept
 
static constexpr bool isTestAndSetWaitFree () noexcept
 
static constexpr bool isFetchAndStoreNative () noexcept
 
static constexpr bool isFetchAndStoreWaitFree () noexcept
 
static constexpr bool isFetchAndAddNative () noexcept
 
static constexpr bool isFetchAndAddWaitFree () noexcept
 
- Public Attributes inherited from QBasicAtomicInteger< T >
Ops::Type _q_value
 

Detailed Description

template<typename T>
class QAtomicInteger< T >

The QAtomicInteger class provides platform-independent atomic operations on integers.

\inmodule QtCore

Since
5.3

For atomic operations on pointers, see the QAtomicPointer class.

An atomic operation is a complex operation that completes without interruption. The QAtomicInteger class provides atomic reference counting, test-and-set, fetch-and-store, and fetch-and-add for integers.

The template parameter T must be a C++ integer type: \list

Of the list above, only the 32-bit- and pointer-sized instantiations are guaranteed to work on all platforms. Support for other sizes depends on the compiler and processor architecture the code is being compiled for. To test whether the other types are supported, check the macro Q_ATOMIC_INT{nn}_IS_SUPPORTED, where {{nn}} is the number of bits desired.

Definition at line 59 of file qatomic.h.

Constructor & Destructor Documentation

◆ QAtomicInteger() [1/2]

template<typename T >
template< typename T > QAtomicInteger< T >::QAtomicInteger ( T  value = 0)
inlinenoexcept

Constructs a QAtomicInteger with the given value.

Definition at line 66 of file qatomic.h.

◆ QAtomicInteger() [2/2]

template<typename T >
template< typename T > QAtomicInteger< T >::QAtomicInteger ( const QAtomicInteger< T > &  other)
inlinenoexcept

Constructs a copy of other.

Definition at line 72 of file qatomic.h.

Here is the call graph for this function:

Member Function Documentation

◆ operator=()

template<typename T >
template< typename T > QAtomicInteger & QAtomicInteger< T >::operator= ( const QAtomicInteger< T > &  other)
inlinenoexcept

Assigns other to this QAtomicInteger and returns a reference to this QAtomicInteger.

Since
5.3

Atomically stores the other value into this atomic type using a sequentially consistent memory ordering if possible; or "Release" ordering if not. This function returns a reference to this object.

See also
storeRelaxed(), storeRelease()

Definition at line 80 of file qatomic.h.

Here is the call graph for this function:

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