The Gaudi Framework  v36r1 (3e2fb5a8)
TsDataSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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 #ifndef GAUDIKERNEL_TSDATASVC_H
12 #define GAUDIKERNEL_TSDATASVC_H
13 
14 // Include files
19 #include "GaudiKernel/Service.h"
20 
21 // System libraries
22 #include <mutex>
23 
24 namespace {
25  typedef std::recursive_mutex tsDataSvcMutex;
26 } // namespace
27 
28 // Forward declarations
29 // Incident service
30 class IIncidentSvc;
31 // Generic address
32 class IOpaqueAddress;
33 // Generic interface to data object class
34 class DataObject;
35 // Data store agent
36 class IDataStoreAgent;
37 
38 // Do not clutter global namespace for helpers...
39 namespace DataSvcHelpers {
40  // Map of objects where loading is inhibited
41  class InhibitMap;
42  // Generic registry entry
43  class RegistryEntry;
44 } // namespace DataSvcHelpers
45 
65 class GAUDI_API TsDataSvc : public extends<Service, IDataProviderSvc, IDataManagerSvc> {
66 
68  IConversionSvc* m_dataLoader = nullptr;
70  IIncidentSvc* m_incidentSvc = nullptr;
71 
72  Gaudi::Property<CLID> m_rootCLID{this, "RootCLID", 110 /*CLID_Event*/, "CLID of root entry"};
73  Gaudi::Property<std::string> m_rootName{this, "RootName", "/Event", "name of root entry"};
74  Gaudi::Property<bool> m_forceLeaves{this, "ForceLeaves", false, "force creation of default leaves on registerObject"};
75  Gaudi::Property<std::vector<std::string>> m_inhibitPathes{this, "InhibitPathes", {}, "inhibited leaves"};
76 
77  Gaudi::Property<bool> m_enableFaultHdlr{this, "EnableFaultHandler", false,
78  "enable incidents on data creation requests"};
79  Gaudi::Property<std::string> m_faultName{this, "DataFaultName", "DataFault", "Name of the data fault incident"};
80 
81  Gaudi::Property<bool> m_enableAccessHdlr{this, "EnableAccessHandler", false,
82  "enable incidents on data access requests"};
83  Gaudi::Property<std::string> m_accessName{this, "DataAccessName", "DataAccess", "Name of the data access incident"};
84 
89 
90 public:
92  CLID rootCLID() const override;
93 
95  const std::string& rootName() const override;
96 
98  StatusCode registerAddress( std::string_view fullPath, IOpaqueAddress* pAddress ) override;
99 
101 
103  StatusCode registerAddress( IRegistry* parentObj, std::string_view objectPath, IOpaqueAddress* pAddress ) override;
104 
107  StatusCode unregisterAddress( std::string_view fullPath ) override;
108 
110  StatusCode unregisterAddress( IRegistry* pParent, std::string_view objPath ) override;
111 
115  StatusCode objectLeaves( const DataObject* pObject, std::vector<IRegistry*>& refLeaves ) override;
119  StatusCode objectLeaves( const IRegistry* pRegistry, std::vector<IRegistry*>& refLeaves ) override;
120 
122  StatusCode objectParent( const DataObject* pObject, IRegistry*& refpParent ) override;
124  StatusCode objectParent( const IRegistry* pRegistry, IRegistry*& refpParent ) override;
125 
129  StatusCode clearSubTree( std::string_view sub_tree_path ) override;
130 
134  StatusCode clearSubTree( DataObject* pObject ) override;
135 
137  StatusCode clearStore() override;
138 
142  StatusCode traverseSubTree( std::string_view sub_tree_path, IDataStoreAgent* pAgent ) override;
143 
145  StatusCode traverseSubTree( DataObject* pObject, IDataStoreAgent* pAgent ) override;
146 
148  StatusCode traverseTree( IDataStoreAgent* pAgent ) override;
149 
152  StatusCode setRoot( std::string root_name, DataObject* pRootObj ) override;
153 
157  virtual StatusCode i_setRoot( std::string root_name, DataObject* pRootObj );
158  StatusCode i_setRoot( DataObject* pRootObj ) { return i_setRoot( m_rootName, pRootObj ); }
159 
162  StatusCode setRoot( std::string root_path, IOpaqueAddress* pRootAddr ) override;
163 
168  virtual StatusCode i_setRoot( std::string root_path, IOpaqueAddress* pRootAddr );
169  StatusCode i_setRoot( IOpaqueAddress* pRootAddr ) { return i_setRoot( m_rootName, pRootAddr ); }
170 
174  StatusCode setDataLoader( IConversionSvc* svc, IDataProviderSvc* dpsvc = nullptr ) override;
175 
177  StatusCode addPreLoadItem( const DataStoreItem& item ) override;
178 
180  StatusCode removePreLoadItem( const DataStoreItem& item ) override;
181 
183  StatusCode resetPreLoad() override;
184 
192  virtual StatusCode preLoad( int depth, int load_depth, DataObject* pObject );
193 
195  StatusCode preLoad() override;
196 
198 
200  StatusCode registerObject( std::string_view parentPath, std::string_view objPath, DataObject* pObject ) override;
201 
203  StatusCode registerObject( DataObject* parentObj, std::string_view objPath, DataObject* pObject ) override;
204 
206  StatusCode unregisterObject( std::string_view fullPath ) override;
207 
209  StatusCode unregisterObject( DataObject* pObject ) override;
210 
212  StatusCode unregisterObject( DataObject* pObject, std::string_view objectPath ) override;
213 
215 
217  StatusCode retrieveObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) override;
218 
220 
222  StatusCode findObject( std::string_view fullPath, DataObject*& pObject ) override;
223 
225  StatusCode findObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) override;
226 
228 
230  StatusCode linkObject( IRegistry* from, std::string_view objPath, DataObject* to ) override;
231 
233  StatusCode linkObject( std::string_view fullPath, DataObject* to ) override;
234 
236 
238  StatusCode unlinkObject( IRegistry* from, std::string_view objPath ) override;
239 
241  StatusCode unlinkObject( DataObject* fromObj, std::string_view objPath ) override;
242 
244  StatusCode unlinkObject( std::string_view fullPath ) override;
245 
247  StatusCode updateObject( IRegistry* pDirectory ) override;
248 
250  StatusCode updateObject( DataObject* toUpdate ) override;
251 
253  StatusCode initialize() override;
254 
256  StatusCode reinitialize() override;
257 
259  StatusCode finalize() override;
260 
262  using extends::extends;
263 
265  TsDataSvc( const TsDataSvc& ) = delete;
267  TsDataSvc& operator=( const TsDataSvc& ) = delete;
268 
269 protected:
271  bool checkRoot() { return 0 != m_root; }
272 
276  virtual IConversionSvc* getDataLoader( IRegistry* pReg );
277 
279  virtual DataObject* createDefaultObject() const;
280 
284  virtual StatusCode loadObject( IRegistry* pNode );
285 
289  virtual StatusCode loadObject( IConversionSvc* pLoader, IRegistry* pNode );
290 
292  StatusCode retrieveEntry( DataSvcHelpers::RegistryEntry* pNode, std::string_view path,
300  DataObject* handleDataFault( IRegistry* pReg, std::string_view path = {} );
301 
303  tsDataSvcMutex m_accessMutex;
304 };
305 #endif // GAUDIKERNEL_TSDATASVC_H
TsDataSvc::m_preLoads
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:86
TsDataSvc::m_root
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:88
TsDataSvc::m_accessMutex
tsDataSvcMutex m_accessMutex
Mutex to protect access to the store.
Definition: TsDataSvc.h:303
std::string
STL class.
DataStoreItem.h
IDataProviderSvc::unlinkObject
virtual StatusCode unlinkObject(IRegistry *from, std::string_view objPath)=0
Remove a link to another object.
TsDataSvc::operator=
TsDataSvc & operator=(const TsDataSvc &)=delete
no assignment operator
IOpaqueAddress
Definition: IOpaqueAddress.h:33
std::vector< DataStoreItem >
TsDataSvc::checkRoot
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:271
std::recursive_mutex
STL class.
IRegistry
Definition: IRegistry.h:32
TsDataSvc::TsDataSvc
TsDataSvc(const TsDataSvc &)=delete
no copy constructor
IDataProviderSvc.h
RegistryEntry.h
TsDataSvc::i_setRoot
StatusCode i_setRoot(IOpaqueAddress *pRootAddr)
Definition: TsDataSvc.h:169
IDataProviderSvc::registerObject
StatusCode registerObject(std::string_view fullPath, DataObject *pObject)
Register object with the data store.
Definition: IDataProviderSvc.h:72
IDataProviderSvc::linkObject
virtual StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *toObj)=0
Add a link to another object.
StatusCode
Definition: StatusCode.h:65
IDataManagerSvc::registerAddress
virtual StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress)=0
Register object address with the data store.
DataStoreItem
Definition: DataStoreItem.h:27
IDataProviderSvc::retrieveObject
virtual StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:943
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:18
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
Service.h
DataSvcHelpers::RegistryEntry
Definition: RegistryEntry.h:46
DataObject
Definition: DataObject.h:40
IDataProviderSvc
Definition: IDataProviderSvc.h:53
TsDataSvc
Definition: TsDataSvc.h:65
IIncidentSvc
Definition: IIncidentSvc.h:33
std::unique_ptr< DataSvcHelpers::RegistryEntry >
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
Gaudi::Property< CLID >
IDataManagerSvc.h
DataSvcHelpers
Definition: DataSvc.h:37
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:27
TsDataSvc::i_setRoot
StatusCode i_setRoot(DataObject *pRootObj)
Definition: TsDataSvc.h:158
IConversionSvc
Definition: IConversionSvc.h:47