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-2024 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 "GaudiKernel/EventContext.h"
22 #include <type_traits>
23 
24 
25 namespace SG {
26 
27 
96 template <class T, class D>
98  : public ReadHandle<T>
99 {
100 public:
103 
106 
109 
112 
114  using span = typename accessor_t::span;
115 
116 
125 
126 
139  const EventContext& ctx);
140 
145 
146 
151 
152 
157 
158 
163 
164 
169 
170 
179  bool isPresent() const;
180 
181 
192 
193 
199 
200 
209 
210 
215  template <class POINTER_TYPE = container_pointer_type,
216  typename = std::enable_if_t<!std::is_void_v<POINTER_TYPE> > >
217  POINTER_TYPE
219 
220 
225  span
227 
228 
233  bool isAvailable();
234 
235 
240 
241 
246 
247 
251  std::string decorKey() const;
252 
253 
254 private:
262  virtual void* typeless_dataPointer_impl (bool quiet) override;
263 
264 
271  bool isAvailable (std::true_type);
272 
273 
280  bool isAvailable (std::false_type);
281 
282 
288  const SG::AuxVectorData* vectorData (std::true_type);
289 
290 
296  const SG::AuxVectorData* vectorData (std::false_type);
297 
298 
307 
308 
310  std::string m_decorKey;
311 
314 
319  enum { NO_ALIAS,
323 };
324 
325 
342 template <class D, class T>
344 
345 
366 template <class D, class T>
368  const EventContext& ctx);
369 
370 
378 template <class T>
380 template <class T>
382  const EventContext& ctx);
383 
384 
385 } // namespace SG
386 
387 
389 
390 
391 #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:114
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition: StoreGate/StoreGate/WriteDecorHandleKey.h:89
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:69
SG::WriteDecorHandle::MADE_ALIAS
@ MADE_ALIAS
Definition: StoreGate/StoreGate/WriteDecorHandle.h:320
SG::WriteDecorHandle::isAvailable
bool isAvailable(std::true_type)
Test to see if this variable exists in the store, for the referenced object.
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:111
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.
quiet
bool quiet
Definition: TrigGlobEffCorrValidation.cxx:190
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
index
Definition: index.py:1
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:446
SG::Decorator::span
typename AuxDataTraits< T, ALLOC >::span span
A span over elements in the container.
Definition: Decorator.h:73
SG::WriteDecorHandle::decorKey
std::string decorKey() const
Return the name of the decoration alias (CONT.DECOR).
SG::WriteDecorHandle::isAvailable
bool isAvailable(std::false_type)
Test to see if this variable exists in the store, for the referenced object.
IProxyDict
A proxy dictionary.
Definition: AthenaKernel/AthenaKernel/IProxyDict.h:51
DecorKeyHelpers.h
Some common helper functions used by decoration handles.
SG::WriteDecorHandle::typeless_dataPointer_impl
virtual void * typeless_dataPointer_impl(bool quiet) override
Retrieve an object from StoreGate.
SG::WriteDecorHandle::operator()
reference_type operator()(const AuxElement &e)
Fetch the variable for one element, as a reference.
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:269
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::RENOUNCED
@ RENOUNCED
Definition: StoreGate/StoreGate/WriteDecorHandle.h:321
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:58
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:99
WriteDecorHandle.icc
SG::WriteDecorHandle::getDecorationArray
POINTER_TYPE getDecorationArray()
Get a pointer to the start of the auxiliary data array, for the referenced object.
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:68
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:61
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.
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition: AuxVectorData.h:167
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:108
ReadHandle.h
Handle class for reading from StoreGate.
SG::WriteDecorHandle::isPresent
bool isPresent() const
Is the referenced container present in SG?
SG::WriteDecorHandle::NO_ALIAS
@ NO_ALIAS
Definition: StoreGate/StoreGate/WriteDecorHandle.h:319
SG::WriteDecorHandle::m_decorKey
std::string m_decorKey
Name of the decoration alias: CONT.DECOR.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:310
SG::WriteDecorHandle::m_state
enum SG::WriteDecorHandle::@38 m_state
Set no NO_ALIAS when the handle is created, changed to MADE_ALIAS after the alias has been made.
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:313
AuxElement.h
Base class for elements of a container that can have aux data.
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37