ATLAS Offline Software
StoreGate/StoreGate/VarHandleKey.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-2024 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id$
16 #ifndef STOREGATE_VARHANDLEKEY_H
17 #define STOREGATE_VARHANDLEKEY_H
18 
19 
21 #include "AthenaKernel/StoreID.h"
22 #include "GaudiKernel/DataHandle.h"
23 #include "GaudiKernel/ServiceHandle.h"
24 
25 
26 namespace SG {
27 
28 
30  AllowEmpty = 1
31 };
32 
33 
34 class VarHandleBase;
35 class VarHandleKeyProperty;
36 
61  : public Gaudi::DataHandle
62 {
63 public:
82  const std::string& sgkey,
84  const std::string& storeName = StoreID::storeName(StoreID::EVENT_STORE),
85  bool isCond = false);
86 
87 
92 
93 
106  VarHandleKey& operator= (const std::string& sgkey);
107 
108 
120  virtual StatusCode assign (const std::string& sgkey);
121 
122 
131  StatusCode initialize (bool used = true);
132 
133 
144 
145 
149  CLID clid() const;
150 
151 
155  const std::string& key() const;
156 
157 
161  bool empty() const;
162 
163 
168 
169 
178 
179 
183  bool isEventStore() const;
184 
185 
195  virtual StatusCode start();
196 
197 
204 
205 protected:
209  virtual std::string pythonRepr() const override;
210 
211 private:
213  friend class VarHandleBase;
215 
216 
218  virtual void setKey(DataObjID key) override final;
219  virtual void updateKey(std::string key) override final;
220 
221 
234  void parseKey (const std::string& sgkey, const std::string& storeName);
235 
236 
241  void updateHandle (const std::string& name);
242 
245 
247  std::string m_sgKey;
248 
251 
253  bool m_isEventStore = false;
254 
257 };
258 
259 
260 } // namespace SG
261 
262 namespace std {
263  ostream& operator<<(ostream& s, const SG::VarHandleKey& m);
264 }
265 
266 
268 
269 
270 #endif // not STOREGATE_VARHANDLEKEY_H
used
common.sgkey
def sgkey(tool)
Definition: common.py:1028
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::VarHandleKey::m_isEventStore
bool m_isEventStore
Cache test for whether we're referencing the event store.
Definition: StoreGate/StoreGate/VarHandleKey.h:253
SG::VarHandleKey::storeHandle
const ServiceHandle< IProxyDict > & storeHandle() const
Return handle to the referenced store.
SG::VarHandleBase
Base class for VarHandle types.
Definition: StoreGate/StoreGate/VarHandleBase.h:83
SG::VarHandleKey::m_storeHandle
ServiceHandle< IProxyDict > m_storeHandle
Handle to the referenced store.
Definition: StoreGate/StoreGate/VarHandleKey.h:244
SG::VarHandleKey::updateHandle
void updateHandle(const std::string &name)
Update the name of the store to which we're referring.
Definition: StoreGate/src/VarHandleKey.cxx:294
SG::VarHandleKey::m_hashedKey
SG::sgkey_t m_hashedKey
The hashed StoreGate key. May be 0 if not yet initialized.
Definition: StoreGate/StoreGate/VarHandleKey.h:250
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
SG::VarHandleKey::VarHandleKey
VarHandleKey(CLID clid, const std::string &sgkey, Gaudi::DataHandle::Mode a, const std::string &storeName=StoreID::storeName(StoreID::EVENT_STORE), bool isCond=false)
Constructor.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:38
SG::AllowEmptyEnum
AllowEmptyEnum
Definition: StoreGate/StoreGate/VarHandleKey.h:29
SG::VarHandleKey::pythonRepr
virtual std::string pythonRepr() const override
Python representation of Handle.
Definition: StoreGate/src/VarHandleKey.cxx:309
SG::VarHandleKey::setKey
virtual void setKey(DataObjID key) override final
Don't allow calling these.
Definition: StoreGate/src/VarHandleKey.cxx:186
VarHandleKey.icc
SG::VarHandleKey::assign
virtual StatusCode assign(const std::string &sgkey)
Change the key of the object to which we're referring.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:88
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::VarHandleKey::isEventStore
bool isEventStore() const
Does this key reference the primary event store?
SG::VarHandleKey::owningHandle
VarHandleBase * owningHandle()
Return the VarHandle that owns this key, if any.
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
SG::VarHandleKey::m_sgKey
std::string m_sgKey
StoreGate key, that doesn't include the storename.
Definition: StoreGate/StoreGate/VarHandleKey.h:247
StoreID.h
IProxyDict.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
SG::VarHandleKey::operator=
VarHandleKey & operator=(const std::string &sgkey)
Change the key of the object to which we're referring.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:68
EventContainers::Mode
Mode
Definition: IdentifiableContainerBase.h:13
operator<<
std::ostream & operator<<(std::ostream &lhs, const TestGaudiProperty &rhs)
Definition: TestGaudiProperty.cxx:69
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
SG::VarHandleKey::clid
CLID clid() const
Return the class ID for the referenced object.
Definition: StoreGate/src/VarHandleKey.cxx:177
SG::VarHandleKey
A property holding a SG store/key/clid from which a VarHandle is made.
Definition: StoreGate/StoreGate/VarHandleKey.h:62
SG::VarHandleKey::m_owningHandle
VarHandleBase * m_owningHandle
Handle that owns this key, or nullptr if it is not owned.
Definition: StoreGate/StoreGate/VarHandleKey.h:256
SG::VarHandleKey::parseKey
void parseKey(const std::string &sgkey, const std::string &storeName)
Handle assignment/construction from a string key.
Definition: StoreGate/src/VarHandleKey.cxx:217
a
TList * a
Definition: liststreamerinfos.cxx:10
SG::VarHandleKey::hashedKey
SG::sgkey_t hashedKey() const
Return the hashed StoreGate key.
SG::VarHandleKey::setOwningHandle
void setOwningHandle(VarHandleBase *handle)
StoreID::EVENT_STORE
@ EVENT_STORE
Definition: StoreID.h:26
SG::VarHandleKey::updateKey
virtual void updateKey(std::string key) override final
Prevent this method from being called.
Definition: StoreGate/src/VarHandleKey.cxx:195
SG::VarHandleKeyProperty
VarHandleKeyProperty is the class which wraps a SG::VarHandleKey.
Definition: VarHandleKeyProperty.h:81
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
StoreID::storeName
static const std::string & storeName(const StoreID::type &s)
Definition: StoreID.cxx:77
SG::VarHandleKey::start
virtual StatusCode start()
Called by the owning algorithm during the START transition.
ServiceHandle< IProxyDict >