File indexing completed on 2025-01-31 10:08:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef GAUDIKERNEL_DATASVC_H
0012 #define GAUDIKERNEL_DATASVC_H
0013
0014
0015 #include "GaudiKernel/DataStoreItem.h"
0016 #include "GaudiKernel/IConversionSvc.h"
0017 #include "GaudiKernel/IDataManagerSvc.h"
0018 #include "GaudiKernel/IDataProviderSvc.h"
0019 #include "GaudiKernel/IIncidentSvc.h"
0020 #include "GaudiKernel/RegistryEntry.h"
0021 #include "GaudiKernel/Service.h"
0022 #include "GaudiKernel/SmartIF.h"
0023
0024 #include <string_view>
0025
0026
0027
0028 class IIncidentSvc;
0029
0030 class IOpaqueAddress;
0031
0032 class DataObject;
0033
0034 class IDataStoreAgent;
0035
0036
0037 namespace DataSvcHelpers {
0038
0039 class InhibitMap;
0040 }
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 class GAUDI_API DataSvc : public extends<Service, IDataProviderSvc, IDataManagerSvc> {
0053
0054
0055 SmartIF<IConversionSvc> m_dataLoader = nullptr;
0056
0057 protected:
0058
0059 SmartIF<IIncidentSvc> m_incidentSvc = nullptr;
0060
0061 Gaudi::Property<CLID> m_rootCLID{ this, "RootCLID", 110 , "CLID of root entry" };
0062 Gaudi::Property<std::string> m_rootName{ this, "RootName", "/Event", "name of root entry" };
0063
0064 private:
0065 Gaudi::Property<bool> m_forceLeaves{ this, "ForceLeaves", false,
0066 "force creation of default leaves on registerObject" };
0067 Gaudi::Property<std::vector<std::string>> m_inhibitPathes{ this, "InhibitPathes", {}, "inhibited leaves" };
0068
0069 Gaudi::Property<bool> m_enableFaultHdlr{ this, "EnableFaultHandler", false,
0070 "enable incidents on data creation requests" };
0071 Gaudi::Property<std::string> m_faultName{ this, "DataFaultName", "DataFault", "Name of the data fault incident" };
0072
0073 Gaudi::Property<bool> m_enableAccessHdlr{ this, "EnableAccessHandler", false,
0074 "enable incidents on data access requests" };
0075 Gaudi::Property<std::string> m_accessName{ this, "DataAccessName", "DataAccess", "Name of the data access incident" };
0076
0077
0078 std::vector<DataStoreItem> m_preLoads;
0079
0080 protected:
0081
0082 std::unique_ptr<DataSvcHelpers::RegistryEntry> m_root;
0083
0084 public:
0085
0086 CLID rootCLID() const override;
0087
0088
0089 const std::string& rootName() const override;
0090
0091
0092 StatusCode registerAddress( std::string_view fullPath, IOpaqueAddress* pAddress ) override;
0093
0094 using IDataManagerSvc::registerAddress;
0095
0096
0097 StatusCode registerAddress( IRegistry* parentObj, std::string_view objectPath, IOpaqueAddress* pAddress ) override;
0098
0099 using IDataManagerSvc::unregisterAddress;
0100
0101
0102 StatusCode unregisterAddress( std::string_view fullPath ) override;
0103
0104
0105 StatusCode unregisterAddress( IRegistry* pParent, std::string_view objPath ) override;
0106
0107
0108
0109
0110 StatusCode objectLeaves( const DataObject* pObject, std::vector<IRegistry*>& refLeaves ) override;
0111
0112
0113
0114 StatusCode objectLeaves( const IRegistry* pRegistry, std::vector<IRegistry*>& refLeaves ) override;
0115
0116
0117 StatusCode objectParent( const DataObject* pObject, IRegistry*& refpParent ) override;
0118
0119 StatusCode objectParent( const IRegistry* pRegistry, IRegistry*& refpParent ) override;
0120
0121
0122
0123
0124 StatusCode clearSubTree( std::string_view sub_tree_path ) override;
0125
0126
0127
0128
0129 StatusCode clearSubTree( DataObject* pObject ) override;
0130
0131
0132 StatusCode clearStore() override;
0133
0134
0135
0136
0137 StatusCode traverseSubTree( std::string_view sub_tree_path, IDataStoreAgent* pAgent ) override;
0138
0139
0140 StatusCode traverseSubTree( DataObject* pObject, IDataStoreAgent* pAgent ) override;
0141
0142
0143 StatusCode traverseTree( IDataStoreAgent* pAgent ) override;
0144
0145
0146
0147 StatusCode setRoot( std::string root_name, DataObject* pRootObj ) override;
0148
0149
0150
0151
0152 virtual StatusCode i_setRoot( std::string root_name, DataObject* pRootObj );
0153
0154
0155
0156 StatusCode setRoot( std::string root_path, IOpaqueAddress* pRootAddr ) override;
0157
0158
0159
0160
0161
0162 virtual StatusCode i_setRoot( std::string root_path, IOpaqueAddress* pRootAddr );
0163
0164
0165
0166
0167 StatusCode setDataLoader( IConversionSvc* svc, IDataProviderSvc* dpsvc = nullptr ) override;
0168
0169
0170 StatusCode addPreLoadItem( const DataStoreItem& item ) override;
0171
0172
0173 StatusCode removePreLoadItem( const DataStoreItem& item ) override;
0174
0175
0176 StatusCode resetPreLoad() override;
0177
0178
0179
0180
0181
0182
0183
0184
0185 virtual StatusCode preLoad( int depth, int load_depth, DataObject* pObject );
0186
0187
0188 StatusCode preLoad() override;
0189
0190 using IDataProviderSvc::registerObject;
0191
0192
0193 StatusCode registerObject( std::string_view parentPath, std::string_view objPath, DataObject* pObject ) override;
0194
0195
0196 StatusCode registerObject( DataObject* parentObj, std::string_view objPath, DataObject* pObject ) override;
0197
0198
0199 StatusCode unregisterObject( std::string_view fullPath ) override;
0200
0201
0202 StatusCode unregisterObject( DataObject* pObject ) override;
0203
0204
0205 StatusCode unregisterObject( DataObject* pObject, std::string_view objectPath ) override;
0206
0207 using IDataProviderSvc::retrieveObject;
0208
0209
0210 StatusCode retrieveObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) override;
0211
0212 using IDataProviderSvc::findObject;
0213
0214
0215 StatusCode findObject( std::string_view fullPath, DataObject*& pObject ) override;
0216
0217
0218 StatusCode findObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) override;
0219
0220 using IDataProviderSvc::linkObject;
0221
0222
0223 StatusCode linkObject( IRegistry* from, std::string_view objPath, DataObject* to ) override;
0224
0225
0226 StatusCode linkObject( std::string_view fullPath, DataObject* to ) override;
0227
0228 using IDataProviderSvc::unlinkObject;
0229
0230
0231 StatusCode unlinkObject( IRegistry* from, std::string_view objPath ) override;
0232
0233
0234 StatusCode unlinkObject( DataObject* fromObj, std::string_view objPath ) override;
0235
0236
0237 StatusCode unlinkObject( std::string_view fullPath ) override;
0238
0239
0240 StatusCode updateObject( IRegistry* pDirectory ) override;
0241
0242
0243 StatusCode updateObject( DataObject* toUpdate ) override;
0244
0245
0246 StatusCode initialize() override;
0247
0248
0249 StatusCode reinitialize() override;
0250
0251
0252 StatusCode finalize() override;
0253
0254
0255 using extends::extends;
0256
0257
0258 DataSvc( const DataSvc& ) = delete;
0259
0260 DataSvc& operator=( const DataSvc& ) = delete;
0261
0262 protected:
0263
0264 bool checkRoot() { return 0 != m_root; }
0265
0266
0267
0268
0269 virtual IConversionSvc* getDataLoader( IRegistry* pReg );
0270
0271
0272 virtual DataObject* createDefaultObject() const;
0273
0274
0275
0276
0277 virtual StatusCode loadObject( IRegistry* pNode );
0278
0279
0280
0281
0282 virtual StatusCode loadObject( IConversionSvc* pLoader, IRegistry* pNode );
0283
0284
0285 StatusCode retrieveEntry( DataSvcHelpers::RegistryEntry* pNode, std::string_view path,
0286 DataSvcHelpers::RegistryEntry*& pEntry );
0287
0288
0289
0290
0291
0292
0293 DataObject* handleDataFault( IRegistry* pReg, std::string_view path = "" );
0294
0295 private:
0296 StatusCode i_retrieveEntry( DataSvcHelpers::RegistryEntry* parentObj, std::string_view path,
0297 DataSvcHelpers::RegistryEntry*& pEntry );
0298 DataObject* i_handleDataFault( IRegistry* pReg, std::string_view path = std::string_view{} );
0299 };
0300 #endif