The Gaudi Framework  master (37c0b60a)
IDataManagerSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 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_IDATAMANAGERSVC_H
12 #define GAUDIKERNEL_IDATAMANAGERSVC_H
13 
14 // Include files
15 #include <GaudiKernel/ClassID.h>
17 #include <GaudiKernel/IInterface.h>
18 #include <string>
19 #include <string_view>
20 #include <vector>
21 
22 // Forward declarations
23 // Generic interface to data object class
24 #include <GaudiKernel/DataObject.h>
25 // Interface to persistency service
26 class IConversionSvc;
27 // Opaque addresses
28 class IOpaqueAddress;
29 // Registry entry definition
30 class IRegistry;
31 // Data provider svc
32 class IDataProviderSvc;
33 
58 
60  virtual CLID rootCLID() const = 0;
61 
63  virtual const std::string& rootName() const = 0;
64 
71  virtual StatusCode setDataLoader( IConversionSvc* svc, IDataProviderSvc* dpsvc = nullptr ) = 0;
72 
79  virtual StatusCode objectParent( const DataObject* pObject, IRegistry*& refpParent ) = 0;
80 
87  virtual StatusCode objectParent( const IRegistry* pRegistry, IRegistry*& refpParent ) = 0;
88 
97  virtual StatusCode objectLeaves( const DataObject* pObject, std::vector<IRegistry*>& refLeaves ) = 0;
98 
107  virtual StatusCode objectLeaves( const IRegistry* pRegistry, std::vector<IRegistry*>& refLeaves ) = 0;
108 
113  virtual StatusCode clearSubTree( std::string_view sub_path ) = 0;
114 
120  virtual StatusCode clearSubTree( DataObject* pObject ) = 0;
121 
125  virtual StatusCode clearStore() = 0;
126 
131  virtual StatusCode traverseSubTree( std::string_view sub_tree_path, IDataStoreAgent* pAgent ) = 0;
132 
139  template <typename F, typename = std::enable_if_t<!std::is_convertible_v<F, IDataStoreAgent*>>>
140  StatusCode traverseSubTree( std::string_view sub_path, F&& f ) {
141  auto agent = makeDataStoreAgent( std::forward<F>( f ) );
142  return traverseSubTree( sub_path, &agent );
143  }
144 
151  virtual StatusCode traverseSubTree( DataObject* pObject, IDataStoreAgent* pAgent ) = 0;
152 
160  template <typename F, typename = std::enable_if_t<!std::is_convertible_v<F, IDataStoreAgent*>>>
161  StatusCode traverseSubTree( DataObject* pObject, F&& f ) {
162  auto agent = makeDataStoreAgent( std::forward<F>( f ) );
163  return traverseSubTree( pObject, &agent );
164  }
165 
169  virtual StatusCode traverseTree( IDataStoreAgent* pAgent ) = 0;
170 
176  template <typename F, typename = std::enable_if_t<!std::is_convertible_v<F, IDataStoreAgent*>>>
178  auto agent = makeDataStoreAgent( std::forward<F>( f ) );
179  return traverseTree( &agent );
180  }
181 
188  virtual StatusCode setRoot( std::string root_name, DataObject* pObject ) = 0;
189 
196  virtual StatusCode setRoot( std::string root_path, IOpaqueAddress* pRootAddr ) = 0;
197 
205  virtual StatusCode registerAddress( std::string_view fullPath, IOpaqueAddress* pAddress ) = 0;
206 
215  StatusCode registerAddress( DataObject* parentObj, std::string_view objectPath, IOpaqueAddress* pAddress ) {
216  return registerAddress( parentObj ? parentObj->registry() : nullptr, objectPath, pAddress );
217  }
218 
227  virtual StatusCode registerAddress( IRegistry* parentObj, std::string_view objectPath, IOpaqueAddress* pAddress ) = 0;
228 
234  virtual StatusCode unregisterAddress( std::string_view fullPath ) = 0;
235 
243  StatusCode unregisterAddress( DataObject* pParent, std::string_view objPath ) {
244  return unregisterAddress( pParent ? pParent->registry() : nullptr, objPath );
245  }
246 
254  virtual StatusCode unregisterAddress( IRegistry* pParent, std::string_view objPath ) = 0;
255 };
256 
257 #endif // GAUDIKERNEL_IDATAMANAGERSVC_H
IDataManagerSvc::registerAddress
StatusCode registerAddress(DataObject *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress)
Register object address with the data store.
Definition: IDataManagerSvc.h:215
IDataManagerSvc::objectParent
virtual StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent)=0
IDataManagerSvc: Explore the object store: retrieve the object's parent.
IDataManagerSvc::unregisterAddress
virtual StatusCode unregisterAddress(IRegistry *pParent, std::string_view objPath)=0
Unregister object address from the data store.
std::string
STL class.
IDataManagerSvc
Definition: IDataManagerSvc.h:55
IOpaqueAddress
Definition: IOpaqueAddress.h:33
std::vector< IRegistry * >
IDataManagerSvc::unregisterAddress
StatusCode unregisterAddress(DataObject *pParent, std::string_view objPath)
Unregister object address from the data store.
Definition: IDataManagerSvc.h:243
ClassID.h
IDataManagerSvc::setDataLoader
virtual StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr)=0
Pass a default data loader to the service.
IDataManagerSvc::objectLeaves
virtual StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves)=0
Explore the object store: retrieve all leaves attached to the object The object is identified by its ...
IDataManagerSvc::rootCLID
virtual CLID rootCLID() const =0
Get class ID of root Event.
IDataManagerSvc::objectParent
virtual StatusCode objectParent(const IRegistry *pRegistry, IRegistry *&refpParent)=0
IDataManagerSvc: Explore the object store: retrieve the object's parent.
IRegistry
Definition: IRegistry.h:32
extend_interfaces
Base class to be used to extend an interface.
Definition: extend_interfaces.h:15
IDataManagerSvc::clearStore
virtual StatusCode clearStore()=0
Remove all data objects in the data store.
IDataManagerSvc::traverseSubTree
virtual StatusCode traverseSubTree(std::string_view sub_tree_path, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by its full path name.
IDataManagerSvc::registerAddress
virtual StatusCode registerAddress(IRegistry *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress)=0
Register object address with the data store.
IDataManagerSvc::setRoot
virtual StatusCode setRoot(std::string root_path, IOpaqueAddress *pRootAddr)=0
Initialize data store for new event by giving new event path.
StatusCode
Definition: StatusCode.h:65
IInterface.h
IDataManagerSvc::registerAddress
virtual StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress)=0
Register object address with the data store.
IDataManagerSvc::clearSubTree
virtual StatusCode clearSubTree(DataObject *pObject)=0
Remove all data objects below the sub tree identified by the object.
IDataManagerSvc::unregisterAddress
virtual StatusCode unregisterAddress(std::string_view fullPath)=0
Unregister object address from the data store.
IDataManagerSvc::traverseTree
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
IDataManagerSvc::traverseTree
StatusCode traverseTree(F &&f)
Analyse by traversing all data objects in the data store.
Definition: IDataManagerSvc.h:177
IDataManagerSvc::rootName
virtual const std::string & rootName() const =0
Get Name of root Event.
DataObject.h
IDataManagerSvc::traverseSubTree
StatusCode traverseSubTree(DataObject *pObject, F &&f)
Analyse by traversing all data objects below the sub tree identified by the object.
Definition: IDataManagerSvc.h:161
IDataManagerSvc::objectLeaves
virtual StatusCode objectLeaves(const IRegistry *pRegistry, std::vector< IRegistry * > &refLeaves)=0
Explore the object store: retrieve all leaves attached to the object The object is identified by the ...
DataObject
Definition: DataObject.h:36
IDataManagerSvc::clearSubTree
virtual StatusCode clearSubTree(std::string_view sub_path)=0
Remove all data objects below the sub tree identified by its full path name.
IDataProviderSvc
Definition: IDataProviderSvc.h:53
makeDataStoreAgent
::details::GenericDataStoreAgent< F > makeDataStoreAgent(F &&f)
Definition: IDataStoreAgent.h:52
IDataManagerSvc::traverseSubTree
StatusCode traverseSubTree(std::string_view sub_path, F &&f)
Analyse by traversing all data objects below the sub tree identified by its full path name.
Definition: IDataManagerSvc.h:140
IDataStoreAgent.h
DataObject::registry
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:78
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
IDataManagerSvc::setRoot
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
IDataManagerSvc::traverseSubTree
virtual StatusCode traverseSubTree(DataObject *pObject, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by the object.
IDataStoreAgent
Definition: IDataStoreAgent.h:27
IDataManagerSvc::DeclareInterfaceID
DeclareInterfaceID(IDataManagerSvc, 4, 0)
InterfaceID.
IConversionSvc
Definition: IConversionSvc.h:47