ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthContainers
AthContainers
tools
AtomicConstAccessor.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-2025 CERN for the benefit of the ATLAS collaboration
4
*/
23
24
25
#ifndef ATHCONTAINERS_ATOMICCONSTACCESSOR_H
26
#define ATHCONTAINERS_ATOMICCONSTACCESSOR_H
27
28
29
#include "
AthContainers/AuxElement.h
"
30
#include "
AthContainers/ConstAccessor.h
"
31
#include "
AthContainers/tools/AuxDataTraits.h
"
32
#include <atomic>
33
#include <type_traits>
34
35
36
namespace
SG
{
37
38
42
template
<
class
T,
class
ALLOC = AuxAllocator_t<T> >
43
class
AtomicConstAccessor
44
:
public
ConstAccessor
<T, ALLOC>
45
{
46
public
:
48
using
Base
=
ConstAccessor<T, ALLOC>
;
49
51
using
const_reference_type
=
const
std::atomic<T>&;
52
54
using
element_type
=
typename
AuxDataTraits<T, ALLOC>::element_type
;
55
57
using
const_container_pointer_type
=
const
std::atomic<T>*;
58
59
// Consistency checks.
60
static_assert
(std::is_same<T, typename Base::element_type>::value,
61
"Bad type for AtomicConstAccessor"
);
62
static_assert
(std::is_same<const T&, typename Base::const_reference_type>::value,
63
"Bad type for AtomicConstAccessor"
);
64
65
static_assert
(std::is_same<const T*, typename Base::const_container_pointer_type>::value,
66
"Bad type for AtomicConstAccessor"
);
67
static_assert
(
sizeof
(T) ==
sizeof
(std::atomic<T>),
68
"Bad type for AtomicConstAccessor"
);
69
static_assert
(std::atomic<T>::is_always_lock_free,
70
"Bad type for AtomicConstAccessor"
);
71
78
AtomicConstAccessor
(
const
std::string& name);
79
80
88
AtomicConstAccessor
(
const
std::string& name,
const
std::string& clsname);
89
90
97
AtomicConstAccessor
(
const
SG::auxid_t
auxid
);
98
99
107
template
<IsConstAuxElement ELT>
108
T
operator()
(
const
ELT& e)
const
;
109
110
123
T
operator()
(
const
AuxVectorData
&
container
,
size_t
index
)
const
;
124
125
130
const_container_pointer_type
getDataArray
(
const
AuxVectorData
&
container
)
const
;
131
};
132
133
134
}
// namespace SG
135
136
137
#include "
AthContainers/tools/AtomicConstAccessor.icc
"
138
139
140
#endif
// not ATHCONTAINERS_ATOMICCONSTACCESSOR_H
AtomicConstAccessor.icc
AuxDataTraits.h
Allow customizing how aux data types are treated.
AuxElement.h
Base class for elements of a container that can have aux data.
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
SG::AtomicConstAccessor::getDataArray
const_container_pointer_type getDataArray(const AuxVectorData &container) const
Get a pointer to the start of the auxiliary data array.
SG::AtomicConstAccessor::AtomicConstAccessor
AtomicConstAccessor(const std::string &name)
Constructor.
SG::AtomicConstAccessor::AtomicConstAccessor
AtomicConstAccessor(const SG::auxid_t auxid)
Constructor taking an auxid directly.
SG::AtomicConstAccessor::operator()
T operator()(const ELT &e) const
Fetch the variable for one element, as a const reference.
SG::AtomicConstAccessor::const_container_pointer_type
const std::atomic< T > * const_container_pointer_type
Pointer into the container holding this item.
Definition
AtomicConstAccessor.h:57
SG::AtomicConstAccessor::Base
ConstAccessor< T, ALLOC > Base
Base class.
Definition
AtomicConstAccessor.h:48
SG::AtomicConstAccessor::element_type
typename AuxDataTraits< T, ALLOC >::element_type element_type
Type the user sees.
Definition
AtomicConstAccessor.h:54
SG::AtomicConstAccessor::AtomicConstAccessor
AtomicConstAccessor(const std::string &name, const std::string &clsname)
Constructor.
SG::AtomicConstAccessor::const_reference_type
const std::atomic< T > & const_reference_type
Type referencing an item.
Definition
AtomicConstAccessor.h:51
SG::AuxDataTraits::element_type
T element_type
The type the user sees.
Definition
AuxDataTraits.h:43
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition
AuxVectorData.h:164
SG::ConstAccessor::ConstAccessor
ConstAccessor(const std::string &name)
Constructor.
SG::ConstAccessor::auxid
SG::auxid_t auxid() const
Return the aux id for this variable.
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
SG::container
const SG::AuxVectorData * container() const
Return the container holding this element.
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition
AuxTypes.h:27
index
Definition
index.py:1
Generated on
for ATLAS Offline Software by
1.17.0