Botan 3.9.0
Crypto and TLS for C&
Botan::Atomic< T > Class Template Referencefinal

#include <atomic.h>

Public Member Functions

 Atomic ()=default
 Atomic (Atomic &&other)=default
 Atomic (const Atomic &data)
 Atomic (const std::atomic< T > &data)
 operator std::atomic< T > & ()
 operator T ()
Atomicoperator= (Atomic &&other)=default
Atomicoperator= (const Atomic &other)
Atomicoperator= (const std::atomic< T > &a)
 ~Atomic ()=default

Detailed Description

template<typename T>
class Botan::Atomic< T >

Simple helper class to expand std::atomic with copy constructor and copy assignment operator, i.e. for use as element in a container like std::vector. The construction of instances of this wrapper is NOT atomic and needs to be properly guarded.

Definition at line 24 of file atomic.h.

Constructor & Destructor Documentation

◆ Atomic() [1/4]

template<typename T>
Botan::Atomic< T >::Atomic ( )
default

◆ Atomic() [2/4]

template<typename T>
Botan::Atomic< T >::Atomic ( const Atomic< T > & data)
inline

Definition at line 28 of file atomic.h.

28: m_data(data.m_data.load()) {}

References Atomic().

◆ Atomic() [3/4]

template<typename T>
Botan::Atomic< T >::Atomic ( const std::atomic< T > & data)
inlineexplicit

Definition at line 30 of file atomic.h.

30: m_data(data.load()) {}

◆ ~Atomic()

template<typename T>
Botan::Atomic< T >::~Atomic ( )
default

◆ Atomic() [4/4]

template<typename T>
Botan::Atomic< T >::Atomic ( Atomic< T > && other)
default

References Atomic().

Member Function Documentation

◆ operator std::atomic< T > &()

template<typename T>
Botan::Atomic< T >::operator std::atomic< T > & ( )
inlineexplicit

Definition at line 49 of file atomic.h.

49{ return m_data; }

◆ operator T()

template<typename T>
Botan::Atomic< T >::operator T ( )
inline

Definition at line 52 of file atomic.h.

52{ return m_data.load(); }

◆ operator=() [1/3]

template<typename T>
Atomic & Botan::Atomic< T >::operator= ( Atomic< T > && other)
default

References Atomic().

◆ operator=() [2/3]

template<typename T>
Atomic & Botan::Atomic< T >::operator= ( const Atomic< T > & other)
inline

Definition at line 37 of file atomic.h.

37 {
38 if(this != &other) {
39 m_data.store(other.m_data.load());
40 }
41 return *this;
42 }

References Atomic().

◆ operator=() [3/3]

template<typename T>
Atomic & Botan::Atomic< T >::operator= ( const std::atomic< T > & a)
inline

Definition at line 44 of file atomic.h.

44 {
45 m_data.store(a.load());
46 return *this;
47 }

References Atomic().


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