Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
TAtomicBase_Basic< T > Struct Template Reference

#include <Atomic.h>

+ Inheritance diagram for TAtomicBase_Basic< T >:

Public Member Functions

FORCEINLINE T Load (EMemoryOrder Order=EMemoryOrder::SequentiallyConsistent) const
 
FORCEINLINE void Store (T Value, EMemoryOrder Order=EMemoryOrder::SequentiallyConsistent)
 
FORCEINLINE T Exchange (T Value)
 
FORCEINLINE bool CompareExchange (T &Expected, T Value)
 

Protected Member Functions

 TAtomicBase_Basic ()=default
 
constexpr TAtomicBase_Basic (T Value)
 

Protected Attributes

volatile T Element
 

Static Private Member Functions

static std::memory_order ToStd (EMemoryOrder Order)
 

Detailed Description

template<typename T>
struct TAtomicBase_Basic< T >

Definition at line 222 of file Atomic.h.

Constructor & Destructor Documentation

◆ TAtomicBase_Basic() [1/2]

template<typename T >
TAtomicBase_Basic< T >::TAtomicBase_Basic ( )
protecteddefault

◆ TAtomicBase_Basic() [2/2]

template<typename T >
constexpr TAtomicBase_Basic< T >::TAtomicBase_Basic ( T Value)
inlineconstexprprotected

Definition at line 325 of file Atomic.h.

Member Function Documentation

◆ CompareExchange()

template<typename T >
FORCEINLINE bool TAtomicBase_Basic< T >::CompareExchange ( T & Expected,
T Value )
inline

Compares the element with an expected value and, only if comparison succeeds, assigns the element to a new value. The previous value is copied into Expected in any case.

Parameters
ExpectedThe value to compare to the element, and will hold the existing value of the element after returning.
ValueThe value to assign, only if Expected matches the element.
Returns
Whether the element compared equal to Expected.
Note
It is equivalent to this in non-atomic terms:

bool CompareExchange(T& Expected, T Value) { bool bResult = this->Element == Expected; Expected = this->Element; if (bResult) { this->Element = Value; } return bResult; }

Definition at line 310 of file Atomic.h.

◆ Exchange()

template<typename T >
FORCEINLINE T TAtomicBase_Basic< T >::Exchange ( T Value)
inline

Sets the element to a specific value, returning a copy of the previous value.

Parameters
ValueThe value to set the element to.
Returns
A copy of the previous value.

Definition at line 279 of file Atomic.h.

◆ Load()

Gets a copy of the current value of the element.

Parameters
OrderThe memory ordering semantics to apply to the operation.
Returns
The current value.

Definition at line 236 of file Atomic.h.

◆ Store()

Sets the element to a specific value.

Parameters
ValueThe value to set the element to.
OrderThe memory ordering semantics to apply to the operation.

Definition at line 257 of file Atomic.h.

◆ ToStd()

template<typename T >
static std::memory_order TAtomicBase_Basic< T >::ToStd ( EMemoryOrder Order)
inlinestaticprivate

Definition at line 337 of file Atomic.h.

Member Data Documentation

◆ Element

template<typename T >
volatile T TAtomicBase_Basic< T >::Element
protected

Definition at line 331 of file Atomic.h.


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