The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
TsDataSvc.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12
18#include <GaudiKernel/Service.h>
20#include <mutex>
21
22namespace {
23 typedef std::recursive_mutex tsDataSvcMutex;
24} // namespace
25class IOpaqueAddress;
26class DataObject;
27class IDataStoreAgent;
28
29namespace DataSvcHelpers {
30 class InhibitMap;
31 class RegistryEntry;
32} // namespace DataSvcHelpers
33
53class GAUDI_API TsDataSvc : public extends<Service, IDataProviderSvc, IDataManagerSvc> {
54
59
60 Gaudi::Property<CLID> m_rootCLID{ this, "RootCLID", 110 /*CLID_Event*/, "CLID of root entry" };
61 Gaudi::Property<std::string> m_rootName{ this, "RootName", "/Event", "name of root entry" };
62 Gaudi::Property<bool> m_forceLeaves{ this, "ForceLeaves", false,
63 "force creation of default leaves on registerObject" };
64 Gaudi::Property<std::vector<std::string>> m_inhibitPathes{ this, "InhibitPaths", {}, "inhibited leaves" };
65
66 Gaudi::Property<bool> m_enableFaultHdlr{ this, "EnableFaultHandler", false,
67 "enable incidents on data creation requests" };
68 Gaudi::Property<std::string> m_faultName{ this, "DataFaultName", "DataFault", "Name of the data fault incident" };
69
70 Gaudi::Property<bool> m_enableAccessHdlr{ this, "EnableAccessHandler", false,
71 "enable incidents on data access requests" };
72 Gaudi::Property<std::string> m_accessName{ this, "DataAccessName", "DataAccess", "Name of the data access incident" };
73
75 std::vector<DataStoreItem> m_preLoads;
77 std::unique_ptr<DataSvcHelpers::RegistryEntry> m_root;
78
79public:
81 CLID rootCLID() const override;
82
84 const std::string& rootName() const override;
85
87 StatusCode registerAddress( std::string_view fullPath, IOpaqueAddress* pAddress ) override;
88
90
92 StatusCode registerAddress( IRegistry* parentObj, std::string_view objectPath, IOpaqueAddress* pAddress ) override;
93
96 StatusCode unregisterAddress( std::string_view fullPath ) override;
97
99 StatusCode unregisterAddress( IRegistry* pParent, std::string_view objPath ) override;
100
104 StatusCode objectLeaves( const DataObject* pObject, std::vector<IRegistry*>& refLeaves ) override;
108 StatusCode objectLeaves( const IRegistry* pRegistry, std::vector<IRegistry*>& refLeaves ) override;
109
111 StatusCode objectParent( const DataObject* pObject, IRegistry*& refpParent ) override;
113 StatusCode objectParent( const IRegistry* pRegistry, IRegistry*& refpParent ) override;
114
118 StatusCode clearSubTree( std::string_view sub_tree_path ) override;
119
123 StatusCode clearSubTree( DataObject* pObject ) override;
124
126 StatusCode clearStore() override;
127
131 StatusCode traverseSubTree( std::string_view sub_tree_path, IDataStoreAgent* pAgent ) override;
132
134 StatusCode traverseSubTree( DataObject* pObject, IDataStoreAgent* pAgent ) override;
135
137 StatusCode traverseTree( IDataStoreAgent* pAgent ) override;
138
141 StatusCode setRoot( std::string root_name, DataObject* pRootObj ) override;
142
146 virtual StatusCode i_setRoot( std::string root_name, DataObject* pRootObj );
147 StatusCode i_setRoot( DataObject* pRootObj ) { return i_setRoot( m_rootName, pRootObj ); }
148
151 StatusCode setRoot( std::string root_path, IOpaqueAddress* pRootAddr ) override;
152
157 virtual StatusCode i_setRoot( std::string root_path, IOpaqueAddress* pRootAddr );
158 StatusCode i_setRoot( IOpaqueAddress* pRootAddr ) { return i_setRoot( m_rootName, pRootAddr ); }
159
163 StatusCode setDataLoader( IConversionSvc* svc, IDataProviderSvc* dpsvc = nullptr ) override;
164
166 StatusCode addPreLoadItem( const DataStoreItem& item ) override;
167
169 StatusCode removePreLoadItem( const DataStoreItem& item ) override;
170
172 StatusCode resetPreLoad() override;
173
181 virtual StatusCode preLoad( int depth, int load_depth, DataObject* pObject );
182
184 StatusCode preLoad() override;
185
187
189 StatusCode registerObject( std::string_view parentPath, std::string_view objPath, DataObject* pObject ) override;
190
192 StatusCode registerObject( DataObject* parentObj, std::string_view objPath, DataObject* pObject ) override;
193
195 StatusCode unregisterObject( std::string_view fullPath ) override;
196
198 StatusCode unregisterObject( DataObject* pObject ) override;
199
201 StatusCode unregisterObject( DataObject* pObject, std::string_view objectPath ) override;
202
204
206 StatusCode retrieveObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) override;
207
209
211 StatusCode findObject( std::string_view fullPath, DataObject*& pObject ) override;
212
214 StatusCode findObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) override;
215
217
219 StatusCode linkObject( IRegistry* from, std::string_view objPath, DataObject* to ) override;
220
222 StatusCode linkObject( std::string_view fullPath, DataObject* to ) override;
223
225
227 StatusCode unlinkObject( IRegistry* from, std::string_view objPath ) override;
228
230 StatusCode unlinkObject( DataObject* fromObj, std::string_view objPath ) override;
231
233 StatusCode unlinkObject( std::string_view fullPath ) override;
234
236 StatusCode updateObject( IRegistry* pDirectory ) override;
237
239 StatusCode updateObject( DataObject* toUpdate ) override;
240
242 StatusCode initialize() override;
243
245 StatusCode reinitialize() override;
246
248 StatusCode finalize() override;
249
251 TsDataSvc( const std::string& name, ISvcLocator* svc );
252
254 TsDataSvc( const TsDataSvc& ) = delete;
256 TsDataSvc& operator=( const TsDataSvc& ) = delete;
257
258protected:
260 bool checkRoot() { return 0 != m_root; }
261
265 virtual IConversionSvc* getDataLoader( IRegistry* pReg );
266
268 virtual DataObject* createDefaultObject() const;
269
273 virtual StatusCode loadObject( IRegistry* pNode );
274
278 virtual StatusCode loadObject( IConversionSvc* pLoader, IRegistry* pNode );
279
281 StatusCode retrieveEntry( DataSvcHelpers::RegistryEntry* pNode, std::string_view path,
289 DataObject* handleDataFault( IRegistry* pReg, std::string_view path = {} );
290
292 tsDataSvcMutex m_accessMutex;
293};
unsigned int CLID
Class ID definition.
Definition ClassID.h:16
#define GAUDI_API
Definition Kernel.h:49
A DataObject is the base class of any identifiable object on any data store.
Definition DataObject.h:37
Description of the DataStoreItem class.
Definition of an entry in the transient data store.
Implementation of property with value of concrete type.
Definition PropertyFwd.h:27
Data provider interface definition.
virtual StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
virtual StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *toObj)=0
Add a link to another object.
virtual StatusCode unlinkObject(IRegistry *from, std::string_view objPath)=0
Remove a link to another object.
virtual StatusCode findObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Find object identified by its directory entry.
StatusCode registerObject(std::string_view fullPath, DataObject *pObject)
Register object with the data store.
Generic data agent interface.
Opaque address interface definition.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition IRegistry.h:29
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
Handle to be used in lieu of naked pointers to services.
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
Data service base class.
Definition TsDataSvc.h:53
const std::string & rootName() const override
IDataManagerSvc: Accessor for root event name.
StatusCode i_setRoot(DataObject *pRootObj)
Definition TsDataSvc.h:147
StatusCode setRoot(std::string root_name, DataObject *pRootObj) override
Initialize data store for new event by giving new event path and root object.
ServiceHandle< IIncidentSvc > m_incidentSvc
Handle to incident service.
Definition TsDataSvc.h:58
Gaudi::Property< bool > m_forceLeaves
Definition TsDataSvc.h:62
virtual StatusCode i_setRoot(std::string root_name, DataObject *pRootObj)
Initialize data store for new event by giving new event path and root object.
StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
Gaudi::Property< CLID > m_rootCLID
Definition TsDataSvc.h:60
Gaudi::Property< bool > m_enableFaultHdlr
Definition TsDataSvc.h:66
Gaudi::Property< std::string > m_faultName
Definition TsDataSvc.h:68
bool checkRoot()
Check if root path is valid.
Definition TsDataSvc.h:260
TsDataSvc(const TsDataSvc &)=delete
no copy constructor
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition TsDataSvc.h:75
TsDataSvc & operator=(const TsDataSvc &)=delete
no assignment operator
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Gaudi::Property< std::string > m_accessName
Definition TsDataSvc.h:72
Gaudi::Property< std::vector< std::string > > m_inhibitPathes
Definition TsDataSvc.h:64
StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
Gaudi::Property< bool > m_enableAccessHdlr
Definition TsDataSvc.h:70
StatusCode traverseTree(IDataStoreAgent *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects in the data store.
tsDataSvcMutex m_accessMutex
Mutex to protect access to the store.
Definition TsDataSvc.h:292
StatusCode unregisterAddress(std::string_view fullPath) override
IDataManagerSvc: Unregister object address from the data store.
StatusCode clearSubTree(std::string_view sub_tree_path) override
IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name.
Definition TsDataSvc.cpp:63
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition TsDataSvc.cpp:89
CLID rootCLID() const override
IDataManagerSvc: Accessor for root event CLID.
Gaudi::Property< std::string > m_rootName
Definition TsDataSvc.h:61
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition TsDataSvc.h:77
TsDataSvc(const std::string &name, ISvcLocator *svc)
constructor
Definition TsDataSvc.cpp:57
IConversionSvc * m_dataLoader
Pointer to data loader service.
Definition TsDataSvc.h:56
StatusCode i_setRoot(IOpaqueAddress *pRootAddr)
Definition TsDataSvc.h:158
StatusCode traverseSubTree(std::string_view sub_tree_path, IDataStoreAgent *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full pat...
Definition TsDataSvc.cpp:98
Base class used to extend a class implementing other interfaces.
Definition extends.h:19
virtual StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress)=0
Register object address with the data store.
virtual StatusCode unregisterAddress(std::string_view fullPath)=0
Unregister object address from the data store.