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-2026 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
86 template <class T>
88 : public SG::VarHandleBase
89 {
90 public:
91 typedef T* pointer_type; // FIXME: better handling of
92 typedef const T* const_pointer_type; // qualified T type ?
93 typedef T& reference_type;
94 typedef const T& const_reference_type;
95
96
97 private:
98 // Verify that the payload has a thread_safe typedef yielding std::true_type.
100 "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.");
101 public:
102
103
104 //************************************************************************
105 // Constructors, etc.
106 //
107
108
115
116
122 UpdateHandle(const std::string& sgkey,
123 const std::string& storename = StoreID::storeName(StoreID::EVENT_STORE));
124
125
131 explicit UpdateHandle(const std::string& sgkey, const EventContext& ctx);
132
133
139 explicit UpdateHandle(const std::string& sgkey, IProxyDict* sg);
140
141
148 explicit UpdateHandle(const std::string& sgkey,
149 const std::string& storename,
150 const EventContext& ctx);
151
152
161
162
174 explicit UpdateHandle (const UpdateHandleKey<T>& key,const EventContext& ctx);
175
176
177 // Disallow initialization from a temporary Key object.
178 explicit UpdateHandle (SG::UpdateHandleKey<T>&& key) = delete; // Not allowed from a temporary.
180 const EventContext& ctx) = delete; // Not allowed from a temporary.
181
182
187
188
193
194
199
200
205
206
207 //************************************************************************
208 // Dereference.
209 //
210
211
219
220
228
229
237
238
246
247
252
253
257 virtual bool isValid() override final;
258
259
260 // FIXME: Remove this once IResetable is cleaned up.
261 using IResetable::reset;
262
263
270 virtual void reset (bool hard) override;
271
272
273 private:
279 };
280
281
289 template <class T>
291
292
304 template <class T>
306 const EventContext& ctx);
307
308
309} /* namespace SG */
310
311
312#include "StoreGate/UpdateHandle.icc"
313
314
315#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.
UpdateHandle(const std::string &sgkey, IProxyDict *sg)
Constructor specifying the key as a string, with data store.
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
Definition testRead.cxx:27