The Gaudi Framework  v36r1 (3e2fb5a8)
DataSvc.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_DATASVC_H
12 #define GAUDIKERNEL_DATASVC_H
13 
14 // Include files
21 #include "GaudiKernel/Service.h"
22 #include "GaudiKernel/SmartIF.h"
23 
24 #include <string_view>
25 
26 // Forward declarations
27 // Incident service
28 class IIncidentSvc;
29 // Generic address
30 class IOpaqueAddress;
31 // Generic interface to data object class
32 class DataObject;
33 // Data store agent
34 class IDataStoreAgent;
35 
36 // Do not clutter global namespace for helpers...
37 namespace DataSvcHelpers {
38  // Map of objects where loading is inhibited
39  class InhibitMap;
40 } // namespace DataSvcHelpers
41 
52 class GAUDI_API DataSvc : public extends<Service, IDataProviderSvc, IDataManagerSvc> {
53 
55  SmartIF<IConversionSvc> m_dataLoader = nullptr;
56 
57 protected:
59  SmartIF<IIncidentSvc> m_incidentSvc = nullptr;
60 
61  Gaudi::Property<CLID> m_rootCLID{this, "RootCLID", 110 /*CLID_Event*/, "CLID of root entry"};
62  Gaudi::Property<std::string> m_rootName{this, "RootName", "/Event", "name of root entry"};
63 
64 private:
65  Gaudi::Property<bool> m_forceLeaves{this, "ForceLeaves", false, "force creation of default leaves on registerObject"};
66  Gaudi::Property<std::vector<std::string>> m_inhibitPathes{this, "InhibitPathes", {}, "inhibited leaves"};
67 
68  Gaudi::Property<bool> m_enableFaultHdlr{this, "EnableFaultHandler", false,
69  "enable incidents on data creation requests"};
70  Gaudi::Property<std::string> m_faultName{this, "DataFaultName", "DataFault", "Name of the data fault incident"};
71 
72  Gaudi::Property<bool> m_enableAccessHdlr{this, "EnableAccessHandler", false,
73  "enable incidents on data access requests"};
74  Gaudi::Property<std::string> m_accessName{this, "DataAccessName", "DataAccess", "Name of the data access incident"};
75 
78 
79 protected:
82 
83 public:
85  CLID rootCLID() const override;
86 
88  const std::string& rootName() const override;
89 
91  StatusCode registerAddress( std::string_view fullPath, IOpaqueAddress* pAddress ) override;
92 
94 
96  StatusCode registerAddress( IRegistry* parentObj, std::string_view objectPath, IOpaqueAddress* pAddress ) override;
97 
99 
101  StatusCode unregisterAddress( std::string_view fullPath ) override;
102 
104  StatusCode unregisterAddress( IRegistry* pParent, std::string_view objPath ) override;
105 
109  StatusCode objectLeaves( const DataObject* pObject, std::vector<IRegistry*>& refLeaves ) override;
113  StatusCode objectLeaves( const IRegistry* pRegistry, std::vector<IRegistry*>& refLeaves ) override;
114 
116  StatusCode objectParent( const DataObject* pObject, IRegistry*& refpParent ) override;
118  StatusCode objectParent( const IRegistry* pRegistry, IRegistry*& refpParent ) override;
119 
123  StatusCode clearSubTree( std::string_view sub_tree_path ) override;
124 
128  StatusCode clearSubTree( DataObject* pObject ) override;
129 
131  StatusCode clearStore() override;
132 
136  StatusCode traverseSubTree( std::string_view sub_tree_path, IDataStoreAgent* pAgent ) override;
137 
139  StatusCode traverseSubTree( DataObject* pObject, IDataStoreAgent* pAgent ) override;
140 
142  StatusCode traverseTree( IDataStoreAgent* pAgent ) override;
143 
146  StatusCode setRoot( std::string root_name, DataObject* pRootObj ) override;
147 
151  virtual StatusCode i_setRoot( std::string root_name, DataObject* pRootObj );
152 
155  StatusCode setRoot( std::string root_path, IOpaqueAddress* pRootAddr ) override;
156 
161  virtual StatusCode i_setRoot( std::string root_path, IOpaqueAddress* 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 
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 
207 
209  StatusCode retrieveObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) override;
210 
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 
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 
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  DataSvc( const DataSvc& ) = delete;
259  DataSvc& operator=( const DataSvc& ) = 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,
292  DataObject* handleDataFault( IRegistry* pReg, std::string_view path = "" );
293 
294 private:
295  StatusCode i_retrieveEntry( DataSvcHelpers::RegistryEntry* parentObj, std::string_view path,
297  DataObject* i_handleDataFault( IRegistry* pReg, std::string_view path = std::string_view{} );
298 };
299 #endif // GAUDIKERNEL_DATASVC_H
std::string
STL class.
DataStoreItem.h
IDataProviderSvc::unlinkObject
virtual StatusCode unlinkObject(IRegistry *from, std::string_view objPath)=0
Remove a link to another object.
DataSvc::DataSvc
DataSvc(const DataSvc &)=delete
copy constructor disabled
IOpaqueAddress
Definition: IOpaqueAddress.h:33
std::vector< DataStoreItem >
IRegistry
Definition: IRegistry.h:32
IDataProviderSvc.h
RegistryEntry.h
IIncidentSvc.h
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.
SmartIF.h
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.
SmartIF< IConversionSvc >
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
DataSvc::m_root
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:81
DataSvc::checkRoot
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:263
DataSvc
Definition: DataSvc.h:52
DataSvcHelpers::RegistryEntry
Definition: RegistryEntry.h:46
DataObject
Definition: DataObject.h:40
DataSvc::operator=
DataSvc & operator=(const DataSvc &)=delete
Fake assignment operator (never implemented).
IDataProviderSvc
Definition: IDataProviderSvc.h:53
IConversionSvc.h
IIncidentSvc
Definition: IIncidentSvc.h:33
std::unique_ptr< DataSvcHelpers::RegistryEntry >
DataSvc::m_preLoads
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:77
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
IConversionSvc
Definition: IConversionSvc.h:47