ATLAS Offline Software
Loading...
Searching...
No Matches
StoreGate/StoreGate/ReadDecorHandle.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 */
11
12
13#ifndef STOREGATE_READDECORHANDLE_H
14#define STOREGATE_READDECORHANDLE_H
15
16
21#include "GaudiKernel/EventContext.h"
22#include <type_traits>
23
24
25namespace SG {
26
27
91template <class T, class D>
93 : public ReadHandle<T>
94{
95public:
98
100 using accessor_t = SG::AuxElement::ConstAccessor<D>;
101
103 using const_reference_type = typename accessor_t::const_reference_type;
104
106 using const_container_pointer_type = typename accessor_t::const_container_pointer_type;
107
109 using const_span = typename accessor_t::const_span;
110
111
120
121
134 const EventContext& ctx);
135
136
137 // Disallow initialization from a temporary Key object.
138 explicit ReadDecorHandle (SG::ReadDecorHandleKey<T>&& key) = delete; // Not allowed from a temporary.
140 const EventContext& ctx) = delete; // Not allowed from a temporary.
141
142
147
148
153
154
159
160
165
166
175 bool isPresent() const;
176
177
183
184
194 const_reference_type withDefault (size_t index, const D& deflt);
195
196
204 const_reference_type withDefault (const AuxElement& e, const D& deflt) const;
205
206
215
216
221 template <class POINTER_TYPE = const_container_pointer_type>
222 requires (!std::is_void_v<POINTER_TYPE>)
223 POINTER_TYPE
225
226
233
234
240
241
246
247
251 const std::string& decorKey() const;
252
253
254private:
260 const SG::AuxVectorData* vectorData (std::true_type);
261
262
268 const SG::AuxVectorData* vectorData (std::false_type);
269
270
279
280
282 std::string m_decorKey;
283
284
287};
288
289
306template <class D, class T>
308
309
330template <class D, class T>
332 const EventContext& ctx);
333
334
342template <class T>
344template <class T>
346 const EventContext& ctx);
347
348
349} // namespace SG
350
351
353
354
355#endif // not STOREGATE_READDECORHANDLE_READDECORHANDLE_H
Base class for elements of a container that can have aux data.
Some common helper functions used by decoration handles.
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Handle class for reading from StoreGate.
Manage lookup of vectors of auxiliary data.
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Handle class for reading a decoration on an object.
const_reference_type withDefault(const AuxElement &e, const D &deflt) const
Fetch the variable for one element, as a const reference.
SG::AuxElement::ConstAccessor< D > accessor_t
Accessor type for aux data.
typename accessor_t::const_container_pointer_type const_container_pointer_type
Pointer into the vector holding an aux data item.
ReadDecorHandle(SG::ReadDecorHandleKey< T > &&key)=delete
ReadDecorHandle(ReadDecorHandle &&rhs)
Move constructor.
const_span getDataSpan()
Get a span over the auxilary data array, for the referenced object.
ReadDecorHandle(const ReadDecorHandle &rhs)
Copy constructor.
ReadDecorHandle(const ReadDecorHandleKey< T > &key, const EventContext &ctx)
Constructor from a ReadDecorHandleKey and an explicit event context.
ReadDecorHandle(const ReadDecorHandleKey< T > &key)
Constructor from a ReadDecorHandleKey.
const SG::AuxVectorData * vectorData()
Return the referenced object as a SG::AuxVectorData.
SG::auxid_t auxid() const
Return the aux id for this variable.
POINTER_TYPE getDataArray()
Get a pointer to the start of the auxiliary data array, for the referenced object.
ReadDecorHandle(SG::ReadDecorHandleKey< T > &&key, const EventContext &ctx)=delete
bool isPresent() const
Is the referenced container present in SG?
const_reference_type withDefault(size_t index, const D &deflt)
Fetch the variable for one element, as a const reference.
typename accessor_t::const_span const_span
Span of aux data items.
const_reference_type operator()(const AuxElement &e) const
Fetch the variable for one element, as a const reference.
std::string m_decorKey
Name of the decoration alias.
const SG::AuxVectorData * vectorData(std::true_type)
Return the referenced object as a SG::AuxVectorData.
ReadDecorHandle & operator=(const ReadDecorHandle &rhs)
Assignment operator.
typename accessor_t::const_reference_type const_reference_type
Type referencing an aux data item.
const std::string & decorKey() const
Return the name of the decoration alias (CONT.DECOR).
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
const SG::AuxVectorData * vectorData(std::false_type)
Return the referenced object as a SG::AuxVectorData.
accessor_t m_acc
Accessor for the aux data item.
Forward declaration.
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
Definition index.py:1