ATLAS Offline Software
Loading...
Searching...
No Matches
IOVSvc.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef IOVSVC_IOVSVC_H
6#define IOVSVC_IOVSVC_H
7
8/*****************************************************************************
9 *
10 * IOVSvc.h
11 * IOVSvc
12 *
13 * Author: Charles Leggett
14 *
15 * Provides automatic updating and callbacks for time dependent data
16 *
17 *****************************************************************************/
18
20#include "GaudiKernel/StatusCode.h"
21#include "GaudiKernel/ClassID.h"
22#include "GaudiKernel/MsgStream.h"
23#include "SGTools/DataProxy.h"
25#include "IOVEntry.h"
26#include "SGTools/CallBackID.h"
29#include "IOVSvc/IIOVSvcTool.h"
30#include <set>
31#include <map>
32#include <list>
33#include <string>
34#include <mutex>
35
36#include "GaudiKernel/ServiceHandle.h"
37#include "GaudiKernel/ICondSvc.h"
38
39
40
41class StoreGateSvc;
42class IClassIDSvc;
43class IProxyDict;
44class IToolSvc;
45class CallBackID;
46class CBTree;
47
48namespace SG {
49 class TransientAddress;
50 class DataProxy;
51}
52
53class IOVSvc: public extends<AthService, IIOVSvc>
54{
55public:
56
57 IOVSvc( const std::string& name, ISvcLocator* svc );
58 virtual ~IOVSvc();
59
60 virtual StatusCode initialize() override;
61 virtual StatusCode reinitialize() override;
62 virtual StatusCode finalize() override;
63
64 virtual StatusCode createIOVTool( const std::string& storeName ) override;
65 virtual std::vector<std::string> getStoreNames() const override;
66
68 virtual
69 StatusCode regFcn(SG::DataProxy *dp, const CallBackID& c,
70 const IOVSvcCallBackFcn& fcn, bool trigger=false) override;
71
72 virtual
73 StatusCode regFcn(const CallBackID& c1,
74 const CallBackID& c2, const IOVSvcCallBackFcn& fcn2,
75 bool trigger) override;
76
77 virtual
78 StatusCode regFcn(const std::string& toolName,
79 const CallBackID& c2, const IOVSvcCallBackFcn& fcn2,
80 bool trigger) override;
81
83 virtual StatusCode setRange(const CLID& clid, const std::string& key,
84 IOVRange&) override;
85 virtual StatusCode setRange(const CLID& clid, const std::string& key,
86 IOVRange& io,
87 const std::string& storeName) override;
88
89 virtual StatusCode getRange(const CLID& clid, const std::string& key,
90 IOVRange& io) const override;
91
93 virtual StatusCode regProxy( SG::DataProxy *proxy,
94 const std::string& key,
95 const std::string& storeName) override;
96
98 virtual StatusCode replaceProxy( SG::DataProxy *pOld,
99 SG::DataProxy *pNew,
100 const std::string& storeName) override;
101
102
104 virtual StatusCode regProxy( const CLID& clid, const std::string& key,
105 const std::string& storeName ) override;
106
107
108 virtual StatusCode deregProxy( SG::DataProxy *proxy ) override;
109 virtual StatusCode deregProxy( const CLID& clid, const std::string& key ) override;
110
111
112
114 virtual StatusCode getRangeFromDB(const CLID& clid, const std::string& key,
115 IOVRange& range, std::string &tag,
116 std::unique_ptr<IOpaqueAddress>& ioa,
117 const EventIDBase& now) const override;
118
120 virtual StatusCode getRangeFromDB(const CLID& clid, const std::string& key,
121 const IOVTime& time,
122 IOVRange& range, std::string &tag,
123 std::unique_ptr<IOpaqueAddress>& ioa) const override;
124
126 virtual StatusCode setRangeInDB(const CLID& clid, const std::string& key,
127 const IOVRange& range,
128 const std::string &tag) override;
129
131 virtual StatusCode dropObjectFromDB(const CLID& clid, const std::string& key,
132 const std::string& storeName) override;
133
135 virtual StatusCode preLoadTAD( const SG::TransientAddress *,
136 const std::string& storeName ) override;
137
139 virtual StatusCode preLoadDataTAD( const SG::TransientAddress *,
140 const std::string& storeName ) override;
141
144 virtual StatusCode getTriggeredTools(const std::string& key,
145 std::set<std::string>& tools,
146 const std::string& storeName) override;
147
148 virtual void resetAllProxies() override;
149
150 virtual void ignoreProxy(const CLID& clid, const std::string& key,
151 const std::string& storeName) override;
152
153 virtual StatusCode createCondObj(CondContBase*, const DataObjID&,
154 const EventIDBase&) override;
155
156
157private:
158
159 StatusCode createIOVTool(const std::string& storeName, IIOVSvcTool*& tool);
160 IIOVSvcTool* getTool( const std::string& storeName,
161 bool createIF=true );
162 IIOVSvcTool* getTool( const CLID& clid, const std::string& key) const;
163 IIOVSvcTool* getTool( SG::DataProxy* proxy ) const;
164 IIOVSvcTool* getTool( const CallBackID& c1 ) const;
165 IIOVSvcTool* getTool( const IAlgTool* ia ) const;
166 std::string fullProxyName( const SG::DataProxy* proxy ) const;
167 std::string fullProxyName( const CLID& clid, const std::string& key ) const;
168
169
170 typedef std::map< std::string, IIOVSvcTool* > toolMap;
172
173
175 BooleanProperty m_sortKeys, m_forceReset;
176 std::string m_updateInterval;
177
182
183 // Recursive because createCondObj dereferences a DataProxy, which can
184 // eventually recursively call back to IOVSvc.
185 mutable std::recursive_mutex m_lock;
186
187};
188
189#endif
uint32_t CLID
The Class ID type.
defines and typedefs for IOVSvc
boost::function< StatusCode(IOVSVC_CALLBACK_ARGS) > IOVSvcCallBackFcn
the type of an IOVSvc call back: it wraps both the method and the object the method is called on
Definition IOVSvcDefs.h:58
Basic time unit for IOVSvc.
Base class for all conditions containers.
Definition CondCont.h:140
Validity Range object.
Definition IOVRange.h:30
virtual StatusCode preLoadDataTAD(const SG::TransientAddress *, const std::string &storeName) override
supply a list of TADs whose data will be preloaded
Definition IOVSvc.cxx:311
virtual ~IOVSvc()
Definition IOVSvc.cxx:87
virtual std::vector< std::string > getStoreNames() const override
Definition IOVSvc.cxx:801
virtual StatusCode createIOVTool(const std::string &storeName) override
Definition IOVSvc.cxx:658
ServiceHandle< StoreGateSvc > p_detStore
Definition IOVSvc.h:180
virtual StatusCode preLoadTAD(const SG::TransientAddress *, const std::string &storeName) override
supply a list of TADs whose proxies will be preloaded
Definition IOVSvc.cxx:290
std::map< std::string, IIOVSvcTool * > toolMap
Definition IOVSvc.h:170
std::string m_updateInterval
Definition IOVSvc.h:176
virtual StatusCode finalize() override
Definition IOVSvc.cxx:118
IOVSvc(const std::string &name, ISvcLocator *svc)
Definition IOVSvc.cxx:66
toolMap m_toolMap
Definition IOVSvc.h:171
virtual StatusCode getRange(const CLID &clid, const std::string &key, IOVRange &io) const override
Definition IOVSvc.cxx:428
BooleanProperty m_sortKeys
Definition IOVSvc.h:175
BooleanProperty m_preLoadData
Definition IOVSvc.h:174
virtual StatusCode replaceProxy(SG::DataProxy *pOld, SG::DataProxy *pNew, const std::string &storeName) override
replace a registered DataProxy with a new version
Definition IOVSvc.cxx:268
BooleanProperty m_partialPreLoadData
Definition IOVSvc.h:174
ServiceHandle< IClassIDSvc > p_CLIDSvc
Definition IOVSvc.h:179
virtual void resetAllProxies() override
Definition IOVSvc.cxx:817
virtual StatusCode deregProxy(SG::DataProxy *proxy) override
Deregister a DataProxy with the service.
Definition IOVSvc.cxx:205
virtual StatusCode setRange(const CLID &clid, const std::string &key, IOVRange &) override
Update Range from dB.
Definition IOVSvc.cxx:328
std::recursive_mutex m_lock
Definition IOVSvc.h:185
IIOVSvcTool * getTool(const std::string &storeName, bool createIF=true)
Definition IOVSvc.cxx:668
virtual StatusCode regFcn(SG::DataProxy *dp, const CallBackID &c, const IOVSvcCallBackFcn &fcn, bool trigger=false) override
register callback functions
Definition IOVSvc.cxx:514
virtual StatusCode getRangeFromDB(const CLID &clid, const std::string &key, IOVRange &range, std::string &tag, std::unique_ptr< IOpaqueAddress > &ioa, const EventIDBase &now) const override
Get IOVRange from db for current event.
Definition IOVSvc.cxx:446
ServiceHandle< StoreGateSvc > p_sgs
Definition IOVSvc.h:180
virtual StatusCode setRangeInDB(const CLID &clid, const std::string &key, const IOVRange &range, const std::string &tag) override
Set a particular IOVRange in db (and memory)
Definition IOVSvc.cxx:497
virtual StatusCode regProxy(SG::DataProxy *proxy, const std::string &key, const std::string &storeName) override
Subscribe method for DataProxy. key StoreGate key.
Definition IOVSvc.cxx:130
virtual StatusCode getTriggeredTools(const std::string &key, std::set< std::string > &tools, const std::string &storeName) override
return list of tools (or functions) that have been triggered by key will return FAILURE if no tools f...
Definition IOVSvc.cxx:584
virtual StatusCode createCondObj(CondContBase *, const DataObjID &, const EventIDBase &) override
Definition IOVSvc.cxx:832
BooleanProperty m_forceReset
Definition IOVSvc.h:175
ServiceHandle< IToolSvc > p_toolSvc
Definition IOVSvc.h:178
virtual void ignoreProxy(const CLID &clid, const std::string &key, const std::string &storeName) override
ignore proxy
Definition IOVSvc.cxx:247
virtual StatusCode reinitialize() override
Definition IOVSvc.cxx:603
BooleanProperty m_preLoadRanges
Definition IOVSvc.h:174
virtual StatusCode initialize() override
Definition IOVSvc.cxx:93
std::string fullProxyName(const SG::DataProxy *proxy) const
Definition IOVSvc.cxx:767
virtual StatusCode dropObjectFromDB(const CLID &clid, const std::string &key, const std::string &storeName) override
Drop the associated object from the db and trigger reload.
Definition IOVSvc.cxx:389
BooleanProperty m_preLoadExtensibleFolders
Definition IOVSvc.h:174
ServiceHandle< ICondSvc > p_condSvc
Definition IOVSvc.h:181
Basic time unit for IOVSvc.
Definition IOVTime.h:33
The Athena Transient Store API.
Forward declaration.