The Gaudi Framework  v33r0 (d5ea422b)
IDataManagerSvc.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_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
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:82
StatusCode traverseTree(F &&f)
Analyse by traversing all data objects in the data store.
StatusCode traverseSubTree(DataObject *pObject, F &&f)
Analyse by traversing all data objects below the sub tree identified by the object.
Data provider interface definition.
STL class.
StatusCode unregisterAddress(DataObject *pParent, std::string_view objPath)
Unregister object address from the data store.
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.
StatusCode registerAddress(DataObject *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress)
Register object address with the data store.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
Base class to be used to extend an interface.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:32
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
#define DeclareInterfaceID(iface, major, minor)
Macro to declare the interface ID when using the new mechanism of extending and implementing interfac...
Definition: IInterface.h:23
Generic data agent interface.
Opaque address interface definition.
#define GAUDI_API
Definition: Kernel.h:81
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:40
::details::GenericDataStoreAgent< F > makeDataStoreAgent(F &&f)