Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (01b473db)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
22 namespace {
23  typedef std::recursive_mutex tsDataSvcMutex;
24 } // namespace
25 class IOpaqueAddress;
26 class DataObject;
27 class IDataStoreAgent;
28 
29 namespace DataSvcHelpers {
30  class InhibitMap;
31  class RegistryEntry;
32 } // namespace DataSvcHelpers
33 
53 class GAUDI_API TsDataSvc : public extends<Service, IDataProviderSvc, IDataManagerSvc> {
54 
56  IConversionSvc* m_dataLoader = nullptr;
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 
79 public:
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 
258 protected:
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 };
TsDataSvc::m_preLoads
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:75
TsDataSvc::m_root
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:77
TsDataSvc::m_accessMutex
tsDataSvcMutex m_accessMutex
Mutex to protect access to the store.
Definition: TsDataSvc.h:292
DataStoreItem.h
IDataProviderSvc::unlinkObject
virtual StatusCode unlinkObject(IRegistry *from, std::string_view objPath)=0
Remove a link to another object.
AtlasMCRecoFullPrecedenceDump.path
path
Definition: AtlasMCRecoFullPrecedenceDump.py:49
TsDataSvc::operator=
TsDataSvc & operator=(const TsDataSvc &)=delete
no assignment operator
ServiceHandle< IIncidentSvc >
IOpaqueAddress
Definition: IOpaqueAddress.h:28
ISvcLocator
Definition: ISvcLocator.h:42
TsDataSvc::checkRoot
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:260
IRegistry
Definition: IRegistry.h:29
TsDataSvc::TsDataSvc
TsDataSvc(const TsDataSvc &)=delete
no copy constructor
ServiceHandle.h
TsDataSvc::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Handle to incident service.
Definition: TsDataSvc.h:58
IDataProviderSvc.h
RegistryEntry.h
TsDataSvc::i_setRoot
StatusCode i_setRoot(IOpaqueAddress *pRootAddr)
Definition: TsDataSvc.h:158
IIncidentSvc.h
IDataProviderSvc::registerObject
StatusCode registerObject(std::string_view fullPath, DataObject *pObject)
Register object with the data store.
Definition: IDataProviderSvc.h:67
IDataProviderSvc::linkObject
virtual StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *toObj)=0
Add a link to another object.
StatusCode
Definition: StatusCode.h:64
IDataManagerSvc::registerAddress
virtual StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress)=0
Register object address with the data store.
DataStoreItem
Definition: DataStoreItem.h:25
IDataProviderSvc::retrieveObject
virtual StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
IDataManagerSvc::unregisterAddress
virtual StatusCode unregisterAddress(std::string_view fullPath)=0
Unregister object address from the data store.
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:16
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:19
Service.h
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
DataSvcHelpers::RegistryEntry
Definition: RegistryEntry.h:41
DataObject
Definition: DataObject.h:37
IDataProviderSvc
Definition: IDataProviderSvc.h:48
TsDataSvc
Definition: TsDataSvc.h:53
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:49
Gaudi::Property< CLID >
IDataManagerSvc.h
DataSvcHelpers
Definition: DataSvc.h:28
IDataProviderSvc::findObject
virtual StatusCode findObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Find object identified by its directory entry.
IDataStoreAgent
Definition: IDataStoreAgent.h:24
TsDataSvc::i_setRoot
StatusCode i_setRoot(DataObject *pRootObj)
Definition: TsDataSvc.h:147
IConversionSvc
Definition: IConversionSvc.h:43