Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DataSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_DATASVC_H
2 #define GAUDIKERNEL_DATASVC_H
3 
4 // Include files
11 #include "GaudiKernel/Service.h"
12 #include "GaudiKernel/SmartIF.h"
13 
14 #include <boost/utility/string_ref.hpp>
15 
16 // Forward declarations
17 // Incident service
18 class IIncidentSvc;
19 // Generic address
20 class IOpaqueAddress;
21 // Generic interface to data object class
22 class DataObject;
23 // Data store agent
24 class IDataStoreAgent;
25 
26 // Do not clutter global namespace for helpers...
27 namespace DataSvcHelpers {
28  // Map of objects where loading is inhibited
29  class InhibitMap;
30 } // namespace DataSvcHelpers
31 
42 class GAUDI_API DataSvc : public extends<Service, IDataProviderSvc, IDataManagerSvc> {
43 
45  SmartIF<IConversionSvc> m_dataLoader = nullptr;
46 
47 protected:
49  SmartIF<IIncidentSvc> m_incidentSvc = nullptr;
50 
51  Gaudi::Property<CLID> m_rootCLID{this, "RootCLID", 110 /*CLID_Event*/, "CLID of root entry"};
52  Gaudi::Property<std::string> m_rootName{this, "RootName", "/Event", "name of root entry"};
53 
54 private:
55  Gaudi::Property<bool> m_forceLeaves{this, "ForceLeaves", false, "force creation of default leaves on registerObject"};
56  Gaudi::Property<std::vector<std::string>> m_inhibitPathes{this, "InhibitPathes", {}, "inhibited leaves"};
57 
58  Gaudi::Property<bool> m_enableFaultHdlr{this, "EnableFaultHandler", false,
59  "enable incidents on data creation requests"};
60  Gaudi::Property<std::string> m_faultName{this, "DataFaultName", "DataFault", "Name of the data fault incident"};
61 
62  Gaudi::Property<bool> m_enableAccessHdlr{this, "EnableAccessHandler", false,
63  "enable incidents on data access requests"};
64  Gaudi::Property<std::string> m_accessName{this, "DataAccessName", "DataAccess", "Name of the data access incident"};
65 
68 
69 protected:
72 
73 private:
75  DataSvcHelpers::InhibitMap* m_inhibitMap = nullptr;
76 
77 public:
79  CLID rootCLID() const override;
80 
82  const std::string& rootName() const override;
83 
85  StatusCode registerAddress( boost::string_ref fullPath, IOpaqueAddress* pAddress ) override;
86 
88 
90  StatusCode registerAddress( IRegistry* parentObj, boost::string_ref objectPath, IOpaqueAddress* pAddress ) override;
91 
93 
95  StatusCode unregisterAddress( boost::string_ref fullPath ) override;
96 
98  StatusCode unregisterAddress( IRegistry* pParent, boost::string_ref objPath ) override;
99 
103  StatusCode objectLeaves( const DataObject* pObject, std::vector<IRegistry*>& refLeaves ) override;
107  StatusCode objectLeaves( const IRegistry* pRegistry, std::vector<IRegistry*>& refLeaves ) override;
108 
110  StatusCode objectParent( const DataObject* pObject, IRegistry*& refpParent ) override;
112  StatusCode objectParent( const IRegistry* pRegistry, IRegistry*& refpParent ) override;
113 
117  StatusCode clearSubTree( boost::string_ref sub_tree_path ) override;
118 
122  StatusCode clearSubTree( DataObject* pObject ) override;
123 
125  StatusCode clearStore() override;
126 
130  StatusCode traverseSubTree( boost::string_ref sub_tree_path, IDataStoreAgent* pAgent ) override;
131 
133  StatusCode traverseSubTree( DataObject* pObject, IDataStoreAgent* pAgent ) override;
134 
136  StatusCode traverseTree( IDataStoreAgent* pAgent ) override;
137 
140  StatusCode setRoot( std::string root_name, DataObject* pRootObj ) override;
141 
145  virtual StatusCode i_setRoot( std::string root_name, DataObject* pRootObj );
146 
149  StatusCode setRoot( std::string root_path, IOpaqueAddress* pRootAddr ) override;
150 
155  virtual StatusCode i_setRoot( std::string root_path, IOpaqueAddress* pRootAddr );
156 
160  StatusCode setDataLoader( IConversionSvc* svc, IDataProviderSvc* dpsvc = nullptr ) override;
161 
163  StatusCode addPreLoadItem( const DataStoreItem& item ) override;
164 
166  StatusCode removePreLoadItem( const DataStoreItem& item ) override;
167 
169  StatusCode resetPreLoad() override;
170 
178  virtual StatusCode preLoad( int depth, int load_depth, DataObject* pObject );
179 
181  StatusCode preLoad() override;
182 
184 
186  StatusCode registerObject( boost::string_ref parentPath, boost::string_ref objPath, DataObject* pObject ) override;
187 
189  StatusCode registerObject( DataObject* parentObj, boost::string_ref objPath, DataObject* pObject ) override;
190 
192  StatusCode unregisterObject( boost::string_ref fullPath ) override;
193 
195  StatusCode unregisterObject( DataObject* pObject ) override;
196 
198  StatusCode unregisterObject( DataObject* pObject, boost::string_ref objectPath ) override;
199 
201 
203  StatusCode retrieveObject( IRegistry* pDirectory, boost::string_ref path, DataObject*& pObject ) override;
204 
206 
208  StatusCode findObject( boost::string_ref fullPath, DataObject*& pObject ) override;
209 
211  StatusCode findObject( IRegistry* pDirectory, boost::string_ref path, DataObject*& pObject ) override;
212 
214 
216  StatusCode linkObject( IRegistry* from, boost::string_ref objPath, DataObject* to ) override;
217 
219  StatusCode linkObject( boost::string_ref fullPath, DataObject* to ) override;
220 
222 
224  StatusCode unlinkObject( IRegistry* from, boost::string_ref objPath ) override;
225 
227  StatusCode unlinkObject( DataObject* fromObj, boost::string_ref objPath ) override;
228 
230  StatusCode unlinkObject( boost::string_ref fullPath ) override;
231 
233  StatusCode updateObject( IRegistry* pDirectory ) override;
234 
236  StatusCode updateObject( DataObject* toUpdate ) override;
237 
239  StatusCode initialize() override;
240 
242  StatusCode reinitialize() override;
243 
245  StatusCode finalize() override;
246 
248  using extends::extends;
249 
251  DataSvc( const DataSvc& ) = delete;
253  DataSvc& operator=( const DataSvc& ) = delete;
254 
255 protected:
257  bool checkRoot() { return 0 != m_root; }
258 
262  virtual IConversionSvc* getDataLoader( IRegistry* pReg );
263 
265  virtual DataObject* createDefaultObject() const;
266 
270  virtual StatusCode loadObject( IRegistry* pNode );
271 
275  virtual StatusCode loadObject( IConversionSvc* pLoader, IRegistry* pNode );
276 
278  StatusCode retrieveEntry( DataSvcHelpers::RegistryEntry* pNode, boost::string_ref path,
286  DataObject* handleDataFault( IRegistry* pReg, boost::string_ref path = "" );
287 
288 private:
289  StatusCode i_retrieveEntry( DataSvcHelpers::RegistryEntry* parentObj, boost::string_ref path,
291  DataObject* i_handleDataFault( IRegistry* pReg, boost::string_ref path = boost::string_ref{} );
292 };
293 #endif // GAUDIKERNEL_DATASVC_H
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
virtual StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath)=0
Remove a link to another object.
Implementation of property with value of concrete type.
Definition: Property.h:352
virtual StatusCode findObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject)=0
Find object identified by its directory entry.
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:257
Data provider interface definition.
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
PropertyMgr & operator=(const PropertyMgr &)=delete
STL class.
virtual StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *toObj)=0
Add a link to another object.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
virtual StatusCode unregisterAddress(boost::string_ref fullPath)=0
Unregister object address from the data store.
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject)
Register object with the data store.
Generic data agent interface.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
Data service base class.
Definition: DataSvc.h:42
virtual StatusCode registerAddress(boost::string_ref fullPath, IOpaqueAddress *pAddress)=0
Register object address with the data store.
Opaque address interface definition.
#define GAUDI_API
Definition: Kernel.h:71
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:67
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23