ATLAS Offline Software
Loading...
Searching...
No Matches
AddressRemappingSvc.h
Go to the documentation of this file.
1// -*- C++ -*-
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7#ifndef SGCOMPS_ADDRESSREMAPPINGSVC_H
8#define SGCOMPS_ADDRESSREMAPPINGSVC_H 1
9
14
15#include "GaudiKernel/ClassID.h"
16#include "GaudiKernel/ServiceHandle.h"
17#include "Gaudi/Property.h" // no forward decl: typedef
21#include "GaudiKernel/IAlgResourcePool.h"
26
27#include <vector>
28#include <string>
29#include <mutex>
30
31// Forward declarations
32class IClassIDSvc;
33class IProxyDict;
34class IRCUSvc;
35
40 : public extends<AthService, Athena::IInputRename, IAddressProvider>
41{
42
43public:
44
45 // Constructor and Destructor
47 AddressRemappingSvc(const std::string& name, ISvcLocator* pSvcLocator);
49 virtual ~AddressRemappingSvc();
50
51public: // Non-static members
53 virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE () override;
55 virtual StatusCode finalize() override;
56
60 virtual StatusCode preLoadAddresses(StoreID::type storeID, IAddressProvider::tadList& tads) override;
61
63 virtual StatusCode loadAddresses(StoreID::type storeID, IAddressProvider::tadList& tads) override;
64
67 virtual StatusCode updateAddress(StoreID::type /*storeID*/,
69 const EventContext& ctx) override;
70
71
77 virtual const IInputRename::InputRenameRCU_t* inputRenameMap() const override;
78
79
80private: // Data
82 ServiceHandle<IProxyDict> m_proxyDict{this,"ProxyDict","StoreGateSvc",
83 "the IProxyDict we want to apply the remapping to (by default the event store)"};
85 ServiceHandle<IAlgResourcePool> m_algResourcePool{this,"AlgResourcePool","AlgResourcePool",
86 "Algorithm resource pool service."};
87
89 StringArrayProperty m_overwriteMaps{this,"TypeKeyOverwriteMaps",{},"","OrderedSet<std::string>"};
90 std::vector<SG::TransientAddress> m_oldTads;
91 std::vector<SG::TransientAddress> m_newTads;
92
93 // The old and new TADS list, possibly cleaned of nonexistent CLIDs.
94 // If SkipBadRemappings is true, then for the first event, we defer
95 // preloading the TADS until loadAddresses, where we can compare them
96 // against what's in the event store.
99
101 Gaudi::Property<std::vector<std::string> >m_typeKeyRenameMaps{this,"TypeKeyRenameMaps",{},
102 "List of renamings to apply to input objects. This is distinct from the "
103 "mappings given by TypeKeyOverwriteMaps in that objects listed under "
104 "TypeKeyOverwriteMaps are accessible by both the old and new names; "
105 "while for TypeKeyRenameMaps, only the new names are visible (so the old names "
106 "may be rewritten). Overwriting may also change the visible type of an object, "
107 "while renaming may not. Format of list elements is OLDNAME#TYPE->NEWNAME.","OrderedSet<std::string>"};
108
114 std::unique_ptr<InputRenameRCU_t> m_inputRenames;
115
116 Gaudi::Property<bool> m_skipBadRemappings{this,"SkipBadRemappings",false,
117 "If true, will delay the remapping setup until the first load, and will check against the given file"};
118
119 // This mutex protects the two following members.
120 mutable std::mutex m_deletesMutex;
121 std::atomic<bool> m_haveDeletes=false;
122 std::unordered_multimap<std::string, CLID> m_deletes;
123
124
125private:
126 CLID getClid(const std::string& type) const;
127
128 StatusCode preLoadAddressesConst(StoreID::type storeID, IAddressProvider::tadList& tads) const;
129
130 StatusCode updateAddressConst(StoreID::type /*storeID*/,
132 const EventContext& ctx) const;
133
134 StatusCode loadAddressesConst(IAddressProvider::tadList& tads) const;
135
143 void addInputRenames (const InputRenameMap_t& toadd) const;
144
145
149 StatusCode initInputRenames ATLAS_NOT_THREAD_SAFE ();
150 StatusCode renameTads (IAddressProvider::tadList& tads) const;
151
152 void initDeletes();
153 bool isDeleted (const SG::TransientAddress& tad) const;
154};
155#endif // !SGCOMPS_ADDRESSREMAPPINGSVC_H
Cached value with atomic update.
uint32_t CLID
The Class ID type.
Interface to retrieve input rename map.
read-copy-update (RCU) style synchronization for Athena.
Define macros for attributes used to control the static checker.
ServiceHandle< IAlgResourcePool > m_algResourcePool
void addInputRenames(const InputRenameMap_t &toadd) const
Merge in additional input rename mappings.
Athena::IInputRename::InputRenameRCU_t InputRenameRCU_t
virtual const IInputRename::InputRenameRCU_t * inputRenameMap() const override
Retrieve a pointer to the input rename map.
StringArrayProperty m_overwriteMaps
TypeKeyOverwriteMaps, map for type::key overwrites.
std::unique_ptr< InputRenameRCU_t > m_inputRenames
Gaudi::Property< std::vector< std::string > > m_typeKeyRenameMaps
Property: list of requested input renames.
StatusCode updateAddressConst(StoreID::type, SG::TransientAddress *pTad, const EventContext &ctx) const
bool isDeleted(const SG::TransientAddress &tad) const
ServiceHandle< Athena::IRCUSvc > m_RCUSvc
virtual StatusCode finalize() override
Required of all Gaudi services:
ServiceHandle< IClassIDSvc > m_clidSvc
StatusCode loadAddressesConst(IAddressProvider::tadList &tads) const
virtual StatusCode loadAddresses(StoreID::type storeID, IAddressProvider::tadList &tads) override
Implementation of the loadAddresses function without any functionality.
virtual StatusCode updateAddress(StoreID::type, SG::TransientAddress *pTad, const EventContext &ctx) override
Update a transient address.
ServiceHandle< IProxyDict > m_proxyDict
Athena::InputRenameMap_t InputRenameMap_t
Map of sgkey->sgkey for input renames.
std::vector< SG::TransientAddress > m_oldTads
StatusCode initInputRenames ATLAS_NOT_THREAD_SAFE()
Set up input rename mappings during initialization.
StatusCode renameTads(IAddressProvider::tadList &tads) const
Scan TAD list and carry out any requested renamings.
std::atomic< bool > m_haveDeletes
std::vector< SG::TransientAddress > m_newTads
std::unordered_multimap< std::string, CLID > m_deletes
virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE() override
Required of all Gaudi services:
CLID getClid(const std::string &type) const
StatusCode preLoadAddressesConst(StoreID::type storeID, IAddressProvider::tadList &tads) const
CxxUtils::CachedValue< std::vector< SG::TransientAddress > > m_newTadsCleaned
CxxUtils::CachedValue< std::vector< SG::TransientAddress > > m_oldTadsCleaned
Gaudi::Property< bool > m_skipBadRemappings
virtual StatusCode preLoadAddresses(StoreID::type storeID, IAddressProvider::tadList &tads) override
Get all addresses from provider.
RCUObject< InputRenameMap_t > InputRenameRCU_t
Cached value with atomic update.
Definition CachedValue.h:55
std::list< SG::TransientAddress * > tadList
SG::SGKeyMap< InputRenameEntry > InputRenameMap_t
void initialize()