ATLAS Offline Software
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 /*
4  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id: ReadHandle.h 797637 2017-02-17 02:32:11Z ssnyder $
15 #ifndef STOREGATE_SG_READHANDLE_H
16 #define STOREGATE_SG_READHANDLE_H 1
17 
18 
23 #include "GaudiKernel/EventContext.h"
24 #include <string>
25 
26 
27 
28 namespace SG {
29 
30 
67 template <class T>
69  : public SG::VarHandleBase
70 {
71 public:
72  typedef T* pointer_type; // FIXME: better handling of
73  typedef const T* const_pointer_type; // qualified T type ?
74  typedef T& reference_type;
75  typedef const T& const_reference_type;
76 
77 
78  //************************************************************************
79  // Constructors, etc.
80  //
81 
82 
89 
90 
96  explicit ReadHandle(const std::string& sgkey,
97  const std::string& storename = StoreID::storeName(StoreID::EVENT_STORE));
98 
99 
107  explicit ReadHandle (const ReadHandleKey<T>& key);
108 
109 
121  explicit ReadHandle (const ReadHandleKey<T>& key, const EventContext& ctx);
122 
123 
132 
133 
137  ReadHandle( const ReadHandle& rhs );
138 
139 
144 
145 
149  ReadHandle& operator=( const ReadHandle& rhs );
150 
151 
156 
157 
158  //************************************************************************
159  // Dereference.
160  //
161 
162 
168 
169 
175 
176 
182 
183 
189 
190 
195 
196 
200  virtual bool isValid() override final;
201 
202 
207 
208 
213  const_pointer_type get (const EventContext& ctx) const;
214 
215 
216  //************************************************************************
217  // Alias.
218  //
219 
220 
230 
231 
232 protected:
238  explicit ReadHandle (const VarHandleKey& key, const EventContext* ctx);
239 
240 
241 private:
247 };
248 
249 
257 template <class T>
259 
260 
272 template <class T>
274  const EventContext& ctx);
275 
276 
283 template <class T>
285 
286 
287 
295 template <class T>
297  const EventContext& ctx);
298 
299 
300 } /* namespace SG */
301 
302 
303 
304 #include "StoreGate/ReadHandle.icc"
305 
306 
307 #ifndef NO_LEGACY_HANDLES
308 namespace SG {
309  template <class T>
311 }
312 #endif
313 
314 
315 #endif //> !STOREGATE_SG_READHANDLE_H
VarHandleBase.h
Base class for VarHandle classes.
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
SG::ReadHandle::checkedCPtr
const_pointer_type checkedCPtr()
Helper: dereference the pointer.
common.sgkey
def sgkey(tool)
Definition: common.py:1028
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
SG::VarHandleBase
Base class for VarHandle types.
Definition: StoreGate/StoreGate/VarHandleBase.h:83
taskman.template
dictionary template
Definition: taskman.py:317
SG::ReadHandle::ReadHandle
ReadHandle(const ReadHandleKey< T > &key, const EventContext &ctx)
Constructor from a ReadHandleKey and an explicit event context.
LArHitContainer
Hit collection.
Definition: LArHitContainer.h:26
SG::ReadHandle::operator*
const_reference_type operator*()
Dereference the pointer.
SG::ReadHandle::operator=
ReadHandle & operator=(const ReadHandle &rhs)
Assignment operator.
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
SG::ReadHandle::ReadHandle
ReadHandle(ReadHandle &&rhs)
Move constructor.
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
protected
#define protected
Definition: DetDescrConditionsDict_dict_fixes.cxx:14
ReadHandle< T >
a smart pointer to an object of a given type in an IProxyDict (such as StoreGateSvc)....
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
SG::ReadHandle::cachedPtr
const_pointer_type cachedPtr() const
Return the cached pointer directly; no lookup.
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::ReadHandle::get
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
SG::ReadHandle::operator->
const_pointer_type operator->()
Dereference the pointer.
SG::ReadHandle::pointer_type
T * pointer_type
Definition: StoreGate/StoreGate/ReadHandle.h:72
SG::ReadHandle::reference_type
T & reference_type
Definition: StoreGate/StoreGate/ReadHandle.h:74
SG::ReadHandle::ReadHandle
ReadHandle(const ReadHandle &rhs)
Copy constructor.
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
SG::ReadHandle::ReadHandle
ReadHandle(SG::DataProxy *proxy)
Constructor from a DataProxy.
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
SG::VarHandleKey
A property holding a SG store/key/clid from which a VarHandle is made.
Definition: StoreGate/StoreGate/VarHandleKey.h:62
SG::ReadHandle::ptr
const_pointer_type ptr()
Dereference the pointer.
SG::ReadHandle::const_pointer_type
const T * const_pointer_type
Definition: StoreGate/StoreGate/ReadHandle.h:73
SG::ReadHandle::const_reference_type
const T & const_reference_type
Definition: StoreGate/StoreGate/ReadHandle.h:75
SG::ReadHandle::ReadHandle
ReadHandle(const std::string &sgkey, const std::string &storename=StoreID::storeName(StoreID::EVENT_STORE))
Constructor with full arguments.
SG::ReadHandle::operator=
ReadHandle & operator=(ReadHandle &&rhs)
Move operator.
StoreID::EVENT_STORE
@ EVENT_STORE
Definition: StoreID.h:26
SG::ReadHandle::ReadHandle
ReadHandle(const ReadHandleKey< T > &key)
Constructor from a ReadHandleKey.
SG::DataProxy
Definition: DataProxy.h:44
StoreID::storeName
static const std::string & storeName(const StoreID::type &s)
Definition: StoreID.cxx:77
SG::ReadHandle::ReadHandle
ReadHandle()
Default constructor.
SG::ReadHandle::alias
StatusCode alias(const WriteHandleKey< T > &key)
Make an alias.