ATLAS Offline Software
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 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id: UpdateHandle.h 797637 2017-02-17 02:32:11Z ssnyder $
15 #ifndef STOREGATE_SG_UPDATEHANDLE_H
16 #define STOREGATE_SG_UPDATEHANDLE_H 1
17 
18 
21 #include "StoreGate/StoreGateSvc.h" /* needed by clients */
22 #include "GaudiKernel/EventContext.h"
23 #include <string>
24 
25 
26 
27 namespace SG {
28 
29 
30  // Helper for testing thread_safe.
31  // Unless explicitly specialized,
32  // IsThreadSafeForUH<T, std::true_type>::type will be true_type if
33  // T has a `typedef std::true_type thread_safe', and false_type otherwise.
34  template <class T, class VALT>
36  {
37  typedef std::false_type type;
38  };
39  template <class T>
40  struct IsThreadSafeForUH<T, typename T::thread_safe>
41  {
42  typedef std::true_type type;
43  };
44 
45 
91  template <class T>
93  : public SG::VarHandleBase
94  {
95  public:
96  typedef T* pointer_type; // FIXME: better handling of
97  typedef const T* const_pointer_type; // qualified T type ?
98  typedef T& reference_type;
99  typedef const T& const_reference_type;
100 
101 
102  private:
103  // Verify that the payload has a thread_safe typedef yielding std::true_type.
105  "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.");
106  public:
107 
108 
109  //************************************************************************
110  // Constructors, etc.
111  //
112 
113 
120 
121 
127  UpdateHandle(const std::string& sgkey,
128  const std::string& storename = StoreID::storeName(StoreID::EVENT_STORE));
129 
130 
139 
140 
152  explicit UpdateHandle (const UpdateHandleKey<T>& key,const EventContext& ctx);
153 
154 
158  UpdateHandle( const UpdateHandle& rhs );
159 
160 
165 
166 
171 
172 
177 
178 
179  //************************************************************************
180  // Dereference.
181  //
182 
183 
191 
192 
200 
201 
209 
210 
218 
219 
224 
225 
229  virtual bool isValid() override final;
230 
231 
232  // FIXME: Remove this once IResetable is cleaned up.
233  using IResetable::reset;
234 
235 
242  virtual void reset (bool hard) override;
243 
244 
245  private:
251  };
252 
253 
261  template <class T>
263 
264 
276  template <class T>
278  const EventContext& ctx);
279 
280 
281 } /* namespace SG */
282 
283 
284 #include "StoreGate/UpdateHandle.icc"
285 
286 
287 #ifndef NO_LEGACY_HANDLES
288 namespace SG {
289  template <class T>
291 }
292 #endif
293 
294 #endif //> !STOREGATE_SG_UPDATEHANDLE_H
VarHandleBase.h
Base class for VarHandle classes.
common.sgkey
def sgkey(tool)
Definition: common.py:1028
SG::UpdateHandle::operator=
UpdateHandle & operator=(const UpdateHandle &rhs)
Assignment operator.
SG::IsThreadSafeForUH
Definition: UpdateHandle.h:36
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::UpdateHandleKey
Property holding a SG store/key/clid from which an UpdateHandle is made.
Definition: UpdateHandleKey.h:40
SG::VarHandleBase
Base class for VarHandle types.
Definition: StoreGate/StoreGate/VarHandleBase.h:83
SG::UpdateHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::UpdateHandle::operator->
pointer_type operator->()
Dereference the pointer.
taskman.template
dictionary template
Definition: taskman.py:317
SG::IsThreadSafeForUH< T, typename T::thread_safe >::type
std::true_type type
Definition: UpdateHandle.h:42
SG::UpdateHandle::const_pointer_type
const T * const_pointer_type
Definition: UpdateHandle.h:97
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
SG::UpdateHandle::UpdateHandle
UpdateHandle(const UpdateHandleKey< T > &key)
Constructor from an UpdateHandleKey.
SG::UpdateHandle::pointer_type
T * pointer_type
Definition: UpdateHandle.h:96
SG::UpdateHandle::ptr
pointer_type ptr()
Dereference the pointer.
SG::UpdateHandle::UpdateHandle
UpdateHandle()
Default constructor.
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
IResetable
a resetable object (e.g. a SG DataHandle)
Definition: IResetable.h:15
SG::IsThreadSafeForUH::type
std::false_type type
Definition: UpdateHandle.h:37
SG::UpdateHandle::operator*
reference_type operator*()
Dereference the pointer.
SG::UpdateHandle::reset
virtual void reset(bool hard) override
Reset this handle.
SG::UpdateHandle::cachedPtr
pointer_type cachedPtr()
Return the cached pointer directly; no lookup.
SG::UpdateHandle::UpdateHandle
UpdateHandle(const UpdateHandle &rhs)
Copy constructor.
SG::UpdateHandle::UpdateHandle
UpdateHandle(UpdateHandle &&rhs)
Move constructor.
SG::UpdateHandle::const_reference_type
const T & const_reference_type
Definition: UpdateHandle.h:99
UpdateHandleKey.h
Property holding a SG store/key/clid from which an UpdateHandle is made.
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
SG::UpdateHandle
Definition: UpdateHandle.h:94
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
python.Dumpers.typename
def typename(t)
Definition: Dumpers.py:194
SG::UpdateHandle::UpdateHandle
UpdateHandle(const UpdateHandleKey< T > &key, const EventContext &ctx)
Constructor from an UpdateHandleKey and an explicit event context.
SG::UpdateHandle::reference_type
T & reference_type
Definition: UpdateHandle.h:98
SG::UpdateHandle::checkedPtr
pointer_type checkedPtr()
Helper: dereference the pointer.
SG::UpdateHandle::operator=
UpdateHandle & operator=(UpdateHandle &&rhs)
Move operator.
UpdateHandle< T >
a smart pointer to an object of a given type in an IProxyDict (such as StoreGateSvc)....
StoreID::EVENT_STORE
@ EVENT_STORE
Definition: StoreID.h:26
StoreGateSvc.h
StoreID::storeName
static const std::string & storeName(const StoreID::type &s)
Definition: StoreID.cxx:77
SG::UpdateHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
SG::UpdateHandle::UpdateHandle
UpdateHandle(const std::string &sgkey, const std::string &storename=StoreID::storeName(StoreID::EVENT_STORE))
Constructor with full arguments.
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35