Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:15:10

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #ifndef GAUDIKERNEL_IDATAPROVIDERSVC_H
0012 #define GAUDIKERNEL_IDATAPROVIDERSVC_H
0013 
0014 // Framework include files
0015 #include <GaudiKernel/IInterface.h>
0016 
0017 // C/C++ include files
0018 #include <string>
0019 #include <string_view>
0020 
0021 // Forward declarations
0022 class IOpaqueAddress;
0023 class IRegistry;
0024 #include <GaudiKernel/DataObject.h>
0025 #include <GaudiKernel/DataStoreItem.h>
0026 
0027 /** @class IDataProviderSvc IDataProviderSvc.h GaudiKernel/IDataProviderSvc.h
0028  *
0029  *  Data provider interface definition.
0030  *  The data provider interface allows to:
0031  *  <UL>
0032  *  <LI> Define lists of items to be loaded automatically when a new root node
0033  *       is assigned to the data store.
0034  *  <LI> Register objects from the data store. Once objects are registered
0035  *       with the data store the client gives up ownership.
0036  *  <LI> Unregister objects from the data store. Unregistering an object
0037  *       means to actually delete all entries hanging below, not the object
0038  *       itself - since the client claims back ownership. Note that this is a
0039  *       very delicate operation - any reference to the object will be invalid.
0040  *       Even worse: invalid references cannot be detected.
0041  *  <LI> Retrieve objects to the data store. Depending on the
0042  *       availibility of the requested object in the data store the
0043  *       represented object will be loaded if possible.
0044  *  <LI> Find objects beeing present in the store without actually creating
0045  *       the representation if the object is not present.
0046  *  <LI> Create 'soft' links between objects in the transient store.
0047  *  <LI> Request object updates.
0048  *  </UL>
0049  *
0050  *  @author Markus Frank
0051  *  @author Sebastien Ponce
0052  */
0053 class GAUDI_API IDataProviderSvc : virtual public IInterface {
0054 
0055   /// Helper function to convert item numbers to path strings
0056   //  /// i.e. int -> "/" + int
0057   static inline std::string itemToPath( int item ) { return '/' + std::to_string( item ); }
0058 
0059 public:
0060   /// InterfaceID
0061   DeclareInterfaceID( IDataProviderSvc, 4, 0 );
0062 
0063   enum { SEPARATOR = '/' };
0064 
0065   /** Register object with the data store.
0066    *  Connect the object identified by its pointer to the node object
0067    *  identified by its path.
0068    *  @param      fullPath    Path to parent node of the object.
0069    *  @param      pObject     Pointer to the object to be registered.
0070    *  @return                 Status code indicating success or failure.
0071    */
0072   StatusCode registerObject( std::string_view fullPath, DataObject* pObject ) {
0073     return registerObject( nullptr, fullPath, pObject );
0074   }
0075 
0076   /** Register object with the data store.
0077    *  Connect the object identified by the path to the parent object
0078    *  and the path of the object itself relative to the specified parent.
0079    *  @param      parentPath  Path to parent node of the object.
0080    *  @param      objectPath  Path of the object relative to the parent node
0081    *  @param      pObject     Pointer to the object to be registered.
0082    *  @return                 Status code indicating success or failure.
0083    */
0084   virtual StatusCode registerObject( std::string_view parentPath, std::string_view objectPath,
0085                                      DataObject* pObject ) = 0;
0086 
0087   /** Register object with the data store.
0088    *  Connect the object identified by its pointer to the parent object
0089    *  and an integer identifier.
0090    *  @param      parentPath  Path to parent node of the object.
0091    *  @param      item        item number of the object linked to the parent
0092    *  @param      pObject     Pointer to the object to be registered.
0093    *  @return                 Status code indicating success or failure.
0094    */
0095   StatusCode registerObject( std::string_view parentPath, int item, DataObject* pObject ) {
0096     return registerObject( parentPath, itemToPath( item ), pObject );
0097   }
0098 
0099   /** Register object with the data store.
0100    *  Connect the object identified by its pointer to the parent object
0101    *  and the relative path of the object with respect to the parent.
0102    *  @param      parentObj   Pointer to parent object.
0103    *  @param      objectPath  Path of the object relative to the parent node
0104    *  @param      pObject     Pointer to the object to be connected.
0105    *  @return                 Status code indicating success or failure.
0106    */
0107   virtual StatusCode registerObject( DataObject* parentObj, std::string_view objectPath, DataObject* pObject ) = 0;
0108 
0109   /** Register object with the data store.
0110    *  Connect the object identified by its pointer to the node object
0111    *  identified by its pointer.
0112    *  @param      parentObj   Pointer to parent object.
0113    *  @param      item        item number of the object linked to the parent
0114    *  @param      pObject     Pointer to the object to be connected.
0115    *  @return                 Status code indicating success or failure.
0116    */
0117   StatusCode registerObject( DataObject* parentObj, int item, DataObject* pObject ) {
0118     return registerObject( parentObj, itemToPath( item ), pObject );
0119   }
0120 
0121   /** Unregister object from the data store.
0122    *  On registration the client gives up ownership of the object and may no
0123    *  longer delete the object. unregistering the object is the opposite:
0124    *  ownership is claimed back by the user. But note:
0125    *  - All depending objects will be deleted, ie. all leaves "below" the
0126    *    entry in question; NOT the object itself, the object itself must be
0127    *    destroyed by the user.
0128    *
0129    *  The object is identified by full path name.
0130    *
0131    *  @param      fullPath    Path name of the object.
0132    *  @return                 Status code indicating success or failure.
0133    */
0134   virtual StatusCode unregisterObject( std::string_view fullPath ) = 0;
0135 
0136   /** Unregister object from the data store.
0137    *  On registration the client gives up ownership of the object and may no
0138    *  longer delete the object. unregistering the object is the opposite:
0139    *  ownership is claimed back by the user. But note:
0140    *  - All depending objects will be deleted, ie. all leaves "below" the
0141    *    entry in question; NOT the object itself, the object itself must be
0142    *    destroyed by the user.
0143    *
0144    *  The object is identified by parent path name and the path of the
0145    *  object relative to the parent.
0146    *  @param      parentPath  Path name of the parent object.
0147    *  @param      objPath     Path name of the object relative to the parent.
0148    *  @return                 Status code indicating success or failure.
0149    */
0150   StatusCode unregisterObject( std::string_view parentPath, std::string_view objPath ) {
0151     DataObject* pO     = nullptr;
0152     StatusCode  status = findObject( parentPath, pO );
0153     return status.isSuccess() ? unregisterObject( pO, objPath ) : status;
0154   }
0155 
0156   /** Unregister object from the data store.
0157    *  On registration the client gives up ownership of the object and may no
0158    *  longer delete the object. unregistering the object is the opposite:
0159    *  ownership is claimed back by the user. But note:
0160    *  - All depending objects will be deleted, ie. all leaves "below" the
0161    *    entry in question; NOT the object itself, the object itself must be
0162    *    destroyed by the user.
0163    *
0164    *  The object is identified by parent path name and
0165    *  an integer identifier of the object itself.
0166    *  @param      parentPath  Path name of the parent object.
0167    *  @param      item        Integer identifier of the object item.
0168    *  @return                 Status code indicating success or failure.
0169    */
0170   StatusCode unregisterObject( std::string_view parentPath, int item ) {
0171     return unregisterObject( parentPath, itemToPath( item ) );
0172   }
0173 
0174   /** Unregister object from the data store.
0175    *  On registration the client gives up ownership of the object and may no
0176    *  longer delete the object. unregistering the object is the opposite:
0177    *  ownership is claimed back by the user. But note:
0178    *  - All depending objects will be deleted, ie. all leaves "below" the
0179    *    entry in question; NOT the object itself, the object itself must be
0180    *    destroyed by the user.
0181    *
0182    *  The object is identified by its pointer.
0183    *  The object must previously have been registered with the data store.
0184    *  @param      pObject     Pointer to the object.
0185    *  @return                 Status code indicating success or failure.
0186    */
0187   virtual StatusCode unregisterObject( DataObject* pObject ) = 0;
0188 
0189   /** Unregister object from the data store.
0190    *  On registration the client gives up ownership of the object and may no
0191    *  longer delete the object. unregistering the object is the opposite:
0192    *  ownership is claimed back by the user. But note:
0193    *  - All depending objects will be deleted, ie. all leaves "below" the
0194    *    entry in question; NOT the object itself, the object itself must be
0195    *    destroyed by the user.
0196    *
0197    *  The object is identified by parent object and the path of the
0198    *  object relative to the parent.
0199    *  @param      pParent     Pointer to parent object.
0200    *  @param      objPath     Path name of the object relative to the parent.
0201    *  @return                 Status code indicating success or failure.
0202    */
0203   virtual StatusCode unregisterObject( DataObject* pParent, std::string_view objPath ) = 0;
0204 
0205   /** Unregister object from the data store.
0206    *  On registration the client gives up ownership of the object and may no
0207    *  longer delete the object. unregistering the object is the opposite:
0208    *  ownership is claimed back by the user. But note:
0209    *  - All depending objects will be deleted, ie. all leaves "below" the
0210    *    entry in question; NOT the object itself, the object itself must be
0211    *    destroyed by the user.
0212    *
0213    *  The object is identified by parent object and
0214    *  an integer identifier of the object itself.
0215    *  @param      pParent     Pointer to parent object.
0216    *  @param      item        Integer identifier of the object item.
0217    *  @return                 Status code indicating success or failure.
0218    */
0219   StatusCode unregisterObject( DataObject* pParent, int item ) {
0220     return unregisterObject( pParent, itemToPath( item ) );
0221   }
0222 
0223   /** Retrieve object identified by its directory entry.
0224    *  The result will be returned in the second argument.
0225    *  In case the object is not present it will be loaded and converted
0226    *  if possible.
0227    *  ** FASTEST ACCESS TO THE DATA STORE **
0228    *  @param  pDirectory  Pointer to the object.
0229    *  @param  path        String with relative path to directory. Ideally ""!
0230    *  @param  pObject     Reference to the pointer of the object to be returned.
0231    *  @return             Status code indicating success or failure.
0232    */
0233   virtual StatusCode retrieveObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) = 0;
0234 
0235   /** Retrieve object identified by its full path from the data store.
0236    *  The result will be returned in the second argument.
0237    *  In case the object is not present it will be loaded and converted
0238    *  if possible.
0239    *  @param  fullPath    Path name of the object.
0240    *  @param  pObject     Reference to the pointer of the object to be returned.
0241    *  @return             Status code indicating success or failure.
0242    */
0243   StatusCode retrieveObject( std::string_view fullPath, DataObject*& pObject ) {
0244     return retrieveObject( static_cast<IRegistry*>( nullptr ), fullPath, pObject );
0245   }
0246 
0247   /** Retrieve object from data store.
0248    *  The object to be retrieved is identified by the path of the parent object
0249    *  and the relative path with respect to the node.
0250    *  In case the object is not present it will be loaded and converted
0251    *  if possible.
0252    *  @param  parentPath  Path to parent node of the object.
0253    *  @param  objectPath  Path of the object relative to the parent.
0254    *  @param  pObject     Reference to the pointer of the object to be returned.
0255    *  @return             Status code indicating success or failure.
0256    */
0257   StatusCode retrieveObject( std::string_view parentPath, std::string_view objectPath, DataObject*& pObject ) {
0258     DataObject* parent = nullptr;
0259     StatusCode  status = retrieveObject( parentPath, parent );
0260     return status.isSuccess() ? retrieveObject( parent, objectPath, pObject ) : status;
0261   }
0262 
0263   /** Retrieve object from data store.
0264    *  The object to be retrieved is identified by the path to the parent object
0265    *  and an integer identifier.
0266    *  In case the object is not present it will be loaded and converted
0267    *  if possible.
0268    *  @param  parentPath  Path to parent node of the object.
0269    *  @param  item        Item identifier.
0270    *  @param  pObject     Reference to the pointer of the object to be returned.
0271    *  @return             Status code indicating success or failure.
0272    */
0273   StatusCode retrieveObject( std::string_view parentPath, int item, DataObject*& pObject ) {
0274     return retrieveObject( parentPath, itemToPath( item ), pObject );
0275   }
0276 
0277   /** Retrieve object from data store.
0278    *  The object to be retrieved is identified by the pointer to the parent
0279    *  object and the relative path with respect to the node.
0280    *  In case the object is not present it will be loaded and converted
0281    *  if possible.
0282    *  @param  parentObj   Pointer to parent node of the object.
0283    *  @param  objectPath  Path of the object relative to the parent.
0284    *  @param  pObject     Reference to the pointer of the object to be returned.
0285    *  @return             Status code indicating success or failure.
0286    */
0287   StatusCode retrieveObject( DataObject* parentObj, std::string_view objectPath, DataObject*& pObject ) {
0288     return retrieveObject( parentObj ? parentObj->registry() : nullptr, objectPath, pObject );
0289   }
0290 
0291   /** Retrieve object from data store.
0292    *  The object to be retrieved is identified by the pointer to the parent
0293    *  object and an integer identifier.
0294    *  In case the object is not present it will be loaded and converted
0295    *  if possible.
0296    *  @param  parentObj   Pointer to parent node of the object.
0297    *  @param  item        Item identifier.
0298    *  @param  pObject     Reference to the pointer of the object to be returned.
0299    *  @return             Status code indicating success or failure.
0300    */
0301   StatusCode retrieveObject( DataObject* parentObj, int item, DataObject*& pObject ) {
0302     return retrieveObject( parentObj, itemToPath( item ), pObject );
0303   }
0304 
0305   /** Find object identified by its directory entry.
0306    *  The result will be returned in the second argument.
0307    *  In case the object is not present the pointer will be set to NULL.
0308    *  ** FASTEST ACCESS TO THE DATA STORE **
0309    *  @param  pDirectory  Pointer to the object.
0310    *  @param  path        String with relative path to directory. Ideally ""!
0311    *  @param  pObject     Reference to the pointer of the object to be returned.
0312    *  @return             Status code indicating success or failure.
0313    */
0314   virtual StatusCode findObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) = 0;
0315 
0316   /** Find object identified by its full path in the data store.
0317    *  The result will be returned in the second argument.
0318    *  In case the object is not present the pointer will be set to NULL.
0319    *  @param      fullPath    Path name of the object.
0320    *  @param      pObject     Pointer to the object to be connected.
0321    *  @return                 Status code indicating success or failure.
0322    */
0323   virtual StatusCode findObject( std::string_view fullPath, DataObject*& pObject ) = 0;
0324 
0325   /** Find object identified by its parent object and the path to the object
0326    *  relative to the parent.
0327    *  The result will be returned in the second argument.
0328    *  In case the object is not present the pointer will be set to NULL.
0329    *  @param  parentPath  Path to parent node of the object.
0330    *  @param  objectPath  Relative path name of the object.
0331    *  @param  pObject     Reference to the pointer of the object to be returned.
0332    *  @return             Status code indicating success or failure.
0333    */
0334   StatusCode findObject( std::string_view parentPath, std::string_view objectPath, DataObject*& pObject ) {
0335     DataObject* parent = nullptr;
0336     StatusCode  status = findObject( parentPath, parent );
0337     return status.isSuccess() ? findObject( parent, objectPath, pObject ) : status;
0338   }
0339 
0340   /** Find object identified by its parent object and an integer identifier
0341    *  in the data store.
0342    *  In case the object is not present the pointer will be set to NULL.
0343    *  @param  parentPath  Path to parent node of the object.
0344    *  @param  item        Item identifier.
0345    *  @param  pObject     Reference to the pointer of the object to be returned.
0346    *  @return             Status code indicating success or failure.
0347    */
0348   StatusCode findObject( std::string_view parentPath, int item, DataObject*& pObject ) {
0349     return findObject( parentPath, itemToPath( item ), pObject );
0350   }
0351 
0352   /** Find object identified by its parent object and the path to the object
0353    *  relative to the parent.
0354    *  The result will be returned in the second argument.
0355    *  In case the object is not present the pointer will be set to NULL.
0356    *  @param  parentObj   Pointer to parent node of the object.
0357    *  @param  objectPath  Relative path name of the object.
0358    *  @param  pObject     Reference to the pointer of the object to be returned.
0359    *  @return             Status code indicating success or failure.
0360    */
0361   StatusCode findObject( DataObject* parentObj, std::string_view objectPath, DataObject*& pObject ) {
0362     return findObject( parentObj ? parentObj->registry() : nullptr, objectPath, pObject );
0363   }
0364 
0365   /** Find object identified by its parent object and an integer identifier
0366    *  in the data store.
0367    *  In case the object is not present the pointer will be set to NULL.
0368    *  @param  parentObj   Pointer to parent node of the object.
0369    *  @param  item        Item identifier.
0370    *  @param  pObject     Reference to the pointer of the object to be returned.
0371    *  @return             Status code indicating success or failure.
0372    */
0373   StatusCode findObject( DataObject* parentObj, int item, DataObject*& pObject ) {
0374     return findObject( parentObj, itemToPath( item ), pObject );
0375   }
0376 
0377   /** Update object identified by its directory entry.
0378    *  ** FASTEST ACCESS TO THE DATA STORE **
0379    *  @param      pDirectory  Pointer to the directory entry.
0380    *  @return                 Status code indicating success or failure.
0381    */
0382   virtual StatusCode updateObject( IRegistry* pDirectory ) = 0;
0383 
0384   /** Update object identified by its full path in the data store.
0385    *  If found, the object update will be initiated.
0386    *  In case the object is not present the entry point returns an error.
0387    *  @param      fullPath    Path name of the object.
0388    *  @return                 Status code indicating success or failure.
0389    */
0390   StatusCode updateObject( std::string_view fullPath ) {
0391     DataObject* pO     = nullptr;
0392     StatusCode  status = findObject( fullPath, pO );
0393     return status.isSuccess() ? updateObject( pO ) : retrieveObject( fullPath, pO );
0394   }
0395 
0396   /** Update object identified by its pointer.
0397    *  If found, the object update will be initiated.
0398    *  In case the object is not present the entry point returns an error.
0399    *  @param      toUpdate    Pointer to the object.
0400    *  @return                 Status code indicating success or failure.
0401    */
0402   virtual StatusCode updateObject( DataObject* toUpdate ) = 0;
0403 
0404   /** Update object identified by its parent's path and the path relative
0405    *  to the parent.
0406    *  If found, the object update will be initiated.
0407    *  In case the object is not present the entry point returns an error.
0408    *  @param      parentPath  Path name of the parent object.
0409    *  @param      updatePath  Path to the object relative to the parent.
0410    *  @return                 Status code indicating success or failure.
0411    */
0412   StatusCode updateObject( std::string_view parentPath, std::string_view updatePath ) {
0413     DataObject* pParent = nullptr;
0414     StatusCode  status  = findObject( parentPath, pParent );
0415     return status.isSuccess() ? updateObject( pParent, updatePath ) : status;
0416   }
0417 
0418   /** Update object identified by its parent's pointer and the path relative
0419    *  to the parent.
0420    *  If found, the object update will be initiated.
0421    *  In case the object is not present the entry point returns an error.
0422    *  @param      pParent     Pointer to the parent object.
0423    *  @param      updatePath  Path to the object relative to the parent.
0424    *  @return                 Status code indicating success or failure.
0425    */
0426   StatusCode updateObject( DataObject* pParent, std::string_view updatePath ) {
0427     DataObject* pObject = nullptr;
0428     StatusCode  status  = findObject( pParent, updatePath, pObject );
0429     return status.isSuccess() ? updateObject( pObject ) : status;
0430   }
0431 
0432   /** Add an item to the preload list
0433    *  @param      item        Specs of item to be preloaded
0434    *  @return                 Status code indicating success or failure.
0435    */
0436   virtual StatusCode addPreLoadItem( const DataStoreItem& item ) = 0;
0437 
0438   /** Add an item to the preload list. The item is identified by the path
0439    *  to the object.
0440    *  @param      itemPath    Path to the item to be preloaded.
0441    *  @return                 Status code indicating success or failure.
0442    */
0443   StatusCode addPreLoadItem( std::string itemPath ) {
0444     return addPreLoadItem( DataStoreItem( std::move( itemPath ), 1 ) );
0445   }
0446 
0447   /** Remove an item from the preload list.
0448    *  @param      item        Specs of item to be removed from the preload list
0449    *  @return                 Status code indicating success or failure.
0450    */
0451   virtual StatusCode removePreLoadItem( const DataStoreItem& item ) = 0;
0452 
0453   /** Remove an item from the preload list.
0454    *  @param      itemPath    Path to the item to be preloaded.
0455    *  @return                 Status code indicating success or failure.
0456    */
0457   StatusCode removePreLoadItem( std::string itemPath ) {
0458     return removePreLoadItem( DataStoreItem( std::move( itemPath ), 1 ) );
0459   }
0460 
0461   /** Clear the preload list.
0462    *  @return                 Status code indicating success or failure.
0463    */
0464   virtual StatusCode resetPreLoad() = 0;
0465 
0466   /** Load all preload items of the list.
0467    *  @return                 Status code indicating success or failure.
0468    */
0469   virtual StatusCode preLoad() = 0;
0470 
0471   /** Add a link to another object.
0472    *  Both objects must already be registered with the data store.
0473    *  Once linked, the object can only be unregistered after unlinking.
0474    *  @param      from        Pointer to data directory the link originates.
0475    *  @param      objPath     Path of the entry to be linked relative to from.
0476    *  @param      toObj       Pointer to the object the link points to.
0477    *  @return                 Status code indicating success or failure.
0478    */
0479   virtual StatusCode linkObject( IRegistry* from, std::string_view objPath, DataObject* toObj ) = 0;
0480 
0481   /** Add a link to another object.
0482    *  Both objects must already be registered with the data store.
0483    *  Once linked, the object can only be unregistered after unlinking.
0484    *  @param      fromPath    Path to the object the link originates.
0485    *  @param      objPath     Path of the entry to be linked relative to from.
0486    *  @param      toObj       Pointer to the object the link points to.
0487    *  @return                 Status code indicating success or failure.
0488    */
0489   StatusCode linkObject( std::string_view fromPath, std::string_view objPath, DataObject* toObj ) {
0490     DataObject* pO     = nullptr;
0491     StatusCode  status = retrieveObject( fromPath, pO );
0492     return status.isSuccess() ? linkObject( pO->registry(), objPath, toObj ) : status;
0493   }
0494 
0495   /** Add a link to another object.
0496    *  Both objects must already be registered with the data store.
0497    *  Once linked, the object can only be unregistered after unlinking.
0498    *  @param      fromObj     Pointer to the object the link originates.
0499    *  @param      objPath     Path of the entry to be linked relative to from.
0500    *  @param      toObj       Pointer to the object the link points to.
0501    *  @return                 Status code indicating success or failure.
0502    */
0503   inline StatusCode linkObject( DataObject* fromObj, std::string_view objPath, DataObject* toObj );
0504 
0505   /** Add a link to another object.
0506    *  Both objects must already be registered with the data store.
0507    *  Once linked, the object can only be unregistered after unlinking.
0508    *  @param      fullPath    Full path of the entry to be linked.
0509    *  @param      toObj       Pointer to the object the link points to.
0510    *  @return                 Status code indicating success or failure.
0511    */
0512   virtual StatusCode linkObject( std::string_view fullPath, DataObject* toObj ) = 0;
0513 
0514   /** Remove a link to another object.
0515    *  Both objects must be registered with the data store.
0516    *  This entry point can be used to unlink objects e.g. in order to unregister
0517    *  them.
0518    *  @param      from        Pointer to data directory the link originates.
0519    *  @param      objPath     Path of the entry to be linked relative to from.
0520    *  @return                 Status code indicating success or failure.
0521    */
0522   virtual StatusCode unlinkObject( IRegistry* from, std::string_view objPath ) = 0;
0523 
0524   /** Remove a link to another object.
0525    *  Both objects must be registered with the data store.
0526    *  This entry point can be used to unlink objects e.g. in order to unregister
0527    *  them.
0528    *  @param      fromPath    Path to the object the link originates.
0529    *  @param      objPath     Path of the entry to be linked relative to from.
0530    *  @return                 Status code indicating success or failure.
0531    */
0532   StatusCode unlinkObject( std::string_view fromPath, std::string_view objPath ) {
0533     DataObject* pObject = nullptr;
0534     StatusCode  status  = findObject( fromPath, pObject );
0535     return status.isSuccess() ? unlinkObject( pObject->registry(), objPath ) : status;
0536   }
0537 
0538   /** Remove a link to another object.
0539    *  Both objects must be registered with the data store.
0540    *  This entry point can be used to unlink objects e.g. in order to unregister
0541    *  them.
0542    *  @param      fromObj     Pointer to the object the link originates.
0543    *  @param      objPath     Path of the entry to be linked relative to from.
0544    *  @return                 Status code indicating success or failure.
0545    */
0546   virtual StatusCode unlinkObject( DataObject* fromObj, std::string_view objPath ) = 0;
0547 
0548   /** Remove a link to another object.
0549    *  Both objects must be registered with the data store.
0550    *  This entry point can be used to unlink objects e.g. in order to unregister
0551    *  them.
0552    *  @param      fullPath    Full path of the entry to be linked.
0553    *  @return                 Status code indicating success or failure.
0554    */
0555   virtual StatusCode unlinkObject( std::string_view fullPath ) = 0;
0556 
0557   /// Status code definitions
0558   enum class Status : StatusCode::code_t {
0559     /// Success
0560     IDataProviderSvc_NO_ERROR = 1,
0561     /// The path for this objects is already in use
0562     DOUBL_OBJ_PATH,
0563     /// Invalid path from root to object request failed.
0564     INVALID_OBJ_PATH,
0565     /// Invalid root path object cannot be retrieved or stored.
0566     INVALID_ROOT,
0567     /// Object pointer is invalid
0568     INVALID_OBJECT,
0569     /// Pointer to parent object is not valid
0570     INVALID_PARENT,
0571     /// Sorry, the requested object is not loaded
0572     OBJ_NOT_LOADED,
0573     /// No data loader available
0574     NO_DATA_LOADER,
0575     /// Invalid object address
0576     INVALID_OBJ_ADDR,
0577     /// Directory entry is NOT empty
0578     DIR_NOT_EMPTY,
0579     /// Automatic data loading had to stop: maximum depth
0580     NO_MORE_LEVELS,
0581     /// Access to the requested leaf is inhibited
0582     NO_ACCESS,
0583     /// Terminator
0584     LAST
0585   };
0586 };
0587 
0588 STATUSCODE_ENUM_DECL( IDataProviderSvc::Status )
0589 
0590 inline StatusCode IDataProviderSvc::linkObject( DataObject* fromObj, std::string_view objPath, DataObject* toObj ) {
0591   if ( fromObj ) {
0592     IRegistry* from_entry = fromObj->registry();
0593     if ( from_entry ) return linkObject( from_entry, objPath, toObj );
0594   }
0595   return Status::INVALID_PARENT;
0596 }
0597 
0598 #endif // GAUDIKERNEL_IDATAPROVIDERSVC_H