DASH
0.3.0
|
Specialization for atomic values. More...
#include <GlobAtomicRef.h>
Public Types | |
using | value_type = T |
using | const_value_type = typename std::add_const< T >::type |
using | nonconst_value_type = typename std::remove_const< T >::type |
using | atomic_t = dash::Atomic< T > |
using | const_atomic_t = typename dash::Atomic< const_value_type > |
using | nonconst_atomic_t = typename dash::Atomic< nonconst_value_type > |
using | self_t = GlobRef< atomic_t > |
using | const_type = GlobRef< const_atomic_t > |
using | nonconst_type = GlobRef< dash::Atomic< nonconst_value_type > > |
Public Member Functions | |
GlobRef ()=delete | |
Reference semantics forbid declaration without definition. More... | |
GlobRef (dart_gptr_t dart_gptr) | |
Constructor: Create an atomic reference to a element in global memory. More... | |
template<typename PatternT > | |
GlobRef (const GlobPtr< const_atomic_t, PatternT > &gptr) | |
Constructor, creates an GlobRef object referencing an element in global memory. More... | |
template<typename PatternT > | |
GlobRef (const GlobPtr< nonconst_atomic_t, PatternT > &gptr) | |
template<typename _T , int = internal::enable_implicit_copy_ctor<value_type, _T>::value> | |
GlobRef (const GlobRef< dash::Atomic< _T >> &gref) | |
Copy constructor: Implicit if at least one of the following conditions is satisfied: 1) value_type and _T are exactly the same types (including const and volatile qualifiers 2) value_type and _T are the same types after removing const and volatile qualifiers and value_type itself is const. More... | |
template<typename _T , long = internal::enable_explicit_copy_ctor<value_type, _T>::value> | |
GlobRef (const GlobRef< dash::Atomic< _T >> &gref) | |
Copy constructor: Explicit if the following conditions are satisfied. More... | |
template<typename _T , int = internal::enable_implicit_copy_ctor<value_type, _T>::value> | |
GlobRef (const GlobAsyncRef< dash::Atomic< _T >> &gref) | |
Copy constructor: Implicit if at least one of the following conditions is satisfied: 1) value_type and _T are exactly the same types (including const and volatile qualifiers 2) value_type and _T are the same types after removing const and volatile qualifiers and value_type itself is const. More... | |
template<typename _T , long = internal::enable_explicit_copy_ctor<value_type, _T>::value> | |
GlobRef (const GlobAsyncRef< dash::Atomic< _T >> &gref) | |
Copy constructor: Explicit if the following conditions are satisfied. More... | |
GlobRef (self_t &&other)=default | |
Move Constructor. More... | |
self_t & | operator= (const self_t &other) const |
Copy Assignment: Copies atomically the value from other. More... | |
self_t & | operator= (self_t &&other) |
Move Assignment: Redirects to Copy Assignment. More... | |
operator T () const | |
dart_gptr_t | dart_gptr () const |
bool | is_local () const |
Checks whether the globally referenced element is in the calling unit's local memory. More... | |
T | operator= (const T &value) const |
atomically assigns value More... | |
void | set (const T &value) const |
Set the value of the shared atomic variable. More... | |
void | store (const T &value) const |
Set the value of the shared atomic variable. More... | |
T | get () const |
atomically fetches value More... | |
T | load () const |
Get the value of the shared atomic variable. More... | |
template<typename BinaryOp > | |
void | op (BinaryOp binary_op, const T &value) const |
Atomically executes specified operation on the referenced shared value. More... | |
template<typename BinaryOp > | |
T | fetch_op (BinaryOp binary_op, const T &value) const |
Atomic fetch-and-op operation on the referenced shared value. More... | |
T | exchange (const T &value) const |
Atomically exchanges value. More... | |
bool | compare_exchange (const T &expected, const T &desired) const |
Atomically compares the value with the value of expected and if thosei are bitwise-equal, replaces the former with desired. More... | |
void | add (const T &value) const |
DASH specific variant which is faster than fetch_add but does not return value. More... | |
T | fetch_add (const T &value) const |
Atomic fetch-and-add operation on the referenced shared value. More... | |
void | sub (const T &value) const |
DASH specific variant which is faster than fetch_sub but does not return value. More... | |
T | fetch_sub (const T &value) const |
Atomic fetch-and-sub operation on the referenced shared value. More... | |
void | multiply (const T &value) const |
DASH specific variant which is faster than fetch_multiply but does not return value. More... | |
T | fetch_multiply (const T &value) const |
Atomic fetch-and-multiply operation on the referenced shared value. More... | |
T | operator++ () const |
prefix atomically increment value by one More... | |
T | operator++ (int) const |
postfix atomically increment value by one More... | |
T | operator-- () const |
prefix atomically decrement value by one More... | |
T | operator-- (int) const |
postfix atomically decrement value by one More... | |
T | operator+= (const T &value) const |
atomically increment value by ref More... | |
T | operator-= (const T &value) const |
atomically decrement value by ref More... | |
Friends | |
template<typename U > | |
std::ostream & | operator<< (std::ostream &os, const GlobRef< U > &gref) |
Specialization for atomic values.
All atomic operations are const
as the GlobRef
does not own the atomic values.
Definition at line 23 of file GlobAtomicRef.h.
|
delete |
Reference semantics forbid declaration without definition.
|
inlineexplicit |
Constructor: Create an atomic reference to a element in global memory.
Definition at line 63 of file GlobAtomicRef.h.
|
inlineexplicit |
Constructor, creates an GlobRef object referencing an element in global memory.
gptr | Pointer to referenced object in global memory |
Definition at line 74 of file GlobAtomicRef.h.
|
inlineexplicit |
gptr | Pointer to referenced object in global memory |
Definition at line 85 of file GlobAtomicRef.h.
|
inline |
Copy constructor: Implicit if at least one of the following conditions is satisfied: 1) value_type and _T are exactly the same types (including const and volatile qualifiers 2) value_type and _T are the same types after removing const and volatile qualifiers and value_type itself is const.
Definition at line 103 of file GlobAtomicRef.h.
|
inlineexplicit |
Copy constructor: Explicit if the following conditions are satisfied.
1) value_type and _T are the same types after excluding const and volatile qualifiers 2) value_type is const and _T is non-const
Definition at line 117 of file GlobAtomicRef.h.
|
inline |
Copy constructor: Implicit if at least one of the following conditions is satisfied: 1) value_type and _T are exactly the same types (including const and volatile qualifiers 2) value_type and _T are the same types after removing const and volatile qualifiers and value_type itself is const.
Definition at line 133 of file GlobAtomicRef.h.
|
inlineexplicit |
Copy constructor: Explicit if the following conditions are satisfied.
1) value_type and _T are the same types after excluding const and volatile qualifiers 2) value_type is const and _T is non-const
Definition at line 147 of file GlobAtomicRef.h.
References dash::GlobRef< T >::GlobRef().
|
default |
Move Constructor.
|
inline |
DASH specific variant which is faster than fetch_add
but does not return value.
Definition at line 399 of file GlobAtomicRef.h.
|
inline |
Atomically compares the value with the value of expected and if thosei are bitwise-equal, replaces the former with desired.
dash::atomic::compare_exchange
Definition at line 364 of file GlobAtomicRef.h.
|
inline |
Atomically exchanges value.
Definition at line 351 of file GlobAtomicRef.h.
|
inline |
Atomic fetch-and-add operation on the referenced shared value.
value | Value to be added to global atomic variable. |
Definition at line 413 of file GlobAtomicRef.h.
|
inline |
Atomic fetch-and-multiply operation on the referenced shared value.
value | Value to be added to global atomic variable. |
Definition at line 457 of file GlobAtomicRef.h.
|
inline |
Atomic fetch-and-op operation on the referenced shared value.
value | Value to be added to global atomic variable. |
Definition at line 316 of file GlobAtomicRef.h.
|
inline |
Atomic fetch-and-sub operation on the referenced shared value.
value | Value to be subtracted from global atomic variable. |
Definition at line 435 of file GlobAtomicRef.h.
|
inline |
atomically fetches value
Definition at line 243 of file GlobAtomicRef.h.
|
inline |
Checks whether the globally referenced element is in the calling unit's local memory.
Definition at line 188 of file GlobAtomicRef.h.
|
inline |
Get the value of the shared atomic variable.
Definition at line 268 of file GlobAtomicRef.h.
|
inline |
DASH specific variant which is faster than fetch_multiply
but does not return value.
Definition at line 446 of file GlobAtomicRef.h.
|
inline |
Atomically executes specified operation on the referenced shared value.
binary_op | Binary operation to be performed on global atomic variable |
value | Value to be used in binary op on global atomic variable. |
Definition at line 277 of file GlobAtomicRef.h.
|
inline |
prefix atomically increment value by one
operator++
, see http://en.cppreference.com/w/cpp/atomic/atomic/operator_arith. Definition at line 475 of file GlobAtomicRef.h.
|
inline |
postfix atomically increment value by one
Definition at line 486 of file GlobAtomicRef.h.
|
inline |
atomically increment value by ref
operator+=
, see http://en.cppreference.com/w/cpp/atomic/atomic/operator_arith2. Definition at line 529 of file GlobAtomicRef.h.
|
inline |
prefix atomically decrement value by one
operator--
, see http://en.cppreference.com/w/cpp/atomic/atomic/operator_arith. Definition at line 502 of file GlobAtomicRef.h.
|
inline |
postfix atomically decrement value by one
Definition at line 513 of file GlobAtomicRef.h.
|
inline |
atomically decrement value by ref
Note that this operator does not return a reference but a copy of the value in order to ensure atomicity. This is consistent with the C++ std::atomic operator-=
, see http://en.cppreference.com/w/cpp/atomic/atomic/operator_arith2.
Definition at line 545 of file GlobAtomicRef.h.
|
inline |
Copy Assignment: Copies atomically the value from other.
Definition at line 160 of file GlobAtomicRef.h.
|
inline |
Move Assignment: Redirects to Copy Assignment.
Definition at line 169 of file GlobAtomicRef.h.
References dash::GlobRef< T >::operator=().
|
inline |
atomically assigns value
operator=
, see http://en.cppreference.com/w/cpp/atomic/atomic/operator%3D. Definition at line 203 of file GlobAtomicRef.h.
|
inline |
Set the value of the shared atomic variable.
Definition at line 212 of file GlobAtomicRef.h.
|
inline |
Set the value of the shared atomic variable.
Definition at line 237 of file GlobAtomicRef.h.
|
inline |
DASH specific variant which is faster than fetch_sub
but does not return value.
Definition at line 424 of file GlobAtomicRef.h.