| The Gaudi Framework v32r1 (f65d50dc)

TsDataSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_TSDATASVC_H
2 #define GAUDIKERNEL_TSDATASVC_H
3
4 // Include files
5 #include "GaudiKernel/DataStoreItem.h"
6 #include "GaudiKernel/IDataManagerSvc.h"
7 #include "GaudiKernel/IDataProviderSvc.h"
8 #include "GaudiKernel/RegistryEntry.h"
9 #include "GaudiKernel/Service.h"
10
11 // External libraries
12 #include "tbb/recursive_mutex.h"
13 #include "tbb/spin_mutex.h"
14
15 namespace {
16 typedef tbb::recursive_mutex tsDataSvcMutex;
17 // typedef tbb::spin_mutex tsDataSvcMutex;
18 } // namespace
19
20 // Forward declarations
21 // Incident service
22 class IIncidentSvc;
23 // Generic address
24 class IOpaqueAddress;
25 // Generic interface to data object class
26 class DataObject;
27 // Data store agent
28 class IDataStoreAgent;
29
30 // Do not clutter global namespace for helpers...
31 namespace DataSvcHelpers {
32 // Map of objects where loading is inhibited
33 class InhibitMap;
34 // Generic registry entry
35 class RegistryEntry;
36 } // namespace DataSvcHelpers
37
57 class GAUDI_API TsDataSvc : public extends<Service, IDataProviderSvc, IDataManagerSvc> {
58
60 IConversionSvc* m_dataLoader = nullptr;
62 IIncidentSvc* m_incidentSvc = nullptr;
63
64 Gaudi::Property<CLID> m_rootCLID{this, "RootCLID", 110 /*CLID_Event*/, "CLID of root entry"};
65 Gaudi::Property<std::string> m_rootName{this, "RootName", "/Event", "name of root entry"};
66 Gaudi::Property<bool> m_forceLeaves{this, "ForceLeaves", false, "force creation of default leaves on registerObject"};
67 Gaudi::Property<std::vector<std::string>> m_inhibitPathes{this, "InhibitPathes", {}, "inhibited leaves"};
68
69 Gaudi::Property<bool> m_enableFaultHdlr{this, "EnableFaultHandler", false,
70 "enable incidents on data creation requests"};
71 Gaudi::Property<std::string> m_faultName{this, "DataFaultName", "DataFault", "Name of the data fault incident"};
72
73 Gaudi::Property<bool> m_enableAccessHdlr{this, "EnableAccessHandler", false,
74 "enable incidents on data access requests"};
75 Gaudi::Property<std::string> m_accessName{this, "DataAccessName", "DataAccess", "Name of the data access incident"};
76
78 std::vector<DataStoreItem> m_preLoads;
80 std::unique_ptr<DataSvcHelpers::RegistryEntry> m_root;
81
82 public:
84 CLID rootCLID() const override;
85
87 const std::string& rootName() const override;
88
90 StatusCode registerAddress( std::string_view fullPath, IOpaqueAddress* pAddress ) override;
91
92 using IDataManagerSvc::registerAddress;
93
95 StatusCode registerAddress( IRegistry* parentObj, std::string_view objectPath, IOpaqueAddress* pAddress ) override;
96
97 using IDataManagerSvc::unregisterAddress;
99 StatusCode unregisterAddress( std::string_view fullPath ) override;
100
102 StatusCode unregisterAddress( IRegistry* pParent, std::string_view objPath ) override;
103
107 StatusCode objectLeaves( const DataObject* pObject, std::vector<IRegistry*>& refLeaves ) override;
111 StatusCode objectLeaves( const IRegistry* pRegistry, std::vector<IRegistry*>& refLeaves ) override;
112
114 StatusCode objectParent( const DataObject* pObject, IRegistry*& refpParent ) override;
116 StatusCode objectParent( const IRegistry* pRegistry, IRegistry*& refpParent ) override;
117
121 StatusCode clearSubTree( std::string_view sub_tree_path ) override;
122
126 StatusCode clearSubTree( DataObject* pObject ) override;
127
129 StatusCode clearStore() override;
130
134 StatusCode traverseSubTree( std::string_view sub_tree_path, IDataStoreAgent* pAgent ) override;
135
137 StatusCode traverseSubTree( DataObject* pObject, IDataStoreAgent* pAgent ) override;
138
140 StatusCode traverseTree( IDataStoreAgent* pAgent ) override;
141
144 StatusCode setRoot( std::string root_name, DataObject* pRootObj ) override;
145
149 virtual StatusCode i_setRoot( std::string root_name, DataObject* pRootObj );
150 StatusCode i_setRoot( DataObject* pRootObj ) { return i_setRoot( m_rootName, pRootObj ); }
151
154 StatusCode setRoot( std::string root_path, IOpaqueAddress* pRootAddr ) override;
155
160 virtual StatusCode i_setRoot( std::string root_path, IOpaqueAddress* pRootAddr );
161 StatusCode i_setRoot( IOpaqueAddress* pRootAddr ) { return i_setRoot( m_rootName, pRootAddr ); }
162
166 StatusCode setDataLoader( IConversionSvc* svc, IDataProviderSvc* dpsvc = nullptr ) override;
167
169 StatusCode addPreLoadItem( const DataStoreItem& item ) override;
170
172 StatusCode removePreLoadItem( const DataStoreItem& item ) override;
173
175 StatusCode resetPreLoad() override;
176
184 virtual StatusCode preLoad( int depth, int load_depth, DataObject* pObject );
185
187 StatusCode preLoad() override;
188
189 using IDataProviderSvc::registerObject;
190
192 StatusCode registerObject( std::string_view parentPath, std::string_view objPath, DataObject* pObject ) override;
193
195 StatusCode registerObject( DataObject* parentObj, std::string_view objPath, DataObject* pObject ) override;
196
198 StatusCode unregisterObject( std::string_view fullPath ) override;
199
201 StatusCode unregisterObject( DataObject* pObject ) override;
202
204 StatusCode unregisterObject( DataObject* pObject, std::string_view objectPath ) override;
205
206 using IDataProviderSvc::retrieveObject;
207
209 StatusCode retrieveObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) override;
210
211 using IDataProviderSvc::findObject;
212
214 StatusCode findObject( std::string_view fullPath, DataObject*& pObject ) override;
215
217 StatusCode findObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) override;
218
219 using IDataProviderSvc::linkObject;
220
222 StatusCode linkObject( IRegistry* from, std::string_view objPath, DataObject* to ) override;
223
225 StatusCode linkObject( std::string_view fullPath, DataObject* to ) override;
226
227 using IDataProviderSvc::unlinkObject;
228
230 StatusCode unlinkObject( IRegistry* from, std::string_view objPath ) override;
231
233 StatusCode unlinkObject( DataObject* fromObj, std::string_view objPath ) override;
234
236 StatusCode unlinkObject( std::string_view fullPath ) override;
237
239 StatusCode updateObject( IRegistry* pDirectory ) override;
240
242 StatusCode updateObject( DataObject* toUpdate ) override;
243
245 StatusCode initialize() override;
246
248 StatusCode reinitialize() override;
249
251 StatusCode finalize() override;
252
254 using extends::extends;
255
257 TsDataSvc( const TsDataSvc& ) = delete;
259 TsDataSvc& operator=( const TsDataSvc& ) = delete;
260
261 protected:
263 bool checkRoot() { return 0 != m_root; }
264
268 virtual IConversionSvc* getDataLoader( IRegistry* pReg );
269
271 virtual DataObject* createDefaultObject() const;
272
276 virtual StatusCode loadObject( IRegistry* pNode );
277
281 virtual StatusCode loadObject( IConversionSvc* pLoader, IRegistry* pNode );
282
284 StatusCode retrieveEntry( DataSvcHelpers::RegistryEntry* pNode, std::string_view path,
285 DataSvcHelpers::RegistryEntry*& pEntry );
292 DataObject* handleDataFault( IRegistry* pReg, std::string_view path = {} );
293
295 tsDataSvcMutex m_accessMutex;
296 };
297 #endif // GAUDIKERNEL_TSDATASVC_H
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
TsDataSvc::m_accessMutex
tsDataSvcMutex m_accessMutex
Mutex to protect access to the store.
Definition: TsDataSvc.h:295
IDataManagerSvc::unregisterAddress
virtual StatusCode unregisterAddress(std::string_view fullPath)=0
Unregister object address from the data store.
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
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
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
TsDataSvc::m_root
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:80
TsDataSvc::i_setRoot
StatusCode i_setRoot(IOpaqueAddress *pRootAddr)
Definition: TsDataSvc.h:161
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
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
TsDataSvc::m_preLoads
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:78
TsDataSvc
Data service base class.
Definition: TsDataSvc.h:57
TsDataSvc::checkRoot
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:263
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
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23
TsDataSvc::i_setRoot
StatusCode i_setRoot(DataObject *pRootObj)
Definition: TsDataSvc.h:150