ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
CxxUtils
CxxUtils
CachedUniquePtr.h
Go to the documentation of this file.
1
// This file's extension implies that it's C, but it's really -*- C++ -*-.
2
/*
3
* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration.
4
*/
11
12
13
#ifndef CXXUTILS_CACHEDUNIQUEPTR_H
14
#define CXXUTILS_CACHEDUNIQUEPTR_H
15
16
17
#include <atomic>
18
#include <memory>
19
20
21
namespace
CxxUtils
{
22
23
52
template
<
class
T>
53
class
CachedUniquePtrT
54
{
55
public
:
57
CachedUniquePtrT
();
58
59
61
CachedUniquePtrT
(std::unique_ptr<T> elt);
62
63
65
CachedUniquePtrT
(
CachedUniquePtrT
&& other)
noexcept
;
66
67
69
CachedUniquePtrT
&
operator=
(
CachedUniquePtrT
&& other)
noexcept
;
70
71
72
// Destructor.
73
~CachedUniquePtrT
();
74
75
78
T*
set
(std::unique_ptr<T> elt)
const
;
79
80
83
void
store
(std::unique_ptr<T> elt)
noexcept
;
84
85
87
T*
get
()
const
;
88
89
91
T&
operator*
()
const
;
92
93
95
T*
operator->
()
const
;
96
97
99
explicit
operator
bool()
const
;
100
101
104
std::unique_ptr<T>
release
() noexcept;
105
106
107
private
:
109
mutable
std
::atomic<T*>
m_ptr
;
110
};
111
112
113
template <class T>
114
using
CachedUniquePtr
=
CachedUniquePtrT
<
const
T>;
115
116
117
}
// namespace CxxUtils
118
119
120
#include "CxxUtils/CachedUniquePtr.icc"
121
122
123
#endif
// not CXXUTILS_CACHEDUNIQUEPTR_H
CxxUtils::CachedUniquePtrT
Cached pointer with atomic update.
Definition
CachedUniquePtr.h:54
CxxUtils::CachedUniquePtrT< const T >< MaterialProperties >::m_ptr
std::atomic< T * > m_ptr
Definition
CachedUniquePtr.h:109
CxxUtils::CachedUniquePtrT< const T >::store
void store(std::unique_ptr< T > elt) noexcept
CxxUtils::CachedUniquePtrT< const T >::CachedUniquePtrT
CachedUniquePtrT(std::unique_ptr< T > elt)
CxxUtils::CachedUniquePtrT< const T >::CachedUniquePtrT
CachedUniquePtrT(CachedUniquePtrT &&other) noexcept
CxxUtils::CachedUniquePtrT< const T >::operator*
T & operator*() const
CxxUtils::CachedUniquePtrT< const T >::operator->
T * operator->() const
CxxUtils::CachedUniquePtrT< const T >::get
T * get() const
CxxUtils::CachedUniquePtrT< const T >::~CachedUniquePtrT
~CachedUniquePtrT()
CxxUtils::CachedUniquePtrT::operator=
CachedUniquePtrT & operator=(CachedUniquePtrT &&other) noexcept
Move.
CxxUtils::CachedUniquePtrT< const T >::release
std::unique_ptr< T > release() noexcept
CxxUtils::CachedUniquePtrT::CachedUniquePtrT
CachedUniquePtrT()
Default constructor. Sets the element to null.
CxxUtils::CachedUniquePtrT< const T >::set
T * set(std::unique_ptr< T > elt) const
const
CxxUtils
Definition
aligned_vector.h:29
CxxUtils::CachedUniquePtr
CachedUniquePtrT< const T > CachedUniquePtr
Definition
CachedUniquePtr.h:114
std
STL namespace.
private
#define private
Definition
testRead.cxx:27
Generated on
for ATLAS Offline Software by
1.17.0