ATLAS Offline Software
ProxyProviderSvc.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
14 #ifndef SGCOMPS_PROXYPROVIDERSVC_H
15 # define SGCOMPS_PROXYPROVIDERSVC_H 1
16 
18 #include "AthenaKernel/StoreID.h"
19 #include "Gaudi/Property.h" /*StringArrayProperty*/
20 #include "GaudiKernel/StatusCode.h"
21 #include <cassert>
22 #include <list>
23 #include <string>
24 #include <algorithm>
25 #include <vector>
26 
27 // framework includes
29 
30 namespace SG {
31  class DataProxy;
32  class TransientAddress;
33 }
34 
35 class IAddressProvider;
36 class IProxyRegistry; //this is DataStore
37 class IConversionSvc;
38 class IOpaqueAddress;
39 class ISvcLocator;
40 
42 class ProxyProviderSvc : public extends<AthService, IProxyProviderSvc>
43 {
44 public:
46  typedef std::list<SG::TransientAddress*> TAdList;
48 
50 
51  virtual StatusCode preLoadProxies(IProxyRegistry& storeToModify) override;
53 
55  virtual StatusCode loadProxies(IProxyRegistry& storeToModify) override;
56 
60  virtual SG::DataProxy* retrieveProxy(const CLID& id, const std::string& key,
61  IProxyRegistry& storeToModify) override;
62 
64  SG::DataProxy* addAddress(IProxyRegistry& storeToModify,
65  SG::TransientAddress&& tad);
67 
68 
71  virtual void addProvider(IAddressProvider* aProvider) override final;
72 
74 
75  virtual StatusCode initialize() override;
77 
79  ProxyProviderSvc(const std::string& name, ISvcLocator* svcLoc);
80  virtual ~ProxyProviderSvc();
81 
82 private:
90  const EventContext& contextFromStore (IProxyRegistry& ds) const;
91 
92 
99  TAdList& tList);
100 
101 
103  StringArrayProperty m_providerNames{this,"ProviderNames",{},
104  "names of the services to be use as address providers","OrderedSet<std::string>"};
106  void providerNamesPropertyHandler( Gaudi::Details::PropertyBase& theProp );
107 
109 
111  std::list<IAddressProvider*> m_providers;
113  IConversionSvc* m_pDataLoader{nullptr};
114 
116  std::vector<IProxyRegistry*> m_pendingLoad;
117 };
118 
119 
121  assert(aProvider);
122  if (find(m_providers.begin(), m_providers.end(), aProvider) == m_providers.end()) {
123  m_providers.push_back(aProvider);
124  }
125 }
126 
127 #endif // !SGCOMPS_PROXYPROVIDERSVC_H
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:69
ProxyProviderSvc::pAPiterator
std::list< IAddressProvider * >::iterator pAPiterator
Definition: ProxyProviderSvc.h:45
checkxAOD.ds
ds
Definition: Tools/PyUtils/bin/checkxAOD.py:257
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:120
ProxyProviderSvc::m_pendingLoad
std::vector< IProxyRegistry * > m_pendingLoad
List of pending stores on which to run preLoadProxies().
Definition: ProxyProviderSvc.h:116
ProxyProviderSvc::doPreLoadProxies
StatusCode doPreLoadProxies(IProxyRegistry &storeToModify)
Definition: ProxyProviderSvc.cxx:110
SG::TransientAddress
Definition: TransientAddress.h:32
ProxyProviderSvc::TAdIterator
TAdList::iterator TAdIterator
Definition: ProxyProviderSvc.h:47
ProxyProviderSvc::m_providerNames
StringArrayProperty m_providerNames
property: the services declared as providers
Definition: ProxyProviderSvc.h:103
ProxyProviderSvc
manages the address providers and add proxies on demand to the store
Definition: ProxyProviderSvc.h:43
ProxyProviderSvc::initialize
virtual StatusCode initialize() override
Service boilerplate.
Definition: ProxyProviderSvc.cxx:60
ProxyProviderSvc::addAddresses
StatusCode addAddresses(IProxyRegistry &store, TAdList &tList)
Add lists of TADs to the store.
Definition: ProxyProviderSvc.cxx:166
ProxyProviderSvc::loadProxies
virtual StatusCode loadProxies(IProxyRegistry &storeToModify) override
add proxies to the store to modify (during Begin Event)
Definition: ProxyProviderSvc.cxx:146
ProxyProviderSvc::addAddress
SG::DataProxy * addAddress(IProxyRegistry &storeToModify, SG::TransientAddress &&tad)
create a new Proxy, overriding CLID and/or key
Definition: ProxyProviderSvc.cxx:192
ProxyProviderSvc::m_providers
std::list< IAddressProvider * > m_providers
the providers we know about. WE DON'T OWN THEM
Definition: ProxyProviderSvc.h:111
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:31
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:256
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:195
ProxyProviderSvc::preLoadProxies
virtual StatusCode preLoadProxies(IProxyRegistry &storeToModify) override
IProxyProvider interface.
Definition: ProxyProviderSvc.cxx:128
ProxyProviderSvc::TAdList
std::list< SG::TransientAddress * > TAdList
Definition: ProxyProviderSvc.h:46
ProxyProviderSvc::m_pDataLoader
IConversionSvc * m_pDataLoader
Persistency Service.
Definition: ProxyProviderSvc.h:113
ProxyProviderSvc::contextFromStore
const EventContext & contextFromStore(IProxyRegistry &ds) const
Retrieve the EventContext saved in store DS.
Definition: ProxyProviderSvc.cxx:282
AthService.h
IProxyProviderSvc.h
SG::DataProxy
Definition: DataProxy.h:44
ProxyProviderSvc::~ProxyProviderSvc
virtual ~ProxyProviderSvc()
Definition: ProxyProviderSvc.cxx:57
ProxyProviderSvc::providerNamesPropertyHandler
void providerNamesPropertyHandler(Gaudi::Details::PropertyBase &theProp)
the handler for m_providerNames
Definition: ProxyProviderSvc.cxx:296
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37