ATLAS Offline Software
ProxyProviderSvc.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 */
6 
13 #ifndef SGCOMPS_PROXYPROVIDERSVC_H
14 # define SGCOMPS_PROXYPROVIDERSVC_H 1
15 
17 #include "AthenaKernel/StoreID.h"
18 #include "Gaudi/Property.h" /*StringArrayProperty*/
19 #include "GaudiKernel/StatusCode.h"
20 #include <cassert>
21 #include <list>
22 #include <string>
23 #include <algorithm>
24 #include <vector>
25 
26 // framework includes
28 
29 namespace SG {
30  class DataProxy;
31  class TransientAddress;
32 }
33 
34 class IAddressProvider;
35 class IProxyRegistry; //this is DataStore
36 class IConversionSvc;
37 class IOpaqueAddress;
38 class ISvcLocator;
39 
41 class ProxyProviderSvc : public extends<AthService, IProxyProviderSvc>
42 {
43 public:
45  typedef std::list<SG::TransientAddress*> TAdList;
47 
49 
50  virtual StatusCode preLoadProxies(IProxyRegistry& storeToModify) override;
52 
54  virtual StatusCode loadProxies(IProxyRegistry& storeToModify) override;
55 
59  virtual SG::DataProxy* retrieveProxy(const CLID& id, const std::string& key,
60  IProxyRegistry& storeToModify) override;
61 
63  SG::DataProxy* addAddress(IProxyRegistry& storeToModify,
64  SG::TransientAddress&& tad);
66 
67 
70  virtual void addProvider(IAddressProvider* aProvider) override final;
71 
73 
74  virtual StatusCode initialize() override;
76 
78  ProxyProviderSvc(const std::string& name, ISvcLocator* svcLoc);
79  virtual ~ProxyProviderSvc();
80 
81 private:
89  const EventContext& contextFromStore (IProxyRegistry& ds) const;
90 
91 
98  TAdList& tList);
99 
100 
102  StringArrayProperty m_providerNames{this,"ProviderNames",{},
103  "names of the services to be use as address providers","OrderedSet<std::string>"};
105  void providerNamesPropertyHandler( Gaudi::Details::PropertyBase& theProp );
106 
108 
110  std::list<IAddressProvider*> m_providers;
113 
115  std::vector<IProxyRegistry*> m_pendingLoad;
116 };
117 
118 
120  assert(aProvider);
121  if (find(m_providers.begin(), m_providers.end(), aProvider) == m_providers.end()) {
122  m_providers.push_back(aProvider);
123  }
124 }
125 
126 #endif // !SGCOMPS_PROXYPROVIDERSVC_H
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
SGTest::store
TestStore store
Definition: TestStore.cxx:23
ProxyProviderSvc::pAPiterator
std::list< IAddressProvider * >::iterator pAPiterator
Definition: ProxyProviderSvc.h:44
checkxAOD.ds
ds
Definition: Tools/PyUtils/bin/checkxAOD.py:260
ProxyProviderSvc::ProxyProviderSvc
ProxyProviderSvc(const std::string &name, ISvcLocator *svcLoc)
Standard Service Constructor.
Definition: ProxyProviderSvc.cxx:51
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
IProxyRegistry
a proxy registry (a read/write dictionary)
Definition: IProxyRegistry.h:27
ProxyProviderSvc::addProvider
virtual void addProvider(IAddressProvider *aProvider) override final
IAddressProvider manager functionality add a provider to the set of known ones.
Definition: ProxyProviderSvc.h:119
ProxyProviderSvc::m_pendingLoad
std::vector< IProxyRegistry * > m_pendingLoad
List of pending stores on which to run preLoadProxies().
Definition: ProxyProviderSvc.h:115
ProxyProviderSvc::doPreLoadProxies
StatusCode doPreLoadProxies(IProxyRegistry &storeToModify)
Definition: ProxyProviderSvc.cxx:101
SG::TransientAddress
Definition: TransientAddress.h:32
ProxyProviderSvc::TAdIterator
TAdList::iterator TAdIterator
Definition: ProxyProviderSvc.h:46
ProxyProviderSvc::m_providerNames
StringArrayProperty m_providerNames
property: the services declared as providers
Definition: ProxyProviderSvc.h:102
ProxyProviderSvc
manages the address providers and add proxies on demand to the store
Definition: ProxyProviderSvc.h:42
ProxyProviderSvc::initialize
virtual StatusCode initialize() override
Service boilerplate.
Definition: ProxyProviderSvc.cxx:62
ProxyProviderSvc::addAddresses
StatusCode addAddresses(IProxyRegistry &store, TAdList &tList)
Add lists of TADs to the store.
Definition: ProxyProviderSvc.cxx:157
ProxyProviderSvc::loadProxies
virtual StatusCode loadProxies(IProxyRegistry &storeToModify) override
add proxies to the store to modify (during Begin Event)
Definition: ProxyProviderSvc.cxx:137
ProxyProviderSvc::addAddress
SG::DataProxy * addAddress(IProxyRegistry &storeToModify, SG::TransientAddress &&tad)
create a new Proxy, overriding CLID and/or key
Definition: ProxyProviderSvc.cxx:183
ProxyProviderSvc::m_pDataLoader
ServiceHandle< IConversionSvc > m_pDataLoader
Persistency Service.
Definition: ProxyProviderSvc.h:112
ProxyProviderSvc::m_providers
std::list< IAddressProvider * > m_providers
the providers we know about. WE DON'T OWN THEM
Definition: ProxyProviderSvc.h:110
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IAddressProvider
interface for IOA providers
Definition: IAddressProvider.h:28
DataProxy
DataProxy provides the registry services for StoreGate.
Definition: DataProxy.h:32
ProxyProviderSvc::retrieveProxy
virtual SG::DataProxy * retrieveProxy(const CLID &id, const std::string &key, IProxyRegistry &storeToModify) override
Use a provider to create a proxy for ID/KEY.
Definition: ProxyProviderSvc.cxx:247
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
StoreID.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ProxyProviderSvc::preLoadProxies
virtual StatusCode preLoadProxies(IProxyRegistry &storeToModify) override
IProxyProvider interface.
Definition: ProxyProviderSvc.cxx:119
ProxyProviderSvc::TAdList
std::list< SG::TransientAddress * > TAdList
Definition: ProxyProviderSvc.h:45
ProxyProviderSvc::contextFromStore
const EventContext & contextFromStore(IProxyRegistry &ds) const
Retrieve the EventContext saved in store DS.
Definition: ProxyProviderSvc.cxx:273
AthService.h
IProxyProviderSvc.h
SG::DataProxy
Definition: DataProxy.h:45
ProxyProviderSvc::~ProxyProviderSvc
virtual ~ProxyProviderSvc()
Definition: ProxyProviderSvc.cxx:59
ProxyProviderSvc::providerNamesPropertyHandler
void providerNamesPropertyHandler(Gaudi::Details::PropertyBase &theProp)
the handler for m_providerNames
Definition: ProxyProviderSvc.cxx:287
ServiceHandle< IConversionSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37