ATLAS Offline Software
Loading...
Searching...
No Matches
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 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4*/
11
12
13#ifndef STOREGATE_VARHANDLEKEY_H
14#define STOREGATE_VARHANDLEKEY_H
15
16
19#include "GaudiKernel/DataHandle.h"
20#include "GaudiKernel/ServiceHandle.h"
21
22
23namespace SG {
24
25
29
30
31class VarHandleBase;
32class VarHandleKeyProperty;
33
58 : public Gaudi::DataHandle
59{
60public:
61 constexpr static bool isDecorHandleKey = false;
62
81 const std::string& sgkey,
82 Gaudi::DataHandle::Mode a,
83 const std::string& storeName = StoreID::storeName(StoreID::EVENT_STORE),
84 bool isCond = false);
85
86
91
92
105 VarHandleKey& operator= (const std::string& sgkey);
106
107
119 virtual StatusCode assign (const std::string& sgkey);
120
121
130 StatusCode initialize (bool used = true);
131
132
142 StatusCode initialize (AllowEmptyEnum);
143
144
148 CLID clid() const;
149
150
154 const std::string& key() const;
155
156
160 bool empty() const;
161
162
167
168
177
178
182 bool isEventStore() const;
183
184
194 virtual StatusCode start();
195
196
203
204protected:
208 virtual std::string pythonRepr() const override;
209
210private:
212 friend class VarHandleBase;
214
215
217 virtual void setKey(DataObjID key) override final;
218 virtual void updateKey(std::string key) override final;
219
220
233 void parseKey (const std::string& sgkey, const std::string& storeName);
234
235
240 void updateHandle (const std::string& name);
241
244
246 std::string m_sgKey;
247
250
252 bool m_isEventStore = false;
253
256};
257
258
259} // namespace SG
260
261namespace std {
263}
264
265
267
268
269#endif // not STOREGATE_VARHANDLEKEY_H
uint32_t CLID
The Class ID type.
static Double_t a
VarHandleKeyProperty is the class which wraps a SG::VarHandleKey.
A property holding a SG store/key/clid from which a VarHandle is made.
virtual void setKey(DataObjID key) override final
Don't allow calling these.
virtual void updateKey(std::string key) override final
Prevent this method from being called.
virtual std::string pythonRepr() const override
Python representation of Handle.
friend class VarHandleBase
Set the owning handle. Only callable from VarHandleBase.
static constexpr bool isDecorHandleKey
void parseKey(const std::string &sgkey, const std::string &storeName)
Handle assignment/construction from a string key.
VarHandleKey & operator=(const std::string &sgkey)
Change the key of the object to which we're referring.
SG::sgkey_t m_hashedKey
The hashed StoreGate key. May be 0 if not yet initialized.
CLID clid() const
Return the class ID for the referenced object.
ServiceHandle< IProxyDict > m_storeHandle
Handle to the referenced store.
bool isEventStore() const
Does this key reference the primary event store?
void setOwningHandle(VarHandleBase *handle)
const std::string & key() const
Return the StoreGate ID for the referenced object.
virtual StatusCode assign(const std::string &sgkey)
Change the key of the object to which we're referring.
const ServiceHandle< IProxyDict > & storeHandle() const
Return handle to the referenced store.
SG::VarHandleKeyProperty PropertyType
Declare corresponding property type.
VarHandleBase * owningHandle()
Return the VarHandle that owns this key, if any.
VarHandleBase * m_owningHandle
Handle that owns this key, or nullptr if it is not owned.
std::string m_sgKey
StoreGate key, that doesn't include the storename.
virtual StatusCode start()
Called by the owning algorithm during the START transition.
bool m_isEventStore
Cache test for whether we're referencing the event store.
VarHandleKey(CLID clid, const std::string &sgkey, Gaudi::DataHandle::Mode a, const std::string &storeName=StoreID::storeName(StoreID::EVENT_STORE), bool isCond=false)
Constructor.
SG::sgkey_t hashedKey() const
Return the hashed StoreGate key.
bool empty() const
Test if the key is blank.
void updateHandle(const std::string &name)
Update the name of the store to which we're referring.
@ EVENT_STORE
Definition StoreID.h:26
static const std::string & storeName(const StoreID::type &s)
Definition StoreID.cxx:77
STL class.
holding In fact this class is here in order to allow STL container for all features This class is sho...
Forward declaration.
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition sgkey_t.h:32
STL namespace.
ostream & operator<<(ostream &s, const SG::VarHandleKey &m)
void initialize()