ATLAS Offline Software
Loading...
Searching...
No Matches
StoreGate/StoreGate/ReadHandle.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_READHANDLE_H
13#define STOREGATE_SG_READHANDLE_H 1
14
15
20#include "GaudiKernel/EventContext.h"
21#include <string>
22
23
24
25namespace SG {
26
27
64template <class T>
66 : public SG::VarHandleBase
67{
68public:
69 typedef T* pointer_type; // FIXME: better handling of
70 typedef const T* const_pointer_type; // qualified T type ?
71 typedef T& reference_type;
72 typedef const T& const_reference_type;
73
74
75 //************************************************************************
76 // Constructors, etc.
77 //
78
79
86
87
93 explicit ReadHandle(const std::string& sgkey,
94 const std::string& storename = StoreID::storeName(StoreID::EVENT_STORE));
95
96
102 explicit ReadHandle(const std::string& sgkey,
103 const EventContext& ctx);
104
105
112 explicit ReadHandle(const std::string& sgkey,
113 const std::string& storename,
114 const EventContext& ctx);
115
116
124 explicit ReadHandle (const ReadHandleKey<T>& key);
125
126
138 explicit ReadHandle (const ReadHandleKey<T>& key, const EventContext& ctx);
139
140
148 explicit ReadHandle (SG::DataProxy* proxy);
149
150
151 // Disallow initialization from a temporary Key object.
152 explicit ReadHandle (SG::ReadHandleKey<T>&& key) = delete; // Not allowed from a temporary.
154 const EventContext& ctx) = delete; // Not allowed from a temporary.
155
156
160 ReadHandle( const ReadHandle& rhs );
161
162
167
168
173
174
179
180
181 //************************************************************************
182 // Dereference.
183 //
184
185
191
192
198
199
205
206
212
213
218
219
223 virtual bool isValid() override final;
224
225
230
231
236 const_pointer_type get (const EventContext& ctx) const;
237
238
239 //************************************************************************
240 // Alias.
241 //
242
243
252 StatusCode alias (const WriteHandleKey<T>& key);
253
254
261 explicit ReadHandle (const VarHandleKey& key, const EventContext* ctx);
262
263
264private:
270};
271
272
280template <class T>
282
283
295template <class T>
297 const EventContext& ctx);
298
299
306template <class T>
308
309
310
318template <class T>
320 const EventContext& ctx);
321
322
331template <class T>
332StatusCode get (const T*& ptr,
334 const EventContext& ctx);
335
336} /* namespace SG */
337
338
339
340#include "StoreGate/ReadHandle.icc"
341
342
343#endif //> !STOREGATE_SG_READHANDLE_H
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
#define protected
Property holding a SG store/key/clid from which a ReadHandle is made.
Base class for VarHandle classes.
Property holding a SG store/key/clid from which a WriteHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
ReadHandle(const ReadHandleKey< T > &key)
Constructor from a ReadHandleKey.
ReadHandle(const ReadHandleKey< T > &key, const EventContext &ctx)
Constructor from a ReadHandleKey and an explicit event context.
ReadHandle & operator=(ReadHandle &&rhs)
Move operator.
ReadHandle(const std::string &sgkey, const std::string &storename=StoreID::storeName(StoreID::EVENT_STORE))
Constructor specifying the key as a string.
ReadHandle & operator=(const ReadHandle &rhs)
Assignment operator.
ReadHandle(const ReadHandle &rhs)
Copy constructor.
ReadHandle(const std::string &sgkey, const std::string &storename, const EventContext &ctx)
Constructor specifying the key as a string, with context.
const_pointer_type ptr()
Dereference the pointer.
ReadHandle()
Default constructor.
StatusCode alias(const WriteHandleKey< xAOD::CaloClusterContainer > &key)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ReadHandle(const std::string &sgkey, const EventContext &ctx)
Constructor specifying the key as a string, with context.
const_pointer_type operator->()
Dereference the pointer.
ReadHandle(ReadHandle &&rhs)
Move constructor.
const_reference_type operator*()
Dereference the pointer.
ReadHandle(SG::DataProxy *proxy)
Constructor from a DataProxy.
const_pointer_type cptr()
Dereference the pointer.
ReadHandle(SG::ReadHandleKey< T > &&key, const EventContext &ctx)=delete
const_pointer_type cachedPtr() const
Return the cached pointer directly; no lookup.
ReadHandle(SG::ReadHandleKey< T > &&key)=delete
Base class for VarHandle types.
A property holding a SG store/key/clid from which a VarHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
@ EVENT_STORE
Definition StoreID.h:26
static const std::string & storeName(const StoreID::type &s)
Definition StoreID.cxx:77
Forward declaration.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
#define private