Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Private Attributes | List of all members
cAtomicUniquePtr< T > Class Template Reference

An RAII wrapper for std::atomic<T*>. More...

#include <AtomicUniquePtr.h>

Public Member Functions

 cAtomicUniquePtr () noexcept
 
 cAtomicUniquePtr (std::unique_ptr< T > a_Ptr) noexcept
 
bool compare_exchange_strong (T *&a_Expected, std::unique_ptr< T > &&a_Desired, std::memory_order a_Order=std::memory_order_seq_cst) noexcept
 
bool compare_exchange_weak (T *&a_Expected, std::unique_ptr< T > &&a_Desired, std::memory_order a_Order=std::memory_order_seq_cst) noexcept
 
 DISALLOW_COPY_AND_ASSIGN (cAtomicUniquePtr)
 
std::unique_ptr< T > exchange (std::unique_ptr< T > a_Ptr, std::memory_order a_Order=std::memory_order_seq_cst) noexcept
 
T * load (std::memory_order a_Order=std::memory_order_seq_cst) const noexcept
 
 operator T* () const noexcept
 
cAtomicUniquePtroperator= (std::unique_ptr< T > a_Ptr) noexcept
 
void store (std::unique_ptr< T > a_Ptr, std::memory_order a_Order=std::memory_order_seq_cst) noexcept
 
 ~cAtomicUniquePtr () noexcept
 

Private Attributes

std::atomic< T * > m_Ptr
 

Detailed Description

template<typename T>
class cAtomicUniquePtr< T >

An RAII wrapper for std::atomic<T*>.

Definition at line 8 of file AtomicUniquePtr.h.

Constructor & Destructor Documentation

◆ cAtomicUniquePtr() [1/2]

template<typename T >
cAtomicUniquePtr< T >::cAtomicUniquePtr ( )
inlinenoexcept

Definition at line 14 of file AtomicUniquePtr.h.

◆ cAtomicUniquePtr() [2/2]

template<typename T >
cAtomicUniquePtr< T >::cAtomicUniquePtr ( std::unique_ptr< T >  a_Ptr)
inlinenoexcept

Definition at line 20 of file AtomicUniquePtr.h.

◆ ~cAtomicUniquePtr()

template<typename T >
cAtomicUniquePtr< T >::~cAtomicUniquePtr ( )
inlinenoexcept

Definition at line 31 of file AtomicUniquePtr.h.

Member Function Documentation

◆ compare_exchange_strong()

template<typename T >
bool cAtomicUniquePtr< T >::compare_exchange_strong ( T *&  a_Expected,
std::unique_ptr< T > &&  a_Desired,
std::memory_order  a_Order = std::memory_order_seq_cst 
)
inlinenoexcept

Definition at line 52 of file AtomicUniquePtr.h.

◆ compare_exchange_weak()

template<typename T >
bool cAtomicUniquePtr< T >::compare_exchange_weak ( T *&  a_Expected,
std::unique_ptr< T > &&  a_Desired,
std::memory_order  a_Order = std::memory_order_seq_cst 
)
inlinenoexcept

Definition at line 41 of file AtomicUniquePtr.h.

◆ DISALLOW_COPY_AND_ASSIGN()

template<typename T >
cAtomicUniquePtr< T >::DISALLOW_COPY_AND_ASSIGN ( cAtomicUniquePtr< T >  )

◆ exchange()

template<typename T >
std::unique_ptr<T> cAtomicUniquePtr< T >::exchange ( std::unique_ptr< T >  a_Ptr,
std::memory_order  a_Order = std::memory_order_seq_cst 
)
inlinenoexcept

Definition at line 63 of file AtomicUniquePtr.h.

◆ load()

template<typename T >
T* cAtomicUniquePtr< T >::load ( std::memory_order  a_Order = std::memory_order_seq_cst) const
inlinenoexcept

Definition at line 68 of file AtomicUniquePtr.h.

◆ operator T*()

template<typename T >
cAtomicUniquePtr< T >::operator T* ( ) const
inlinenoexcept

Definition at line 36 of file AtomicUniquePtr.h.

◆ operator=()

template<typename T >
cAtomicUniquePtr& cAtomicUniquePtr< T >::operator= ( std::unique_ptr< T >  a_Ptr)
inlinenoexcept

Definition at line 25 of file AtomicUniquePtr.h.

◆ store()

template<typename T >
void cAtomicUniquePtr< T >::store ( std::unique_ptr< T >  a_Ptr,
std::memory_order  a_Order = std::memory_order_seq_cst 
)
inlinenoexcept

Definition at line 73 of file AtomicUniquePtr.h.

Member Data Documentation

◆ m_Ptr

template<typename T >
std::atomic<T*> cAtomicUniquePtr< T >::m_Ptr
private

Definition at line 80 of file AtomicUniquePtr.h.


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