| The Gaudi Framework v32r1 (f65d50dc)

DataSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_DATASVC_H
2 #define GAUDIKERNEL_DATASVC_H
3
4 // Include files
5 #include "GaudiKernel/DataStoreItem.h"
6 #include "GaudiKernel/IConversionSvc.h"
7 #include "GaudiKernel/IDataManagerSvc.h"
8 #include "GaudiKernel/IDataProviderSvc.h"
9 #include "GaudiKernel/IIncidentSvc.h"
10 #include "GaudiKernel/RegistryEntry.h"
11 #include "GaudiKernel/Service.h"
12 #include "GaudiKernel/SmartIF.h"
13
14 #include <string_view>
15
16 // Forward declarations
17 // Incident service
18 class IIncidentSvc;
19 // Generic address
20 class IOpaqueAddress;
21 // Generic interface to data object class
22 class DataObject;
23 // Data store agent
24 class IDataStoreAgent;
25
26 // Do not clutter global namespace for helpers...
27 namespace DataSvcHelpers {
28 // Map of objects where loading is inhibited
29 class InhibitMap;
30 } // namespace DataSvcHelpers
31
42 class GAUDI_API DataSvc : public extends<Service, IDataProviderSvc, IDataManagerSvc> {
43
45 SmartIF<IConversionSvc> m_dataLoader = nullptr;
46
47 protected:
49 SmartIF<IIncidentSvc> m_incidentSvc = nullptr;
50
51 Gaudi::Property<CLID> m_rootCLID{this, "RootCLID", 110 /*CLID_Event*/, "CLID of root entry"};
52 Gaudi::Property<std::string> m_rootName{this, "RootName", "/Event", "name of root entry"};
53
54 private:
55 Gaudi::Property<bool> m_forceLeaves{this, "ForceLeaves", false, "force creation of default leaves on registerObject"};
56 Gaudi::Property<std::vector<std::string>> m_inhibitPathes{this, "InhibitPathes", {}, "inhibited leaves"};
57
58 Gaudi::Property<bool> m_enableFaultHdlr{this, "EnableFaultHandler", false,
59 "enable incidents on data creation requests"};
60 Gaudi::Property<std::string> m_faultName{this, "DataFaultName", "DataFault", "Name of the data fault incident"};
61
62 Gaudi::Property<bool> m_enableAccessHdlr{this, "EnableAccessHandler", false,
63 "enable incidents on data access requests"};
64 Gaudi::Property<std::string> m_accessName{this, "DataAccessName", "DataAccess", "Name of the data access incident"};
65
67 std::vector<DataStoreItem> m_preLoads;
68
69 protected:
71 std::unique_ptr<DataSvcHelpers::RegistryEntry> m_root;
72
73 public:
75 CLID rootCLID() const override;
76
78 const std::string& rootName() const override;
79
81 StatusCode registerAddress( std::string_view fullPath, IOpaqueAddress* pAddress ) override;
82
83 using IDataManagerSvc::registerAddress;
84
86 StatusCode registerAddress( IRegistry* parentObj, std::string_view objectPath, IOpaqueAddress* pAddress ) override;
87
88 using IDataManagerSvc::unregisterAddress;
89
91 StatusCode unregisterAddress( std::string_view fullPath ) override;
92
94 StatusCode unregisterAddress( IRegistry* pParent, std::string_view objPath ) override;
95
99 StatusCode objectLeaves( const DataObject* pObject, std::vector<IRegistry*>& refLeaves ) override;
103 StatusCode objectLeaves( const IRegistry* pRegistry, std::vector<IRegistry*>& refLeaves ) override;
104
106 StatusCode objectParent( const DataObject* pObject, IRegistry*& refpParent ) override;
108 StatusCode objectParent( const IRegistry* pRegistry, IRegistry*& refpParent ) override;
109
113 StatusCode clearSubTree( std::string_view sub_tree_path ) override;
114
118 StatusCode clearSubTree( DataObject* pObject ) override;
119
121 StatusCode clearStore() override;
122
126 StatusCode traverseSubTree( std::string_view sub_tree_path, IDataStoreAgent* pAgent ) override;
127
129 StatusCode traverseSubTree( DataObject* pObject, IDataStoreAgent* pAgent ) override;
130
132 StatusCode traverseTree( IDataStoreAgent* pAgent ) override;
133
136 StatusCode setRoot( std::string root_name, DataObject* pRootObj ) override;
137
141 virtual StatusCode i_setRoot( std::string root_name, DataObject* pRootObj );
142
145 StatusCode setRoot( std::string root_path, IOpaqueAddress* pRootAddr ) override;
146
151 virtual StatusCode i_setRoot( std::string root_path, IOpaqueAddress* pRootAddr );
152
156 StatusCode setDataLoader( IConversionSvc* svc, IDataProviderSvc* dpsvc = nullptr ) override;
157
159 StatusCode addPreLoadItem( const DataStoreItem& item ) override;
160
162 StatusCode removePreLoadItem( const DataStoreItem& item ) override;
163
165 StatusCode resetPreLoad() override;
166
174 virtual StatusCode preLoad( int depth, int load_depth, DataObject* pObject );
175
177 StatusCode preLoad() override;
178
179 using IDataProviderSvc::registerObject;
180
182 StatusCode registerObject( std::string_view parentPath, std::string_view objPath, DataObject* pObject ) override;
183
185 StatusCode registerObject( DataObject* parentObj, std::string_view objPath, DataObject* pObject ) override;
186
188 StatusCode unregisterObject( std::string_view fullPath ) override;
189
191 StatusCode unregisterObject( DataObject* pObject ) override;
192
194 StatusCode unregisterObject( DataObject* pObject, std::string_view objectPath ) override;
195
196 using IDataProviderSvc::retrieveObject;
197
199 StatusCode retrieveObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) override;
200
201 using IDataProviderSvc::findObject;
202
204 StatusCode findObject( std::string_view fullPath, DataObject*& pObject ) override;
205
207 StatusCode findObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) override;
208
209 using IDataProviderSvc::linkObject;
210
212 StatusCode linkObject( IRegistry* from, std::string_view objPath, DataObject* to ) override;
213
215 StatusCode linkObject( std::string_view fullPath, DataObject* to ) override;
216
217 using IDataProviderSvc::unlinkObject;
218
220 StatusCode unlinkObject( IRegistry* from, std::string_view objPath ) override;
221
223 StatusCode unlinkObject( DataObject* fromObj, std::string_view objPath ) override;
224
226 StatusCode unlinkObject( std::string_view fullPath ) override;
227
229 StatusCode updateObject( IRegistry* pDirectory ) override;
230
232 StatusCode updateObject( DataObject* toUpdate ) override;
233
235 StatusCode initialize() override;
236
238 StatusCode reinitialize() override;
239
241 StatusCode finalize() override;
242
244 using extends::extends;
245
247 DataSvc( const DataSvc& ) = delete;
249 DataSvc& operator=( const DataSvc& ) = delete;
250
251 protected:
253 bool checkRoot() { return 0 != m_root; }
254
258 virtual IConversionSvc* getDataLoader( IRegistry* pReg );
259
261 virtual DataObject* createDefaultObject() const;
262
266 virtual StatusCode loadObject( IRegistry* pNode );
267
271 virtual StatusCode loadObject( IConversionSvc* pLoader, IRegistry* pNode );
272
274 StatusCode retrieveEntry( DataSvcHelpers::RegistryEntry* pNode, std::string_view path,
275 DataSvcHelpers::RegistryEntry*& pEntry );
282 DataObject* handleDataFault( IRegistry* pReg, std::string_view path = "" );
283
284 private:
285 StatusCode i_retrieveEntry( DataSvcHelpers::RegistryEntry* parentObj, std::string_view path,
286 DataSvcHelpers::RegistryEntry*& pEntry );
287 DataObject* i_handleDataFault( IRegistry* pReg, std::string_view path = std::string_view{} );
288 };
289 #endif // GAUDIKERNEL_DATASVC_H
SmartIF< IConversionSvc >
DataSvc::m_root
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
IDataManagerSvc::registerAddress
virtual StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress)=0
Register object address with the data store.
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:932
IDataProviderSvc::linkObject
virtual StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *toObj)=0
Add a link to another object.
IConversionSvc
Definition: IConversionSvc.h:37
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
IDataManagerSvc::unregisterAddress
virtual StatusCode unregisterAddress(std::string_view fullPath)=0
Unregister object address from the data store.
DataSvc::checkRoot
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:43
DataStoreItem
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
IDataProviderSvc::findObject
virtual StatusCode findObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Find object identified by its directory entry.
IDataProviderSvc::unlinkObject
virtual StatusCode unlinkObject(IRegistry *from, std::string_view objPath)=0
Remove a link to another object.
std::string
STL class.
Service.h
DataStoreItem.h
IDataManagerSvc.h
IDataProviderSvc.h
IIncidentSvc.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
SmartIF.h
IRegistry
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
RegistryEntry.h
DataSvcHelpers::RegistryEntry
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
std::vector< DataStoreItem >
IDataProviderSvc::retrieveObject
virtual StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
std::unique_ptr< DataSvcHelpers::RegistryEntry >
IDataStoreAgent
Generic data agent interface.
Definition: IDataStoreAgent.h:17
IDataProviderSvc::registerObject
StatusCode registerObject(std::string_view fullPath, DataObject *pObject)
Register object with the data store.
Definition: IDataProviderSvc.h:62
IConversionSvc.h
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
DataSvc
Data service base class.
Definition: DataSvc.h:42
DataSvcHelpers
Definition: DataSvc.h:27
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:71
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
DataSvc::m_preLoads
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:67
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23