ATLAS Offline Software
StoreGate/StoreGate/WriteDecorHandle.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  */
13 #ifndef STOREGATE_WRITEDECORHANDLE_H
14 #define STOREGATE_WRITEDECORHANDLE_H
15 
16 
18 #include "StoreGate/ReadHandle.h"
21 #include "CxxUtils/bitmask.h"
22 #include "GaudiKernel/EventContext.h"
23 #include <type_traits>
24 
25 
26 namespace SG {
27 
28 
97 template <class T, class D>
99  : public ReadHandle<T>
100 {
101 public:
104 
107 
110 
113 
115  using span = typename accessor_t::span;
116 
117 
126 
127 
140  const EventContext& ctx);
141 
142 
143  // Disallow initialization from a temporary Key object.
144  explicit WriteDecorHandle (SG::WriteDecorHandleKey<T>&& key) = delete; // Not allowed from a temporary.
146  const EventContext& ctx) = delete; // Not allowed from a temporary.
147 
148 
153 
154 
159 
160 
165 
166 
171 
172 
177 
178 
187  bool isPresent() const;
188 
189 
200 
201 
207 
208 
217 
218 
223  template <class POINTER_TYPE = container_pointer_type,
224  typename = std::enable_if_t<!std::is_void_v<POINTER_TYPE> > >
225  POINTER_TYPE
227 
228 
233  span
235 
236 
241  bool isAvailable();
242 
243 
248 
249 
254 
255 
259  const std::string& decorKey() const;
260 
261 
262 private:
271  void makeDecor (const AuxVectorData* avd);
272 
273 
279  const SG::AuxVectorData* vectorData (std::true_type);
280 
281 
287  const SG::AuxVectorData* vectorData (std::false_type);
288 
289 
298 
299 
301  std::string m_decorKey;
302 
305 
308 
311 };
312 
313 
330 template <class D, class T>
332 
333 
354 template <class D, class T>
356  const EventContext& ctx);
357 
358 
366 template <class T>
368 template <class T>
370  const EventContext& ctx);
371 
372 
373 } // namespace SG
374 
375 
377 
378 
379 #endif // not STOREGATE_WRITEDECORHANDLE_WRITEDECORHANDLE_H
SG::WriteDecorHandle< T, ElementLink< DataVector > >::span
typename accessor_t::span span
Span of aux data items.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:115
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition: StoreGate/StoreGate/WriteDecorHandleKey.h:89
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
SGTest::store
TestStore store
Definition: TestStore.cxx:23
SG::WriteDecorHandle< T, ElementLink< DataVector > >::container_pointer_type
typename accessor_t::container_pointer_type container_pointer_type
Pointer into the vector holding an aux data item.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:112
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::WriteDecorHandle::isAvailable
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
SG::WriteDecorHandle::vectorData
const SG::AuxVectorData * vectorData(std::true_type)
Return the referenced object as a SG::AuxVectorData.
SG::WriteDecorHandle::~WriteDecorHandle
~WriteDecorHandle()
Destructor.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
index
Definition: index.py:1
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:483
SG::Decorator::span
typename AuxDataTraits< T, ALLOC >::span span
A span over elements in the container.
Definition: Decorator.h:74
IProxyDict
A proxy dictionary.
Definition: AthenaKernel/AthenaKernel/IProxyDict.h:47
DecorKeyHelpers.h
Some common helper functions used by decoration handles.
SG::WriteDecorHandle::operator()
reference_type operator()(const AuxElement &e)
Fetch the variable for one element, as a reference.
SG::WriteDecorHandle::WriteDecorHandle
WriteDecorHandle(SG::WriteDecorHandleKey< T > &&key)=delete
ReadHandle< T >
a smart pointer to an object of a given type in an IProxyDict (such as StoreGateSvc)....
SG::WriteDecorHandle::WriteDecorHandle
WriteDecorHandle(const WriteDecorHandleKey< T > &key, const EventContext &ctx)
Constructor from a ReadDecorHandleKey and an explicit event context.
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:274
SG::WriteDecorHandle::vectorData
const SG::AuxVectorData * vectorData(std::false_type)
Return the referenced object as a SG::AuxVectorData.
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::WriteDecorHandle::auxid
SG::auxid_t auxid() const
Return the aux id for this variable.
SG::WriteDecorHandle::mode
Gaudi::DataHandle::Mode mode() const
Return the mode (read/write/update) for this handle.
SG::WriteDecorHandle::WriteDecorHandle
WriteDecorHandle(WriteDecorHandle &&rhs)
Move constructor.
WriteDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
SG::WriteDecorHandle::vectorData
const SG::AuxVectorData * vectorData()
Return the referenced object as a SG::AuxVectorData.
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
WriteDecorHandle.icc
SG::WriteDecorHandle::getDecorationArray
POINTER_TYPE getDecorationArray()
Get a pointer to the start of the auxiliary data array, for the referenced object.
bitmask.h
Helpers for treating a class enum as a bitmask.
SG::WriteDecorHandle::makeDecor
void makeDecor(const AuxVectorData *avd)
Create the decoration if it doesn't actually exist yet.
SG::Decorator::container_pointer_type
typename AuxDataTraits< T, ALLOC >::container_pointer_type container_pointer_type
Pointer into the container holding this item.
Definition: Decorator.h:69
SG::WriteDecorHandle::m_renounced
bool m_renounced
Was this handle renounced?
Definition: StoreGate/StoreGate/WriteDecorHandle.h:307
SG::WriteDecorHandle::operator=
WriteDecorHandle & operator=(const WriteDecorHandle &rhs)
Assignment operator.
SG::Decorator::reference_type
typename AuxDataTraits< T, ALLOC >::reference_type reference_type
Type referencing an item.
Definition: Decorator.h:62
EventContainers::Mode
Mode
Definition: IdentifiableContainerBase.h:13
SG::WriteDecorHandle::WriteDecorHandle
WriteDecorHandle(const WriteDecorHandleKey< T > &key)
Constructor from a WriteDecorHandleKey.
SG::WriteDecorHandle::getDecorationSpan
span getDecorationSpan()
Get a span over the auxilary data array, for the referenced object.
SG::WriteDecorHandle::setProxyDict
virtual StatusCode setProxyDict(IProxyDict *store) override
Explicitly set the event store.
SG::WriteDecorHandle::decorKey
const std::string & decorKey() const
Return the name of the decoration alias (CONT.DECOR).
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition: AuxVectorData.h:168
SG::WriteDecorHandle< T, ElementLink< DataVector > >::reference_type
typename accessor_t::reference_type reference_type
Type referencing an aux data item.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:109
ReadHandle.h
Handle class for reading from StoreGate.
SG::WriteDecorHandle::isPresent
bool isPresent() const
Is the referenced container present in SG?
SG::WriteDecorHandle::WriteDecorHandle
WriteDecorHandle(SG::WriteDecorHandleKey< T > &&key, const EventContext &ctx)=delete
SG::WriteDecorHandle::m_decorated
bool m_decorated
Have we created the decoration?
Definition: StoreGate/StoreGate/WriteDecorHandle.h:310
SG::WriteDecorHandle::m_decorKey
std::string m_decorKey
Name of the decoration alias: CONT.DECOR.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:301
SG::WriteDecorHandle::WriteDecorHandle
WriteDecorHandle(const WriteDecorHandle &rhs)
Copy constructor.
SG::WriteDecorHandle::m_acc
accessor_t m_acc
Accessor for the aux data item.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:304
AuxElement.h
Base class for elements of a container that can have aux data.
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37