ATLAS Offline Software
ActiveStoreSvc.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 #include "GaudiKernel/MsgStream.h"
10 #include "GaudiKernel/ISvcLocator.h"
11 
12 using namespace SG;
13 
14 
18 
20 
21  msg() << MSG::VERBOSE << "Initializing " << name() << endmsg;
22 
23  SmartIF<StoreGateSvc> storeGate{service(m_storeName, /*createIf*/true)};
24  CHECK( storeGate.isValid() );
25  storeGate->makeCurrent();
26 
27  return StatusCode::SUCCESS;
28 }
29 
32  s->makeCurrent();
33 }
34 
36 DataProxy*
37 ActiveStoreSvc::proxy(const void* const pTransient) const {
38  return activeStore()->proxy(pTransient);
39 }
40 
42 DataProxy*
43 ActiveStoreSvc::proxy(const CLID& id, const std::string& key) const {
44  return activeStore()->proxy(id,key);
45 }
46 
48 {
49  return activeStore()->proxy_exact (sgkey);
50 }
51 
53 std::vector<const SG::DataProxy*>
55  return activeStore()->proxies();
56 }
57 
58 
61 {
62  return activeStore()->addToStore (id, proxy);
63 }
64 
65 
84  const std::string& key,
85  bool allowMods,
86  bool returnExisting)
87 {
88  return activeStore()->recordObject (obj, key, allowMods, returnExisting);
89 }
90 
91 
100 sgkey_t ActiveStoreSvc::stringToKey (const std::string& str, CLID clid)
101 {
102  return activeStore()->stringToKey (str, clid);
103 }
104 
105 
113 const std::string* ActiveStoreSvc::keyToString (sgkey_t key) const
114 {
115  return activeStore()->keyToString (key);
116 }
117 
118 
127 const std::string* ActiveStoreSvc::keyToString (sgkey_t key,
128  CLID& clid) const
129 {
130  return activeStore()->keyToString (key, clid);
131 }
132 
133 
147  const std::string& str,
148  CLID clid)
149 {
150  return activeStore()->registerKey (key, str, clid);
151 }
152 
153 
155 {
157 }
common.sgkey
def sgkey(tool)
Definition: common.py:1027
ActiveStoreSvc.h
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:407
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
initialize
void initialize()
Definition: run_EoverP.cxx:894
ActiveStoreSvc::proxy_exact
virtual SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const override
Get proxy given a hashed key+clid.
Definition: ActiveStoreSvc.cxx:47
ActiveStoreSvc::proxies
virtual std::vector< const SG::DataProxy * > proxies() const override
return the list of all current proxies in store
Definition: ActiveStoreSvc.cxx:54
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
StoreGateSvc::currentStoreGate
static StoreGateSvc * currentStoreGate()
get current StoreGate
Definition: StoreGateSvc.cxx:51
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
ActiveStoreSvc::initialize
virtual StatusCode initialize() override
Service initialization.
Definition: ActiveStoreSvc.cxx:17
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ActiveStoreSvc::activeStoreOOL
StoreGateSvc * activeStoreOOL() const
Definition: ActiveStoreSvc.cxx:154
errorcheck.h
Helpers for checking error return status codes and reporting errors.
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
ActiveStoreSvc::stringToKey
virtual sgkey_t stringToKey(const std::string &str, CLID clid) override
Find the key for a string/CLID pair.
Definition: ActiveStoreSvc.cxx:100
ActiveStoreSvc::keyToString
virtual const std::string * keyToString(sgkey_t key) const override
Find the string corresponding to a given key.
ActiveStoreSvc::registerKey
virtual void registerKey(sgkey_t key, const std::string &str, CLID clid) override
Remember an additional mapping from key to string/CLID.
Definition: ActiveStoreSvc.cxx:146
hydjet.StoreGateSvc
StoreGateSvc
Definition: hydjet.minbias.pbpb5520.r12345.job.py:40
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
ActiveStoreSvc::setStore
void setStore(StoreGateSvc *s)
set the active store pointer: used by the event loop mgrs
Definition: ActiveStoreSvc.cxx:31
str
Definition: BTagTrackIpAccessor.cxx:11
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:13
SG::DataObjectSharedPtr
Smart pointer to manage DataObject reference counts.
Definition: DataObjectSharedPtr.h:45
python.PyAthena.obj
obj
Definition: PyAthena.py:132
SG::DataProxy
Definition: DataProxy.h:45
StoreGateSvc.h
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
ActiveStoreSvc::recordObject
virtual SG::DataProxy * recordObject(SG::DataObjectSharedPtr< DataObject > obj, const std::string &key, bool allowMods, bool returnExisting) override
Record an object in the store.
Definition: ActiveStoreSvc.cxx:83
ActiveStoreSvc::addToStore
StatusCode addToStore(CLID id, SG::DataProxy *proxy) override
Raw addition of a proxy to the store.
Definition: ActiveStoreSvc.cxx:60
python.PyKernel.storeGate
storeGate
Definition: PyKernel.py:40
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
ActiveStoreSvc::proxy
virtual SG::DataProxy * proxy(const void *const pTransient) const override
get proxy for a given data object address in memory
Definition: ActiveStoreSvc.cxx:37