ATLAS Offline Software
Loading...
Searching...
No Matches
AthToolSupport/AsgDataHandles/AsgDataHandles/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/*
4 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5*/
6
13
14#ifndef ASG_DATA_HANDLES_READ_HANDLE_H
15#define ASG_DATA_HANDLES_READ_HANDLE_H
16
17
18#ifndef XAOD_STANDALONE
20#else
21
23// #include "AsgDataHandles/ReadHandleKey.h"
24
25
26
27namespace SG {
28 template <class T> class ReadHandleKey;
29
30
37template <class T>
38class ReadHandle
39 : public SG::VarHandleBase
40{
41public:
42 typedef T* pointer_type; // FIXME: better handling of
43 typedef const T* const_pointer_type; // qualified T type ?
44 typedef T& reference_type;
45 typedef const T& const_reference_type;
46
47
48 //************************************************************************
49 // Constructors, etc.
50 //
51
52
58 ReadHandle() = default;
59
60
65 explicit ReadHandle(const std::string& sgkey);
66
67
75 explicit ReadHandle (const ReadHandleKey<T>& key);
76
77
89 explicit ReadHandle (const ReadHandleKey<T>& key, const EventContext& ctx);
90
91
92 //************************************************************************
93 // Dereference.
94 //
95
96
102
103
109
110
116
117
123
124
128 bool isValid();
129
130
134 const_pointer_type get() const;
135
136
141 const_pointer_type get (const EventContext& ctx) const;
142
143
149 bool isPresent() const;
150
151
158 bool isPresent_impl (const std::string& key) const;
159
160
161protected:
167 explicit ReadHandle (const VarHandleKey& key, const EventContext* ctx);
168
169
170private:
176
180 const_pointer_type getCPtr() const;
181};
182
183
191template <class T>
193
194
206template <class T>
208 const EventContext& ctx);
209
210
217template <class T>
218const T* get (const ReadHandleKey<T>& key);
219
220
221
229template <class T>
230const T* get (const ReadHandleKey<T>& key,
231 const EventContext& ctx);
232
233
234} /* namespace SG */
235
236
237
239
240#endif
241
242#endif //> !STOREGATE_SG_READHANDLE_H
Base class for VarHandle classes.
Handle class for reading from StoreGate.
virtual const std::string & key() const =0
Property holding a SG store/key/clid from which a ReadHandle is made.
const_pointer_type ptr()
Dereference the pointer.
ReadHandle()
Default constructor.
const_pointer_type checkedCPtr()
Helper: dereference the pointer.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type operator->()
Dereference the pointer.
const_reference_type operator*()
Dereference the pointer.
const_pointer_type cptr()
Dereference the pointer.
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
bool isPresent_impl(const std::string &key) const
Is the referenced object present in SG?
bool isPresent() const
Is the referenced object present in SG?
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())
unsigned long long T