ATLAS Offline Software
Loading...
Searching...
No Matches
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*/
11
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
24namespace 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
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#endif //> !STOREGATE_SG_UPDATEHANDLE_H
Base class for VarHandle classes.
Property holding a SG store/key/clid from which an UpdateHandle is made.
a resetable object (e.g.
Definition IResetable.h:15
Property holding a SG store/key/clid from which an UpdateHandle is made.
UpdateHandle(const UpdateHandleKey< T > &key, const EventContext &ctx)
Constructor from an UpdateHandleKey and an explicit event context.
pointer_type operator->()
Dereference the pointer.
const_pointer_type cptr()
Dereference the pointer.
UpdateHandle(const UpdateHandleKey< T > &key)
Constructor from an UpdateHandleKey.
UpdateHandle(const UpdateHandle &rhs)
Copy constructor.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
UpdateHandle()
Default constructor.
pointer_type cachedPtr()
Return the cached pointer directly; no lookup.
UpdateHandle(SG::UpdateHandleKey< T > &&key)=delete
pointer_type ptr()
Dereference the pointer.
UpdateHandle(SG::UpdateHandleKey< T > &&key, const EventContext &ctx)=delete
UpdateHandle(const std::string &sgkey, const std::string &storename, const EventContext &ctx)
Constructor specifying the key as a string, with context.
UpdateHandle(UpdateHandle &&rhs)
Move constructor.
reference_type operator*()
Dereference the pointer.
const T * const_pointer_type
UpdateHandle & operator=(const UpdateHandle &rhs)
Assignment operator.
UpdateHandle & operator=(UpdateHandle &&rhs)
Move operator.
UpdateHandle(const std::string &sgkey, const std::string &storename=StoreID::storeName(StoreID::EVENT_STORE))
Constructor specifying the key as a string.
virtual void reset(bool hard) override
UpdateHandle(const std::string &sgkey, const EventContext &ctx)
Constructor specifying the key as a string, with context.
const T & const_reference_type
Base class for VarHandle types.
virtual const std::string & key() const override final
@ EVENT_STORE
Definition StoreID.h:26
static const std::string & storeName(const StoreID::type &s)
Definition StoreID.cxx:77
Forward declaration.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
std::false_type type
#define private