Botan
3.8.1
Crypto and TLS for C&
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerations
a
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
c
d
f
i
m
n
r
s
t
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
f
h
i
m
n
o
p
r
s
t
u
v
w
Enumerations
b
c
d
e
k
m
n
o
p
s
t
x
Enumerator
_
a
b
c
d
e
f
g
h
k
l
m
n
p
q
r
s
t
u
v
w
x
Related Symbols
b
c
d
e
f
k
o
p
s
t
x
Files
File List
File Members
All
_
a
b
c
d
e
f
k
m
n
p
t
w
Functions
b
c
Typedefs
b
c
e
p
t
Enumerations
Enumerator
b
c
d
e
k
n
Macros
_
a
b
c
f
m
n
t
w
src
lib
pubkey
xmss
atomic.h
Go to the documentation of this file.
1
/*
2
* Atomic
3
* (C) 2016 Matthias Gierlings
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
**/
7
8
#ifndef BOTAN_ATOMIC_H_
9
#define BOTAN_ATOMIC_H_
10
11
#include <botan/types.h>
12
#include <atomic>
13
#include <memory>
14
15
namespace
Botan
{
16
17
template
<
typename
T>
18
/**
19
* Simple helper class to expand std::atomic with copy constructor and copy
20
* assignment operator, i.e. for use as element in a container like
21
* std::vector. The construction of instances of this wrapper is NOT atomic
22
* and needs to be properly guarded.
23
**/
24
class
Atomic
final {
25
public
:
26
Atomic
() =
default
;
27
28
Atomic
(
const
Atomic
& data) : m_data(data.m_data.load()) {}
29
30
Atomic
(
const
std::atomic<T>& data) : m_data(data.load()) {}
31
32
~Atomic
() =
default
;
33
34
Atomic
&
operator=
(
const
Atomic
& other) {
35
if
(
this
!= &other) {
36
m_data.store(other.m_data.load());
37
}
38
return
*
this
;
39
}
34
Atomic
&
operator=
(
const
Atomic
& other) {
…
}
40
41
Atomic
&
operator=
(
const
std::atomic<T>& a) {
42
m_data.store(a.load());
43
return
*
this
;
44
}
41
Atomic
&
operator=
(
const
std::atomic<T>& a) {
…
}
45
46
operator
std::atomic<T>&() {
return
m_data; }
47
48
operator
T() {
return
m_data.load(); }
49
50
private
:
51
std::atomic<T> m_data;
52
};
24
class
Atomic
final {
…
};
53
54
}
// namespace Botan
55
56
#endif
Botan::Atomic::Atomic
Atomic()=default
Botan::Atomic::~Atomic
~Atomic()=default
Botan::Atomic::Atomic
Atomic(const std::atomic< T > &data)
Definition
atomic.h:30
Botan::Atomic::operator=
Atomic & operator=(const std::atomic< T > &a)
Definition
atomic.h:41
Botan::Atomic::operator=
Atomic & operator=(const Atomic &other)
Definition
atomic.h:34
Botan::Atomic::Atomic
Atomic(const Atomic &data)
Definition
atomic.h:28
Botan
Definition
alg_id.cpp:13
Generated by
1.13.2