Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
UpdateHandle.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 */
12 #ifndef STOREGATE_SG_UPDATEHANDLE_H
13 #define STOREGATE_SG_UPDATEHANDLE_H 1
14 
15 
18 #include "StoreGate/StoreGateSvc.h" /* needed by clients */
19 #include "GaudiKernel/EventContext.h"
20 #include <string>
21 
22 
23 
24 namespace SG {
25 
26 
27  // Helper for testing thread_safe.
28  // Unless explicitly specialized,
29  // IsThreadSafeForUH<T, std::true_type>::type will be true_type if
30  // T has a `typedef std::true_type thread_safe', and false_type otherwise.
31  template <class T, class VALT>
33  {
34  typedef std::false_type type;
35  };
36  template <class T>
37  struct IsThreadSafeForUH<T, typename T::thread_safe>
38  {
39  typedef std::true_type type;
40  };
41 
42 
88  template <class T>
90  : public SG::VarHandleBase
91  {
92  public:
93  typedef T* pointer_type; // FIXME: better handling of
94  typedef const T* const_pointer_type; // qualified T type ?
95  typedef T& reference_type;
96  typedef const T& const_reference_type;
97 
98 
99  private:
100  // Verify that the payload has a thread_safe typedef yielding std::true_type.
102  "Use of UpdateHandle is restricted to a few explicitly thread-safe types. If you think you need to use UpdateHandle, please consult with the core and reconstruction groups.");
103  public:
104 
105 
106  //************************************************************************
107  // Constructors, etc.
108  //
109 
110 
117 
118 
124  UpdateHandle(const std::string& sgkey,
125  const std::string& storename = StoreID::storeName(StoreID::EVENT_STORE));
126 
127 
133  explicit UpdateHandle(const std::string& sgkey,
134  const EventContext& ctx);
135 
136 
143  explicit UpdateHandle(const std::string& sgkey,
144  const std::string& storename,
145  const EventContext& ctx);
146 
147 
156 
157 
169  explicit UpdateHandle (const UpdateHandleKey<T>& key,const EventContext& ctx);
170 
171 
172  // Disallow initialization from a temporary Key object.
173  explicit UpdateHandle (SG::UpdateHandleKey<T>&& key) = delete; // Not allowed from a temporary.
175  const EventContext& ctx) = delete; // Not allowed from a temporary.
176 
177 
181  UpdateHandle( const UpdateHandle& rhs );
182 
183 
188 
189 
194 
195 
200 
201 
202  //************************************************************************
203  // Dereference.
204  //
205 
206 
214 
215 
223 
224 
232 
233 
241 
242 
247 
248 
252  virtual bool isValid() override final;
253 
254 
255  // FIXME: Remove this once IResetable is cleaned up.
256  using IResetable::reset;
257 
258 
265  virtual void reset (bool hard) override;
266 
267 
268  private:
274  };
275 
276 
284  template <class T>
286 
287 
299  template <class T>
301  const EventContext& ctx);
302 
303 
304 } /* namespace SG */
305 
306 
307 #include "StoreGate/UpdateHandle.icc"
308 
309 
310 #ifndef NO_LEGACY_HANDLES
311 namespace SG {
312  template <class T>
314 }
315 #endif
316 
317 #endif //> !STOREGATE_SG_UPDATEHANDLE_H
VarHandleBase.h
Base class for VarHandle classes.
SG::UpdateHandle::UpdateHandle
UpdateHandle(SG::UpdateHandleKey< T > &&key)=delete
common.sgkey
def sgkey(tool)
Definition: common.py:1028
SG::UpdateHandle::operator=
UpdateHandle & operator=(const UpdateHandle &rhs)
Assignment operator.
SG::IsThreadSafeForUH
Definition: UpdateHandle.h:33
SG::UpdateHandle::UpdateHandle
UpdateHandle(SG::UpdateHandleKey< T > &&key, const EventContext &ctx)=delete
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::UpdateHandleKey
Property holding a SG store/key/clid from which an UpdateHandle is made.
Definition: UpdateHandleKey.h:40
SG::UpdateHandle::UpdateHandle
UpdateHandle(const std::string &sgkey, const std::string &storename, const EventContext &ctx)
Constructor specifying the key as a string, with context.
SG::VarHandleBase
Base class for VarHandle types.
Definition: StoreGate/StoreGate/VarHandleBase.h:83
SG::UpdateHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::UpdateHandle::operator->
pointer_type operator->()
Dereference the pointer.
taskman.template
dictionary template
Definition: taskman.py:317
SG::IsThreadSafeForUH< T, typename T::thread_safe >::type
std::true_type type
Definition: UpdateHandle.h:39
SG::UpdateHandle::const_pointer_type
const T * const_pointer_type
Definition: UpdateHandle.h:94
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
SG::UpdateHandle::UpdateHandle
UpdateHandle(const UpdateHandleKey< T > &key)
Constructor from an UpdateHandleKey.
SG::UpdateHandle::pointer_type
T * pointer_type
Definition: UpdateHandle.h:93
SG::UpdateHandle::ptr
pointer_type ptr()
Dereference the pointer.
SG::UpdateHandle::UpdateHandle
UpdateHandle()
Default constructor.
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:274
IResetable
a resetable object (e.g. a SG DataHandle)
Definition: IResetable.h:15
SG::UpdateHandle::UpdateHandle
UpdateHandle(const std::string &sgkey, const EventContext &ctx)
Constructor specifying the key as a string, with context.
SG::IsThreadSafeForUH::type
std::false_type type
Definition: UpdateHandle.h:34
SG::UpdateHandle::operator*
reference_type operator*()
Dereference the pointer.
SG::UpdateHandle::reset
virtual void reset(bool hard) override
Reset this handle.
SG::UpdateHandle::cachedPtr
pointer_type cachedPtr()
Return the cached pointer directly; no lookup.
SG::UpdateHandle::UpdateHandle
UpdateHandle(const UpdateHandle &rhs)
Copy constructor.
SG::UpdateHandle::UpdateHandle
UpdateHandle(UpdateHandle &&rhs)
Move constructor.
SG::UpdateHandle::const_reference_type
const T & const_reference_type
Definition: UpdateHandle.h:96
UpdateHandleKey.h
Property holding a SG store/key/clid from which an UpdateHandle is made.
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
SG::UpdateHandle
Definition: UpdateHandle.h:91
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
python.Dumpers.typename
def typename(t)
Definition: Dumpers.py:194
SG::UpdateHandle::UpdateHandle
UpdateHandle(const UpdateHandleKey< T > &key, const EventContext &ctx)
Constructor from an UpdateHandleKey and an explicit event context.
SG::UpdateHandle::reference_type
T & reference_type
Definition: UpdateHandle.h:95
SG::UpdateHandle::checkedPtr
pointer_type checkedPtr()
Helper: dereference the pointer.
SG::UpdateHandle::operator=
UpdateHandle & operator=(UpdateHandle &&rhs)
Move operator.
UpdateHandle< T >
a smart pointer to an object of a given type in an IProxyDict (such as StoreGateSvc)....
StoreID::EVENT_STORE
@ EVENT_STORE
Definition: StoreID.h:26
StoreGateSvc.h
StoreID::storeName
static const std::string & storeName(const StoreID::type &s)
Definition: StoreID.cxx:77
SG::UpdateHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
SG::UpdateHandle::UpdateHandle
UpdateHandle(const std::string &sgkey, const std::string &storename=StoreID::storeName(StoreID::EVENT_STORE))
Constructor specifying the key as a string.
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35