The Gaudi Framework  v40r0 (475e45c1)
DataSvc Class Reference

#include <GaudiKernel/DataSvc.h>

Inheritance diagram for DataSvc:
Collaboration diagram for DataSvc:

Public Member Functions

CLID rootCLID () const override
 IDataManagerSvc: Accessor for root event CLID. More...
 
const std::string & rootName () const override
 IDataManagerSvc: Accessor for root event name. More...
 
StatusCode registerAddress (std::string_view fullPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store. More...
 
StatusCode registerAddress (IRegistry *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store. More...
 
StatusCode unregisterAddress (std::string_view fullPath) override
 IDataManagerSvc: Unregister object address from the data store. More...
 
StatusCode unregisterAddress (IRegistry *pParent, std::string_view objPath) override
 IDataManagerSvc: Unregister object address from the data store. More...
 
StatusCode objectLeaves (const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object. More...
 
StatusCode objectLeaves (const IRegistry *pRegistry, std::vector< IRegistry * > &refLeaves) override
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object. More...
 
StatusCode objectParent (const DataObject *pObject, IRegistry *&refpParent) override
 IDataManagerSvc: Explore the object store: retrieve the object's parent. More...
 
StatusCode objectParent (const IRegistry *pRegistry, IRegistry *&refpParent) override
 IDataManagerSvc: Explore the object store: retrieve the object's parent. More...
 
StatusCode clearSubTree (std::string_view sub_tree_path) override
 IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name. More...
 
StatusCode clearSubTree (DataObject *pObject) override
 IDataManagerSvc: Remove all data objects below the sub tree identified by the object. More...
 
StatusCode clearStore () override
 IDataManagerSvc: Remove all data objects in the data store. More...
 
StatusCode traverseSubTree (std::string_view sub_tree_path, IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full path name. More...
 
StatusCode traverseSubTree (DataObject *pObject, IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects below the sub tree. More...
 
StatusCode traverseTree (IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects in the data store. More...
 
StatusCode setRoot (std::string root_name, DataObject *pRootObj) override
 Initialize data store for new event by giving new event path and root object. More...
 
virtual StatusCode i_setRoot (std::string root_name, DataObject *pRootObj)
 Initialize data store for new event by giving new event path and root object. More...
 
StatusCode setRoot (std::string root_path, IOpaqueAddress *pRootAddr) override
 Initialize data store for new event by giving new event path and address of root object. More...
 
virtual StatusCode i_setRoot (std::string root_path, IOpaqueAddress *pRootAddr)
 Initialize data store for new event by giving new event path and address of root object. More...
 
StatusCode setDataLoader (IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
 IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data provider. More...
 
StatusCode addPreLoadItem (const DataStoreItem &item) override
 Add an item to the preload list. More...
 
StatusCode removePreLoadItem (const DataStoreItem &item) override
 Remove an item from the preload list. More...
 
StatusCode resetPreLoad () override
 Clear the preload list. More...
 
virtual StatusCode preLoad (int depth, int load_depth, DataObject *pObject)
 Execute one level of preloading and recursively load until the final level is reached. More...
 
StatusCode preLoad () override
 load all preload items of the list More...
 
StatusCode registerObject (std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode registerObject (DataObject *parentObj, std::string_view objPath, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode unregisterObject (std::string_view fullPath) override
 Unregister object from the data store. More...
 
StatusCode unregisterObject (DataObject *pObject) override
 Unregister object from the data store. More...
 
StatusCode unregisterObject (DataObject *pObject, std::string_view objectPath) override
 Unregister object from the data store. More...
 
StatusCode retrieveObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
 Retrieve object from data store. More...
 
StatusCode findObject (std::string_view fullPath, DataObject *&pObject) override
 Find object identified by its full path in the data store. More...
 
StatusCode findObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
 Find object identified by its full path in the data store. More...
 
StatusCode linkObject (IRegistry *from, std::string_view objPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode linkObject (std::string_view fullPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode unlinkObject (IRegistry *from, std::string_view objPath) override
 Remove a link to another object. More...
 
StatusCode unlinkObject (DataObject *fromObj, std::string_view objPath) override
 Remove a link to another object. More...
 
StatusCode unlinkObject (std::string_view fullPath) override
 Remove a link to another object. More...
 
StatusCode updateObject (IRegistry *pDirectory) override
 Update object identified by its directory entry. More...
 
StatusCode updateObject (DataObject *toUpdate) override
 Update object. More...
 
StatusCode initialize () override
 Service initialization. More...
 
StatusCode reinitialize () override
 Service initialization. More...
 
StatusCode finalize () override
 Service initialization. More...
 
 DataSvc (const DataSvc &)=delete
 copy constructor disabled More...
 
DataSvcoperator= (const DataSvc &)=delete
 Fake assignment operator (never implemented). More...
 
virtual StatusCode registerAddress (std::string_view fullPath, IOpaqueAddress *pAddress)=0
 Register object address with the data store. More...
 
StatusCode registerAddress (DataObject *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress)
 Register object address with the data store. More...
 
virtual StatusCode registerAddress (IRegistry *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress)=0
 Register object address with the data store. More...
 
virtual StatusCode unregisterAddress (std::string_view fullPath)=0
 Unregister object address from the data store. More...
 
StatusCode unregisterAddress (DataObject *pParent, std::string_view objPath)
 Unregister object address from the data store. More...
 
virtual StatusCode unregisterAddress (IRegistry *pParent, std::string_view objPath)=0
 Unregister object address from the data store. More...
 
StatusCode registerObject (std::string_view fullPath, DataObject *pObject)
 Register object with the data store. More...
 
virtual StatusCode registerObject (std::string_view parentPath, std::string_view objectPath, DataObject *pObject)=0
 Register object with the data store. More...
 
StatusCode registerObject (std::string_view parentPath, int item, DataObject *pObject)
 Register object with the data store. More...
 
virtual StatusCode registerObject (DataObject *parentObj, std::string_view objectPath, DataObject *pObject)=0
 Register object with the data store. More...
 
StatusCode registerObject (DataObject *parentObj, int item, DataObject *pObject)
 Register object with the data store. More...
 
virtual StatusCode retrieveObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
 Retrieve object identified by its directory entry. More...
 
StatusCode retrieveObject (std::string_view fullPath, DataObject *&pObject)
 Retrieve object identified by its full path from the data store. More...
 
StatusCode retrieveObject (std::string_view parentPath, std::string_view objectPath, DataObject *&pObject)
 Retrieve object from data store. More...
 
StatusCode retrieveObject (std::string_view parentPath, int item, DataObject *&pObject)
 Retrieve object from data store. More...
 
StatusCode retrieveObject (DataObject *parentObj, std::string_view objectPath, DataObject *&pObject)
 Retrieve object from data store. More...
 
StatusCode retrieveObject (DataObject *parentObj, int item, DataObject *&pObject)
 Retrieve object from data store. More...
 
virtual StatusCode findObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
 Find object identified by its directory entry. More...
 
virtual StatusCode findObject (std::string_view fullPath, DataObject *&pObject)=0
 Find object identified by its full path in the data store. More...
 
StatusCode findObject (std::string_view parentPath, std::string_view objectPath, DataObject *&pObject)
 Find object identified by its parent object and the path to the object relative to the parent. More...
 
StatusCode findObject (std::string_view parentPath, int item, DataObject *&pObject)
 Find object identified by its parent object and an integer identifier in the data store. More...
 
StatusCode findObject (DataObject *parentObj, std::string_view objectPath, DataObject *&pObject)
 Find object identified by its parent object and the path to the object relative to the parent. More...
 
StatusCode findObject (DataObject *parentObj, int item, DataObject *&pObject)
 Find object identified by its parent object and an integer identifier in the data store. More...
 
virtual StatusCode linkObject (IRegistry *from, std::string_view objPath, DataObject *toObj)=0
 Add a link to another object. More...
 
StatusCode linkObject (std::string_view fromPath, std::string_view objPath, DataObject *toObj)
 Add a link to another object. More...
 
StatusCode linkObject (DataObject *fromObj, std::string_view objPath, DataObject *toObj)
 Add a link to another object. More...
 
virtual StatusCode linkObject (std::string_view fullPath, DataObject *toObj)=0
 Add a link to another object. More...
 
virtual StatusCode unlinkObject (IRegistry *from, std::string_view objPath)=0
 Remove a link to another object. More...
 
StatusCode unlinkObject (std::string_view fromPath, std::string_view objPath)
 Remove a link to another object. More...
 
virtual StatusCode unlinkObject (DataObject *fromObj, std::string_view objPath)=0
 Remove a link to another object. More...
 
virtual StatusCode unlinkObject (std::string_view fullPath)=0
 Remove a link to another object. More...
 
- Public Member Functions inherited from extends< Service, IDataProviderSvc, IDataManagerSvc >
void const * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
- Public Member Functions inherited from Service
const std::string & name () const override
 Retrieve name of the service
More...
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 Initialize Service
More...
 
StatusCode sysStart () override
 Initialize Service
More...
 
StatusCode sysStop () override
 Initialize Service
More...
 
StatusCode sysFinalize () override
 Finalize Service
More...
 
StatusCode sysReinitialize () override
 Re-initialize the Service. More...
 
StatusCode sysRestart () override
 Re-initialize the Service. More...
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor
More...
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator
More...
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, const std::string &toolTypeAndName, bool createIf=true)
 Declare used tool. More...
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
template<class T >
void addToolsArray (ToolHandleArray< T > &hndlArr)
 
const std::vector< IAlgTool * > & tools () const
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
 requires (!Gaudi::Details::is_gaudi_property_v< TYPE >) Gaudi
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p) override
 set the property from another property with a different name More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property. More...
 
virtual StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p)=0
 Set the property from a property with a different name. More...
 
virtual StatusCode setProperty (const std::string &s)=0
 Set the property by string. More...
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals. More...
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string. More...
 
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (std::string_view name) const override
 get the property by name More...
 
StatusCode getProperty (std::string_view n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name. More...
 
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected More...
 
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 

Protected Member Functions

bool checkRoot ()
 Check if root path is valid. More...
 
virtual IConversionSvcgetDataLoader (IRegistry *pReg)
 Retrieve customizable data loader according to registry entry to be retrieved. More...
 
virtual DataObjectcreateDefaultObject () const
 Create default objects in case forced creation of leaves is requested. More...
 
virtual StatusCode loadObject (IRegistry *pNode)
 Invoke Persistency service to create transient object from its persistent representation. More...
 
virtual StatusCode loadObject (IConversionSvc *pLoader, IRegistry *pNode)
 Invoke Persistency service to create transient object from its persistent representation. More...
 
StatusCode retrieveEntry (DataSvcHelpers::RegistryEntry *pNode, std::string_view path, DataSvcHelpers::RegistryEntry *&pEntry)
 Retrieve registry entry from store. More...
 
DataObjecthandleDataFault (IRegistry *pReg, std::string_view path="")
 Invoke data fault handling if enabled. More...
 
- Protected Member Functions inherited from Service
std::vector< IAlgTool * > & tools ()
 
 ~Service () override
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Protected Attributes

SmartIF< IIncidentSvcm_incidentSvc = nullptr
 Pointer to incident service. More...
 
Gaudi::Property< CLIDm_rootCLID { this, "RootCLID", 110 , "CLID of root entry" }
 
Gaudi::Property< std::string > m_rootName { this, "RootName", "/Event", "name of root entry" }
 
std::unique_ptr< DataSvcHelpers::RegistryEntrym_root
 Pointer to root entry. More...
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state
More...
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state
More...
 
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools More...
 
Gaudi::Property< bool > m_auditorInitialize { this, "AuditInitialize", false, "trigger auditor on initialize()" }
 
Gaudi::Property< bool > m_auditorStart { this, "AuditStart", false, "trigger auditor on start()" }
 
Gaudi::Property< bool > m_auditorStop { this, "AuditStop", false, "trigger auditor on stop()" }
 
Gaudi::Property< bool > m_auditorFinalize { this, "AuditFinalize", false, "trigger auditor on finalize()" }
 
Gaudi::Property< bool > m_auditorReinitialize { this, "AuditReinitialize", false, "trigger auditor on reinitialize()" }
 
Gaudi::Property< bool > m_auditorRestart { this, "AuditRestart", false, "trigger auditor on restart()" }
 
Gaudi::Property< bool > m_autoRetrieveTools
 
Gaudi::Property< bool > m_checkToolDeps
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service
More...
 

Private Member Functions

StatusCode i_retrieveEntry (DataSvcHelpers::RegistryEntry *parentObj, std::string_view path, DataSvcHelpers::RegistryEntry *&pEntry)
 
DataObjecti_handleDataFault (IRegistry *pReg, std::string_view path=std::string_view{})
 

Private Attributes

SmartIF< IConversionSvcm_dataLoader = nullptr
 Pointer to data loader service. More...
 
Gaudi::Property< bool > m_forceLeaves
 
Gaudi::Property< std::vector< std::string > > m_inhibitPathes { this, "InhibitPathes", {}, "inhibited leaves" }
 
Gaudi::Property< bool > m_enableFaultHdlr
 
Gaudi::Property< std::string > m_faultName { this, "DataFaultName", "DataFault", "Name of the data fault incident" }
 
Gaudi::Property< bool > m_enableAccessHdlr
 
Gaudi::Property< std::string > m_accessName { this, "DataAccessName", "DataAccess", "Name of the data access incident" }
 
std::vector< DataStoreItemm_preLoads
 Items to be pre-loaded. More...
 

Additional Inherited Members

- Public Types inherited from extends< Service, IDataProviderSvc, IDataManagerSvc >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 

Detailed Description

Data service base class. A data service manages the transient data stores and implements the IDataProviderSvc and IDataManagerSvc interfaces.

Author
Markus Frank
Sebastien Ponce
Version
1.0

Definition at line 43 of file DataSvc.h.

Constructor & Destructor Documentation

◆ DataSvc()

DataSvc::DataSvc ( const DataSvc )
delete

copy constructor disabled

Member Function Documentation

◆ addPreLoadItem()

StatusCode DataSvc::addPreLoadItem ( const DataStoreItem item)
override

Add an item to the preload list.

Definition at line 749 of file DataSvc.cpp.

749  {
750  auto i = std::find( begin( m_preLoads ), end( m_preLoads ), item );
751  if ( i == end( m_preLoads ) ) m_preLoads.push_back( item );
752  return StatusCode::SUCCESS;
753 }

◆ checkRoot()

bool DataSvc::checkRoot ( )
inlineprotected

Check if root path is valid.

Definition at line 255 of file DataSvc.h.

255 { return 0 != m_root; }

◆ clearStore()

StatusCode DataSvc::clearStore ( )
override

IDataManagerSvc: Remove all data objects in the data store.

Definition at line 85 of file DataSvc.cpp.

85  {
86  if ( checkRoot() ) m_root.reset();
87  return StatusCode::SUCCESS;
88 }

◆ clearSubTree() [1/2]

StatusCode DataSvc::clearSubTree ( DataObject pObject)
override

IDataManagerSvc: Remove all data objects below the sub tree identified by the object.

Definition at line 74 of file DataSvc.cpp.

74  {
75  if ( !checkRoot() ) return Status::INVALID_ROOT;
76  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
77  if ( !entry ) return Status::INVALID_OBJECT;
78  RegEntry* parent = entry->parentEntry();
79  if ( !parent ) return Status::INVALID_PARENT;
80  parent->remove( entry );
81  return StatusCode::SUCCESS;
82 }

◆ clearSubTree() [2/2]

StatusCode DataSvc::clearSubTree ( std::string_view  sub_tree_path)
override

IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name.

Definition at line 59 of file DataSvc.cpp.

59  {
60  DataObject* pObject = nullptr;
61  StatusCode status = findObject( sub_tree_path, pObject );
62  if ( !status.isSuccess() ) return status;
63  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
64  if ( !node_entry ) return Status::INVALID_OBJECT;
65  RegEntry* parent = node_entry->parentEntry();
66  if ( !parent ) return Status::INVALID_PARENT;
67  parent->remove( node_entry );
68  return StatusCode::SUCCESS;
69 }

◆ createDefaultObject()

DataObject * DataSvc::createDefaultObject ( ) const
protectedvirtual

Create default objects in case forced creation of leaves is requested.

Definition at line 844 of file DataSvc.cpp.

844 { return new DataObject(); }

◆ finalize()

StatusCode DataSvc::finalize ( )
override

Service initialization.

Service initialisation.

Definition at line 828 of file DataSvc.cpp.

828  {
829  // Nothing to do: just call base class initialisation
830  setDataLoader( nullptr ).ignore();
831  resetPreLoad().ignore();
832  clearStore().ignore();
834  return Service::finalize();
835 }

◆ findObject() [1/8]

StatusCode IDataProviderSvc::findObject
inline

Find object identified by its parent object and an integer identifier in the data store.

In case the object is not present the pointer will be set to NULL.

Parameters
parentObjPointer to parent node of the object.
itemItem identifier.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 368 of file IDataProviderSvc.h.

368  {
369  return findObject( parentObj, itemToPath( item ), pObject );
370  }

◆ findObject() [2/8]

StatusCode IDataProviderSvc::findObject
inline

Find object identified by its parent object and the path to the object relative to the parent.

The result will be returned in the second argument. In case the object is not present the pointer will be set to NULL.

Parameters
parentObjPointer to parent node of the object.
objectPathRelative path name of the object.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 356 of file IDataProviderSvc.h.

356  {
357  return findObject( parentObj ? parentObj->registry() : nullptr, objectPath, pObject );
358  }

◆ findObject() [3/8]

StatusCode DataSvc::findObject ( IRegistry pDirectory,
std::string_view  path,
DataObject *&  pObject 
)
override

Find object identified by its full path in the data store.

Retrieve object identified by its directory from the data store.

Definition at line 610 of file DataSvc.cpp.

610  {
611  pObject = nullptr;
612  IRegistry* pReg = ( pRegistry ? pRegistry : m_root.get() );
613  RegEntry* root_entry = CAST_REGENTRY( RegEntry*, pReg );
614  if ( root_entry ) {
615  if ( !path.empty() ) pReg = root_entry->find( path );
616  if ( !pReg ) return Status::INVALID_OBJ_PATH;
617  pObject = pReg->object();
618  }
619  return ( !pObject ) ? Status::OBJ_NOT_LOADED : Status::IDataProviderSvc_NO_ERROR;
620 }

◆ findObject() [4/8]

virtual StatusCode IDataProviderSvc::findObject

Find object identified by its directory entry.

The result will be returned in the second argument. In case the object is not present the pointer will be set to NULL. ** FASTEST ACCESS TO THE DATA STORE **

Parameters
pDirectoryPointer to the object.
pathString with relative path to directory. Ideally ""!
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

◆ findObject() [5/8]

StatusCode DataSvc::findObject ( std::string_view  fullPath,
DataObject *&  pObject 
)
override

Find object identified by its full path in the data store.

Definition at line 623 of file DataSvc.cpp.

623  {
624  pObject = nullptr;
625  if ( !checkRoot() ) return Status::INVALID_ROOT;
626  if ( path.empty() || path == m_rootName.value() ) {
627  pObject = m_root->object();
628  return !pObject ? Status::OBJ_NOT_LOADED : Status::IDataProviderSvc_NO_ERROR;
629  }
630  return findObject( path.front() != SEPARATOR ? m_root.get() : nullptr, path, pObject );
631 }

◆ findObject() [6/8]

virtual StatusCode IDataProviderSvc::findObject

Find object identified by its full path in the data store.

The result will be returned in the second argument. In case the object is not present the pointer will be set to NULL.

Parameters
fullPathPath name of the object.
pObjectPointer to the object to be connected.
Returns
Status code indicating success or failure.

◆ findObject() [7/8]

StatusCode IDataProviderSvc::findObject
inline

Find object identified by its parent object and an integer identifier in the data store.

In case the object is not present the pointer will be set to NULL.

Parameters
parentPathPath to parent node of the object.
itemItem identifier.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 343 of file IDataProviderSvc.h.

343  {
344  return findObject( parentPath, itemToPath( item ), pObject );
345  }

◆ findObject() [8/8]

StatusCode IDataProviderSvc::findObject
inline

Find object identified by its parent object and the path to the object relative to the parent.

The result will be returned in the second argument. In case the object is not present the pointer will be set to NULL.

Parameters
parentPathPath to parent node of the object.
objectPathRelative path name of the object.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 329 of file IDataProviderSvc.h.

329  {
330  DataObject* parent = nullptr;
331  StatusCode status = findObject( parentPath, parent );
332  return status.isSuccess() ? findObject( parent, objectPath, pObject ) : status;
333  }

◆ getDataLoader()

IConversionSvc * DataSvc::getDataLoader ( IRegistry pReg)
protectedvirtual

Retrieve customizable data loader according to registry entry to be retrieved.

Reimplemented in NTupleSvc.

Definition at line 849 of file DataSvc.cpp.

849 { return m_dataLoader.get(); }

◆ handleDataFault()

DataObject * DataSvc::handleDataFault ( IRegistry pReg,
std::string_view  path = "" 
)
protected

Invoke data fault handling if enabled.

Parameters
pReg[IN] Pointer to missing registry entry
path[IN] Sub-path of requested object from pReg
Returns
Object corresponding to the specified leaf

Definition at line 408 of file DataSvc.cpp.

408  {
409  return i_handleDataFault( pReg, path );
410 }

◆ i_handleDataFault()

DataObject * DataSvc::i_handleDataFault ( IRegistry pReg,
std::string_view  path = std::string_view{} 
)
private

Definition at line 412 of file DataSvc.cpp.

412  {
413  if ( m_enableFaultHdlr ) {
414  IRegistry* pLeaf = nullptr;
415  if ( pReg && path.empty() ) {
416  DataIncident incident( name(), m_faultName, pReg->identifier() );
417  m_incidentSvc->fireIncident( incident );
418  return pReg->object();
419  }
420  if ( pReg ) {
421  std::string p = pReg->identifier();
422  if ( path.front() != SEPARATOR ) p += SEPARATOR;
423  p.append( path.data(), path.size() );
424  DataIncident incident( name(), m_faultName, p );
425  m_incidentSvc->fireIncident( incident );
426  pLeaf = m_root->findLeaf( p );
427  } else {
428  std::string p = m_root->identifier();
429  if ( path.front() != SEPARATOR ) p += SEPARATOR;
430  p.append( path.data(), path.size() );
431  DataIncident incident( name(), m_faultName, p );
432  m_incidentSvc->fireIncident( incident );
433  pLeaf = m_root->findLeaf( p );
434  }
435  if ( pLeaf ) { return pLeaf->object(); }
436  }
437  return nullptr;
438 }

◆ i_retrieveEntry()

StatusCode DataSvc::i_retrieveEntry ( DataSvcHelpers::RegistryEntry parentObj,
std::string_view  path,
DataSvcHelpers::RegistryEntry *&  pEntry 
)
private

Definition at line 515 of file DataSvc.cpp.

515  {
516  // A.Valassi 16.08.2001 avoid core dump if store is empty
517  if ( !checkRoot() ) return Status::INVALID_ROOT;
518 
519  static constexpr auto empty = std::string_view{};
520  auto sep = find( path, SEPARATOR, 1 );
521  pEntry = nullptr;
522 
523  if ( !parentObj ) {
524  if ( path.empty() || path == m_rootName.value() ) {
525  parentObj = m_root.get();
526  path = empty;
527  } else if ( path.front() != SEPARATOR ) {
528  parentObj = m_root.get();
529  } else if ( sep != std::string_view::npos ) {
530  if ( !m_root->object() ) {
531  RegEntry* r = nullptr;
532  auto status = i_retrieveEntry( m_root.get(), empty, r );
533  if ( !status.isSuccess() ) return status;
534  }
535  parentObj = m_root.get();
536  path = path.substr( sep );
537  } else {
538  return Status::INVALID_OBJ_PATH;
539  }
540  sep = find( path, SEPARATOR, 1 );
541  }
542 
543  StatusCode status{ Status::INVALID_ROOT };
544  if ( sep != std::string_view::npos ) { // the string contains a separator (after pos 0)
545  if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
546  status = loadObject( parentObj );
547  if ( !status.isSuccess() ) return status;
548  }
549  auto p_path = path.substr( 0, sep );
550  RegEntry* root_entry = parentObj->findLeaf( p_path );
551  if ( !root_entry && m_enableFaultHdlr ) {
552  // If not even the parent is there, an incident
553  // to load the parent must be fired...
554  i_handleDataFault( parentObj, p_path );
555  root_entry = parentObj->findLeaf( p_path );
556  }
557  if ( root_entry ) {
558  DataObject* pO = root_entry->object();
559  if ( !pO ) {
560  // Object is not loaded: load the object if at all possible
561  status = loadObject( root_entry );
562  if ( !status.isSuccess() ) return status;
563  }
564  if ( root_entry->isSoft() ) { root_entry = CAST_REGENTRY( RegEntry*, pO->registry() ); }
565  return i_retrieveEntry( root_entry, path.substr( sep ), pEntry );
566  }
567  return Status::INVALID_OBJ_PATH;
568  } else if ( path.empty() ) {
569  pEntry = parentObj;
570  } else {
571  if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
572  status = loadObject( parentObj );
573  if ( !status.isSuccess() ) return status;
574  }
575  // last leave in search: find leaf and load
576  pEntry = parentObj->findLeaf( path );
577  // If no registry entry was found, trigger incident for action-on-demand
578  if ( !pEntry && m_enableFaultHdlr ) {
579  i_handleDataFault( parentObj, path );
580  pEntry = ( path.empty() ? parentObj : parentObj->findLeaf( path ) );
581  }
582  }
583 
584  // Check results and return
585  if ( !pEntry ) return Status::INVALID_OBJ_PATH;
586  if ( !pEntry->object() ) return loadObject( pEntry );
587 
588  if ( m_enableAccessHdlr ) {
589  // Fire data access incident
590  // I do not know if this is a good idea....
591  // This fires too often!
592  //
593  // DataIncident incident(name(), m_accessName, pEntry->identifier());
594  // m_incidentSvc->fireIncident(incident);
595  return StatusCode::SUCCESS;
596  }
597  return StatusCode::SUCCESS;
598 }

◆ i_setRoot() [1/2]

StatusCode DataSvc::i_setRoot ( std::string  root_path,
DataObject pRootObj 
)
virtual

Initialize data store for new event by giving new event path and root object.

Does not clear the store before reinitializing it. This could lead to errors and should be handle with care. Use setRoot if unsure

Definition at line 125 of file DataSvc.cpp.

125  {
126  if ( pRootObj ) {
127  m_root = std::make_unique<RegEntry>( std::move( root_path ) );
128  m_root->makeHard( pRootObj );
129  m_root->setDataSvc( this );
130  // No done with GaudiHive. preLoad().ignore();
131  }
132  return StatusCode::SUCCESS;
133 }

◆ i_setRoot() [2/2]

StatusCode DataSvc::i_setRoot ( std::string  root_path,
IOpaqueAddress pRootAddr 
)
virtual

Initialize data store for new event by giving new event path and address of root object.

Does not clear the store before reinitializing it. This could lead to errors and should be handle with care. Use setRoot if unsure

Definition at line 149 of file DataSvc.cpp.

149  {
150  if ( pRootAddr ) {
151  m_root = std::make_unique<RegEntry>( std::move( root_path ) );
152  m_root->makeHard( pRootAddr );
153  m_root->setDataSvc( this );
154  // Not done with GaudiHive. preLoad().ignore();
155  }
156  return StatusCode::SUCCESS;
157 }

◆ initialize()

StatusCode DataSvc::initialize ( )
override

Service initialization.

Definition at line 795 of file DataSvc.cpp.

795  {
796  // Nothing to do: just call base class initialisation
798  if ( !sc.isSuccess() ) return sc;
799  m_incidentSvc = service( "IncidentSvc", true );
800  if ( !m_incidentSvc ) { error() << "Failed to access incident service." << endmsg; }
801  return sc;
802 }

◆ linkObject() [1/6]

StatusCode IDataProviderSvc::linkObject
inline

Add a link to another object.

Both objects must already be registered with the data store. Once linked, the object can only be unregistered after unlinking.

Parameters
fromObjPointer to the object the link originates.
objPathPath of the entry to be linked relative to from.
toObjPointer to the object the link points to.
Returns
Status code indicating success or failure.

Definition at line 498 of file IDataProviderSvc.h.

585  {
586  if ( fromObj ) {
587  IRegistry* from_entry = fromObj->registry();
588  if ( from_entry ) return linkObject( from_entry, objPath, toObj );
589  }
590  return Status::INVALID_PARENT;
591 }

◆ linkObject() [2/6]

StatusCode DataSvc::linkObject ( IRegistry from,
std::string_view  objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 683 of file DataSvc.cpp.

683  {
684  if ( !checkRoot() ) return Status::INVALID_ROOT;
685  try {
686  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
687  if ( from_entry ) {
688  // First check if both objects are already registered to the store
689  RegEntry* to_entry = m_root->findLeaf( to );
690  if ( !to_entry ) return Status::INVALID_OBJECT;
691  auto sep = objPath.rfind( SEPARATOR );
692  if ( sep > 0 && sep != std::string_view::npos ) { // in case the objPath is a sub-directory itself
693  DataObject* pO = nullptr;
694  StatusCode sc = retrieveObject( from, objPath.substr( 0, sep ), pO );
695  return sc.isSuccess() ? linkObject( pO->registry(), objPath.substr( sep ), to ) : sc;
696  }
697  // Now register the soft link
698  StatusCode status = from_entry->add( to_string( objPath ), to, true );
699  return status.isSuccess() ? Status::IDataProviderSvc_NO_ERROR : Status::DOUBL_OBJ_PATH;
700  }
701  } catch ( ... ) {}
702  return Status::INVALID_PARENT;
703 }

◆ linkObject() [3/6]

virtual StatusCode IDataProviderSvc::linkObject

Add a link to another object.

Both objects must already be registered with the data store. Once linked, the object can only be unregistered after unlinking.

Parameters
fromPointer to data directory the link originates.
objPathPath of the entry to be linked relative to from.
toObjPointer to the object the link points to.
Returns
Status code indicating success or failure.

◆ linkObject() [4/6]

StatusCode IDataProviderSvc::linkObject
inline

Add a link to another object.

Both objects must already be registered with the data store. Once linked, the object can only be unregistered after unlinking.

Parameters
fromPathPath to the object the link originates.
objPathPath of the entry to be linked relative to from.
toObjPointer to the object the link points to.
Returns
Status code indicating success or failure.

Definition at line 484 of file IDataProviderSvc.h.

484  {
485  DataObject* pO = nullptr;
486  StatusCode status = retrieveObject( fromPath, pO );
487  return status.isSuccess() ? linkObject( pO->registry(), objPath, toObj ) : status;
488  }

◆ linkObject() [5/6]

StatusCode DataSvc::linkObject ( std::string_view  fullPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 706 of file DataSvc.cpp.

706  {
707  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
708  if ( fullPath.front() != SEPARATOR ) { return linkObject( m_rootName.value(), fullPath, to ); }
709  auto sep = fullPath.rfind( SEPARATOR );
710  return linkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ), to );
711 }

◆ linkObject() [6/6]

virtual StatusCode IDataProviderSvc::linkObject

Add a link to another object.

Both objects must already be registered with the data store. Once linked, the object can only be unregistered after unlinking.

Parameters
fullPathFull path of the entry to be linked.
toObjPointer to the object the link points to.
Returns
Status code indicating success or failure.

◆ loadObject() [1/2]

StatusCode DataSvc::loadObject ( IConversionSvc pLoader,
IRegistry pNode 
)
protectedvirtual

Invoke Persistency service to create transient object from its persistent representation.

Definition at line 451 of file DataSvc.cpp.

451  {
452  StatusCode status = Status::INVALID_OBJ_ADDR;
453  DataObject* pObject = nullptr;
454  if ( !pLoader ) { // Precondition: Data loader must be present
455  return handleDataFault( pRegistry ) ? StatusCode::SUCCESS : StatusCode( Status::NO_DATA_LOADER );
456  }
457  if ( !pRegistry ) { // Precondition: Directory must be valid
458  return handleDataFault( pRegistry ) ? StatusCode::SUCCESS : StatusCode( Status::INVALID_OBJ_ADDR );
459  }
460 
461  VERMSG << "Requested object " << pRegistry->identifier() << endmsg;
462 
463  if ( m_enableAccessHdlr ) {
464  // Fire data access incident
465  DataIncident incident( name(), m_accessName, pRegistry->identifier() );
466  m_incidentSvc->fireIncident( incident );
467  }
468  if ( !m_inhibitPathes.empty() ) {
469  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), pRegistry->identifier() );
470  if ( inhibit != m_inhibitPathes.end() ) { return Status::NO_ACCESS; }
471  }
472  IOpaqueAddress* pAddress = pRegistry->address();
473  if ( !pAddress ) { // Precondition:
474  return Status::INVALID_OBJ_ADDR; // Address must be valid
475  }
476  try {
477  status = pLoader->createObj( pAddress, pObject ); // Call data loader
478  if ( status.isSuccess() ) {
479 
480  VERMSG << "Object " << pRegistry->identifier() << " created" << endmsg;
481 
482  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pRegistry );
483  pEntry->setObject( pObject );
484 
485  VERMSG << "Filling object " << pRegistry->identifier() << endmsg;
486  status = pLoader->fillObjRefs( pAddress, pObject );
487  }
488  } catch ( const GaudiException& exc ) {
489  if ( handleDataFault( pRegistry ) ) { return StatusCode::SUCCESS; }
490  throw GaudiException( "GaudiException in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE,
491  exc );
492  } catch ( const std::exception& x ) {
493  if ( handleDataFault( pRegistry ) ) { return StatusCode::SUCCESS; }
494  throw GaudiException( "std::exception in loadObject() " + pRegistry->identifier() + ": " +
495  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
497  } catch ( ... ) {
498  if ( handleDataFault( pRegistry ) ) { return StatusCode::SUCCESS; }
499  throw GaudiException( "UNKN exception in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE );
500  }
501  if ( !status.isSuccess() ) {
502  if ( handleDataFault( pRegistry ) ) { return StatusCode::SUCCESS; }
503  }
504  ON_VERBOSE if ( status.isSuccess() ) {
505  verbose() << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
506  }
507  return status;
508 }

◆ loadObject() [2/2]

StatusCode DataSvc::loadObject ( IRegistry pNode)
protectedvirtual

Invoke Persistency service to create transient object from its persistent representation.

Definition at line 443 of file DataSvc.cpp.

443  {
444  IConversionSvc* pLoader = getDataLoader( pRegistry );
445  return loadObject( pLoader, pRegistry );
446 }

◆ objectLeaves() [1/2]

StatusCode DataSvc::objectLeaves ( const DataObject pObject,
std::vector< IRegistry * > &  refLeaves 
)
override

IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.

IDataManagerSvc: Explore an object identified by its pointer.

Definition at line 181 of file DataSvc.cpp.

181  {
182  if ( !pObject ) return Status::INVALID_OBJECT;
183  return objectLeaves( pObject->registry(), leaves );
184 }

◆ objectLeaves() [2/2]

StatusCode DataSvc::objectLeaves ( const IRegistry pRegistry,
std::vector< IRegistry * > &  refLeaves 
)
override

IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.

IDataManagerSvc: Explore an object identified by the pointer to the registry entry.

Definition at line 189 of file DataSvc.cpp.

189  {
190  if ( !checkRoot() ) return Status::INVALID_ROOT;
191  const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
192  if ( !node_entry ) return Status::INVALID_OBJECT;
193  leaves = node_entry->leaves();
194  return StatusCode::SUCCESS;
195 }

◆ objectParent() [1/2]

StatusCode DataSvc::objectParent ( const DataObject pObject,
IRegistry *&  refpParent 
)
override

IDataManagerSvc: Explore the object store: retrieve the object's parent.

Definition at line 167 of file DataSvc.cpp.

167  {
168  if ( !pObject ) return Status::INVALID_OBJECT;
169  return objectParent( pObject->registry(), refpParent );
170 }

◆ objectParent() [2/2]

StatusCode DataSvc::objectParent ( const IRegistry pRegistry,
IRegistry *&  refpParent 
)
override

IDataManagerSvc: Explore the object store: retrieve the object's parent.

Definition at line 172 of file DataSvc.cpp.

172  {
173  if ( !checkRoot() ) return Status::INVALID_ROOT;
174  const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
175  if ( !node_entry ) return Status::INVALID_OBJECT;
176  refpParent = node_entry->parent();
177  return StatusCode::SUCCESS;
178 }

◆ operator=()

DataSvc& DataSvc::operator= ( const DataSvc )
delete

Fake assignment operator (never implemented).

◆ preLoad() [1/2]

StatusCode DataSvc::preLoad ( )
override

load all preload items of the list

Definition at line 784 of file DataSvc.cpp.

784  {
785  DataObject* pObj = nullptr;
786  for ( const auto& i : m_preLoads ) {
787  StatusCode sc = retrieveObject( i.path(), pObj );
788  int load_depth = i.depth();
789  if ( sc.isSuccess() && load_depth > 1 ) { preLoad( 1, load_depth, pObj ).ignore(); }
790  }
791  return StatusCode::SUCCESS;
792 }

◆ preLoad() [2/2]

StatusCode DataSvc::preLoad ( int  depth,
int  load_depth,
DataObject pObject 
)
virtual

Execute one level of preloading and recursively load until the final level is reached.

Preload one level deep, then recursively call the next level.

Parameters
depthcurrent level of loading from requested parent
load_depthmaximum level of object loading
pObjectpointer to next level root object
Returns
Status code indicating success or failure.

Definition at line 768 of file DataSvc.cpp.

768  {
769  // unused: StatusCode sc = StatusCode::FAILURE;
770  if ( pObject && depth++ < load_depth ) {
771  RegEntry* dir = CAST_REGENTRY( RegEntry*, pObject->registry() );
772  if ( dir ) {
773  for ( const auto& i : *dir ) {
774  DataObject* pObj = nullptr;
775  StatusCode status = retrieveObject( pObject, i->name(), pObj );
776  if ( status.isSuccess() && depth < load_depth ) { preLoad( depth, load_depth, pObj ).ignore(); }
777  }
778  }
779  }
780  return StatusCode::SUCCESS;
781 }

◆ registerAddress() [1/5]

StatusCode IDataManagerSvc::registerAddress
inline

Register object address with the data store.

Connect the object identified by its pointer to the parent object and the relative path of the object with respect to the parent.

Parameters
parentObj[IN] Pointer to parent object.
objectPath[IN] Path of the object relative to the parent node
pAddress[IN] Pointer to the object to be connected.
Returns
Status code indicating success or failure.

Definition at line 210 of file IDataManagerSvc.h.

210  {
211  return registerAddress( parentObj ? parentObj->registry() : nullptr, objectPath, pAddress );
212  }

◆ registerAddress() [2/5]

StatusCode DataSvc::registerAddress ( IRegistry parentObj,
std::string_view  objectPath,
IOpaqueAddress pAddress 
)
override

IDataManagerSvc: Register object address with the data store.

Definition at line 204 of file DataSvc.cpp.

204  {
205  if ( !checkRoot() ) return Status::INVALID_ROOT;
206  if ( objPath.empty() ) return Status::INVALID_OBJ_PATH;
207 
208  if ( !parentObj ) {
209  if ( objPath.front() != SEPARATOR ) { return registerAddress( m_root.get(), objPath, pAddress ); }
210  auto sep = find( objPath, SEPARATOR, 1 );
211  if ( sep == std::string_view::npos || objPath.substr( 0, sep ) != m_rootName.value() ) {
212  return Status::INVALID_PARENT;
213  }
214  return registerAddress( m_root.get(), objPath.substr( sep ), pAddress );
215  }
216  if ( objPath.front() != SEPARATOR ) { return registerAddress( parentObj, char( SEPARATOR ) + objPath, pAddress ); }
217  RegEntry* par_entry = CAST_REGENTRY( RegEntry*, parentObj );
218  if ( !par_entry ) return Status::INVALID_PARENT;
219 
220  auto sep = objPath.rfind( SEPARATOR );
221  if ( sep > 0 && sep != std::string_view::npos ) {
222  auto p_path = objPath.substr( 0, sep );
223  auto o_path = objPath.substr( sep );
224  RegEntry* p_entry = par_entry->findLeaf( p_path );
225  // Create default object leafs if the
226  // intermediate nodes are not present
227  if ( !p_entry && m_forceLeaves ) {
228  DataObject* pLeaf = createDefaultObject();
229  StatusCode sc = registerObject( par_entry->identifier(), p_path, pLeaf );
230  if ( sc.isFailure() ) delete pLeaf;
231  p_entry = par_entry->findLeaf( p_path );
232  }
233  if ( !p_entry ) return Status::INVALID_PARENT;
234  return registerAddress( p_entry, o_path, pAddress );
235  }
236  StatusCode status = par_entry->add( to_string( objPath ), pAddress );
237  return status.isSuccess() ? status : Status::DOUBL_OBJ_PATH;
238 }

◆ registerAddress() [3/5]

virtual StatusCode IDataManagerSvc::registerAddress

Register object address with the data store.

Connect the object identified by its pointer to the parent object and the relative path of the object with respect to the parent.

Parameters
parentObj[IN] Pointer to parent object.
objectPath[IN] Path of the object relative to the parent node
pAddress[IN] Pointer to the object to be connected.
Returns
Status code indicating success or failure.

◆ registerAddress() [4/5]

StatusCode DataSvc::registerAddress ( std::string_view  fullPath,
IOpaqueAddress pAddress 
)
override

IDataManagerSvc: Register object address with the data store.

Definition at line 198 of file DataSvc.cpp.

198  {
199  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
200  return registerAddress( fullPath.front() != SEPARATOR ? m_root.get() : nullptr, fullPath, pAddress );
201 }

◆ registerAddress() [5/5]

virtual StatusCode IDataManagerSvc::registerAddress

Register object address with the data store.

Connect the object identified by its pointer to the node object identified by its path.

Parameters
fullPath[IN] Path to parent node of the object.
pAddress[IN] Pointer to the object to be registered.
Returns
Status code indicating success or failure.

◆ registerObject() [1/7]

StatusCode IDataProviderSvc::registerObject
inline

Register object with the data store.

Connect the object identified by its pointer to the node object identified by its pointer.

Parameters
parentObjPointer to parent object.
itemitem number of the object linked to the parent
pObjectPointer to the object to be connected.
Returns
Status code indicating success or failure.

Definition at line 112 of file IDataProviderSvc.h.

112  {
113  return registerObject( parentObj, itemToPath( item ), pObject );
114  }

◆ registerObject() [2/7]

virtual StatusCode IDataProviderSvc::registerObject

Register object with the data store.

Connect the object identified by its pointer to the parent object and the relative path of the object with respect to the parent.

Parameters
parentObjPointer to parent object.
objectPathPath of the object relative to the parent node
pObjectPointer to the object to be connected.
Returns
Status code indicating success or failure.

◆ registerObject() [3/7]

StatusCode DataSvc::registerObject ( DataObject parentObj,
std::string_view  objPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 288 of file DataSvc.cpp.

288  {
289  if ( !checkRoot() ) return Status::INVALID_ROOT;
290 
291  if ( !parentObj ) {
292  if ( !objPath.empty() ) {
293  if ( objPath.front() != SEPARATOR ) { return registerObject( m_rootName.value(), objPath, pObject ); }
294  auto sep = find( objPath, SEPARATOR, 1 );
295  if ( sep != std::string_view::npos ) {
296  return registerObject( objPath.substr( 0, sep ), objPath.substr( sep ), pObject );
297  }
298  }
299  return Status::INVALID_OBJ_PATH;
300  }
301  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, parentObj->registry() );
302  if ( node_entry ) {
303  StatusCode status = Status::INVALID_PARENT;
304  auto sep = find( objPath, SEPARATOR, 1 );
305  if ( sep != std::string_view::npos ) {
306  auto p_path = objPath.substr( 0, sep );
307  auto o_path = objPath.substr( sep );
308  RegEntry* par_entry = node_entry->findLeaf( p_path );
309  // Create default object leafs if the
310  // intermediate nodes are not present
311  if ( !par_entry && m_forceLeaves ) {
312  DataObject* pLeaf = createDefaultObject();
313  StatusCode sc = registerObject( parentObj, p_path, pLeaf );
314  if ( !sc.isSuccess() ) delete pLeaf;
315  par_entry = node_entry->findLeaf( p_path );
316  } else if ( par_entry && !par_entry->object() ) {
317  status = i_retrieveEntry( node_entry, p_path, par_entry );
318  if ( !status.isSuccess() && !par_entry->address() && m_forceLeaves ) {
319  DataObject* pLeaf = createDefaultObject();
320  StatusCode sc = registerObject( parentObj, p_path, pLeaf );
321  if ( !sc.isSuccess() ) delete pLeaf;
322  par_entry = node_entry->findLeaf( p_path );
323  }
324  }
325  node_entry = par_entry;
326  if ( node_entry ) {
327  DataObject* obj = node_entry->object();
328  if ( obj ) status = registerObject( obj, o_path, pObject );
329  }
330  } else {
331  RegEntry* leaf = node_entry->findLeaf( objPath );
332  if ( !leaf ) {
333  status = node_entry->add( to_string( objPath ), pObject );
334  } else {
335  DataObject* obj = leaf->object();
336  if ( !obj ) {
337  if ( !pObject ) {
338  error() << "registerObject: trying to register null DataObject" << endmsg;
339  return StatusCode::FAILURE;
340  }
341  pObject->setRegistry( leaf );
342  leaf->setAddress( nullptr );
343  leaf->setObject( pObject );
344  status = StatusCode::SUCCESS;
345  } else {
346  status = Status::DOUBL_OBJ_PATH;
347  }
348  }
349  }
350  return status;
351  }
352  return Status::INVALID_PARENT;
353 }

◆ registerObject() [4/7]

StatusCode IDataProviderSvc::registerObject
inline

Register object with the data store.

Connect the object identified by its pointer to the node object identified by its path.

Parameters
fullPathPath to parent node of the object.
pObjectPointer to the object to be registered.
Returns
Status code indicating success or failure.

Definition at line 67 of file IDataProviderSvc.h.

67  {
68  return registerObject( nullptr, fullPath, pObject );
69  }

◆ registerObject() [5/7]

StatusCode IDataProviderSvc::registerObject
inline

Register object with the data store.

Connect the object identified by its pointer to the parent object and an integer identifier.

Parameters
parentPathPath to parent node of the object.
itemitem number of the object linked to the parent
pObjectPointer to the object to be registered.
Returns
Status code indicating success or failure.

Definition at line 90 of file IDataProviderSvc.h.

90  {
91  return registerObject( parentPath, itemToPath( item ), pObject );
92  }

◆ registerObject() [6/7]

virtual StatusCode IDataProviderSvc::registerObject

Register object with the data store.

Connect the object identified by the path to the parent object and the path of the object itself relative to the specified parent.

Parameters
parentPathPath to parent node of the object.
objectPathPath of the object relative to the parent node
pObjectPointer to the object to be registered.
Returns
Status code indicating success or failure.

◆ registerObject() [7/7]

StatusCode DataSvc::registerObject ( std::string_view  parentPath,
std::string_view  objPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 276 of file DataSvc.cpp.

276  {
277  DataObject* pO = nullptr;
278  StatusCode status = retrieveObject( parentPath, pO );
279  if ( !status.isSuccess() && m_forceLeaves ) {
280  pO = createDefaultObject();
281  status = registerObject( parentPath, pO );
282  if ( !status.isSuccess() ) pO->release();
283  }
284  return status.isSuccess() ? registerObject( pO, objPath, pObject ) : status;
285 }

◆ reinitialize()

StatusCode DataSvc::reinitialize ( )
override

Service initialization.

Service reinitialization.

Definition at line 805 of file DataSvc.cpp.

805  {
806  // the finalize part is copied here
807  setDataLoader( nullptr ).ignore();
808  resetPreLoad().ignore();
809  clearStore().ignore();
811  // re-initialize the base class
813  if ( !sc.isSuccess() ) {
814  error() << "Unable to reinitialize base class" << endmsg;
815  return sc;
816  }
817  // the initialize part is copied here
818  m_incidentSvc = service( "IncidentSvc", true );
819  if ( !m_incidentSvc ) {
820  error() << "Failed to access incident service." << endmsg;
821  return StatusCode::FAILURE;
822  }
823 
824  return StatusCode::SUCCESS;
825 }

◆ removePreLoadItem()

StatusCode DataSvc::removePreLoadItem ( const DataStoreItem item)
override

Remove an item from the preload list.

Definition at line 756 of file DataSvc.cpp.

756  {
757  m_preLoads.erase( std::remove( begin( m_preLoads ), end( m_preLoads ), item ), end( m_preLoads ) );
758  return StatusCode::SUCCESS;
759 }

◆ resetPreLoad()

StatusCode DataSvc::resetPreLoad ( )
override

Clear the preload list.

Definition at line 762 of file DataSvc.cpp.

762  {
763  m_preLoads.erase( begin( m_preLoads ), end( m_preLoads ) );
764  return StatusCode::SUCCESS;
765 }

◆ retrieveEntry()

StatusCode DataSvc::retrieveEntry ( DataSvcHelpers::RegistryEntry pNode,
std::string_view  path,
DataSvcHelpers::RegistryEntry *&  pEntry 
)
protected

Retrieve registry entry from store.

Definition at line 511 of file DataSvc.cpp.

511  {
512  return i_retrieveEntry( parentObj, path, pEntry );
513 }

◆ retrieveObject() [1/7]

StatusCode IDataProviderSvc::retrieveObject
inline

Retrieve object from data store.

The object to be retrieved is identified by the pointer to the parent object and an integer identifier. In case the object is not present it will be loaded and converted if possible.

Parameters
parentObjPointer to parent node of the object.
itemItem identifier.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 296 of file IDataProviderSvc.h.

296  {
297  return retrieveObject( parentObj, itemToPath( item ), pObject );
298  }

◆ retrieveObject() [2/7]

StatusCode IDataProviderSvc::retrieveObject
inline

Retrieve object from data store.

The object to be retrieved is identified by the pointer to the parent object and the relative path with respect to the node. In case the object is not present it will be loaded and converted if possible.

Parameters
parentObjPointer to parent node of the object.
objectPathPath of the object relative to the parent.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 282 of file IDataProviderSvc.h.

282  {
283  return retrieveObject( parentObj ? parentObj->registry() : nullptr, objectPath, pObject );
284  }

◆ retrieveObject() [3/7]

StatusCode DataSvc::retrieveObject ( IRegistry pDirectory,
std::string_view  path,
DataObject *&  pObject 
)
override

Retrieve object from data store.

Retrieve object identified by its directory from the data store.

Definition at line 601 of file DataSvc.cpp.

601  {
602  pObject = nullptr;
603  RegEntry * result = nullptr, *parent = CAST_REGENTRY( RegEntry*, pRegistry );
604  StatusCode status = i_retrieveEntry( parent, path, result );
605  if ( status.isSuccess() ) pObject = result->object();
606  return status;
607 }

◆ retrieveObject() [4/7]

virtual StatusCode IDataProviderSvc::retrieveObject

Retrieve object identified by its directory entry.

The result will be returned in the second argument. In case the object is not present it will be loaded and converted if possible. ** FASTEST ACCESS TO THE DATA STORE **

Parameters
pDirectoryPointer to the object.
pathString with relative path to directory. Ideally ""!
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

◆ retrieveObject() [5/7]

StatusCode IDataProviderSvc::retrieveObject
inline

Retrieve object identified by its full path from the data store.

The result will be returned in the second argument. In case the object is not present it will be loaded and converted if possible.

Parameters
fullPathPath name of the object.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 238 of file IDataProviderSvc.h.

238  {
239  return retrieveObject( static_cast<IRegistry*>( nullptr ), fullPath, pObject );
240  }

◆ retrieveObject() [6/7]

StatusCode IDataProviderSvc::retrieveObject
inline

Retrieve object from data store.

The object to be retrieved is identified by the path to the parent object and an integer identifier. In case the object is not present it will be loaded and converted if possible.

Parameters
parentPathPath to parent node of the object.
itemItem identifier.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 268 of file IDataProviderSvc.h.

268  {
269  return retrieveObject( parentPath, itemToPath( item ), pObject );
270  }

◆ retrieveObject() [7/7]

StatusCode IDataProviderSvc::retrieveObject
inline

Retrieve object from data store.

The object to be retrieved is identified by the path of the parent object and the relative path with respect to the node. In case the object is not present it will be loaded and converted if possible.

Parameters
parentPathPath to parent node of the object.
objectPathPath of the object relative to the parent.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 252 of file IDataProviderSvc.h.

252  {
253  DataObject* parent = nullptr;
254  StatusCode status = retrieveObject( parentPath, parent );
255  return status.isSuccess() ? retrieveObject( parent, objectPath, pObject ) : status;
256  }

◆ rootCLID()

CLID DataSvc::rootCLID ( ) const
override

IDataManagerSvc: Accessor for root event CLID.

CLID for root Event.

Definition at line 838 of file DataSvc.cpp.

838 { return (CLID)m_rootCLID; }

◆ rootName()

const std::string & DataSvc::rootName ( ) const
override

IDataManagerSvc: Accessor for root event name.

Name for root Event.

Definition at line 841 of file DataSvc.cpp.

841 { return m_rootName; }

◆ setDataLoader()

StatusCode DataSvc::setDataLoader ( IConversionSvc svc,
IDataProviderSvc dpsvc = nullptr 
)
override

IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data provider.

IDataManagerSvc: Pass a default data loader to the service.

Definition at line 160 of file DataSvc.cpp.

160  {
161  m_dataLoader = pDataLoader;
162  if ( m_dataLoader ) m_dataLoader->setDataProvider( dpsvc ? dpsvc : this ).ignore();
163  return StatusCode::SUCCESS;
164 }

◆ setRoot() [1/2]

StatusCode DataSvc::setRoot ( std::string  root_path,
DataObject pRootObj 
)
override

Initialize data store for new event by giving new event path and root object.

Takes care to clear the store before reinitializing it

Takes care to clear the store before reinitializing it

Definition at line 115 of file DataSvc.cpp.

115  {
116  clearStore().ignore();
117  return i_setRoot( std::move( root_path ), pRootObj );
118 }

◆ setRoot() [2/2]

StatusCode DataSvc::setRoot ( std::string  root_path,
IOpaqueAddress pRootAddr 
)
override

Initialize data store for new event by giving new event path and address of root object.

Takes care to clear the store before reinitializing it

Definition at line 139 of file DataSvc.cpp.

139  {
140  clearStore().ignore();
141  return i_setRoot( std::move( root_path ), pRootAddr );
142 }

◆ traverseSubTree() [1/2]

StatusCode DataSvc::traverseSubTree ( DataObject pObject,
IDataStoreAgent pAgent 
)
override

IDataManagerSvc: Analyze by traversing all data objects below the sub tree.

IDataManagerSvc: Analyse by traversing all data objects below the sub tree.

Definition at line 100 of file DataSvc.cpp.

100  {
101  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
102  return entry ? entry->traverseTree( pAgent ) : Status::INVALID_OBJECT;
103 }

◆ traverseSubTree() [2/2]

StatusCode DataSvc::traverseSubTree ( std::string_view  sub_tree_path,
IDataStoreAgent pAgent 
)
override

IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full path name.

IDataManagerSvc: Analyse by traversing all data objects below the sub tree identified by its full path name.

Definition at line 93 of file DataSvc.cpp.

93  {
94  DataObject* pO = nullptr;
95  StatusCode status = findObject( sub_tree_path, pO );
96  return status.isSuccess() ? traverseSubTree( pO, pAgent ) : status;
97 }

◆ traverseTree()

StatusCode DataSvc::traverseTree ( IDataStoreAgent pAgent)
override

IDataManagerSvc: Analyze by traversing all data objects in the data store.

IDataManagerSvc: Analyse by traversing all data objects in the data store.

Definition at line 106 of file DataSvc.cpp.

106  {
107  if ( !checkRoot() ) return Status::INVALID_ROOT;
108  return m_root->traverseTree( pAgent );
109 }

◆ unlinkObject() [1/7]

StatusCode DataSvc::unlinkObject ( DataObject fromObj,
std::string_view  objPath 
)
override

Remove a link to another object.

Definition at line 742 of file DataSvc.cpp.

742  {
743  if ( !checkRoot() ) return Status::INVALID_ROOT;
744  IRegistry* from_entry = m_root->findLeaf( from );
745  return unlinkObject( from_entry, objPath );
746 }

◆ unlinkObject() [2/7]

virtual StatusCode IDataProviderSvc::unlinkObject

Remove a link to another object.

Both objects must be registered with the data store. This entry point can be used to unlink objects e.g. in order to unregister them.

Parameters
fromObjPointer to the object the link originates.
objPathPath of the entry to be linked relative to from.
Returns
Status code indicating success or failure.

◆ unlinkObject() [3/7]

StatusCode DataSvc::unlinkObject ( IRegistry from,
std::string_view  objPath 
)
override

Remove a link to another object.

Definition at line 714 of file DataSvc.cpp.

714  {
715  if ( !checkRoot() ) return Status::INVALID_ROOT;
716  try {
717  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
718  if ( from_entry ) {
719  auto sep = objPath.rfind( SEPARATOR );
720  if ( sep > 0 && sep != std::string_view::npos ) { // in case the objPath is a sub-directory itself
721  DataObject* pO = nullptr;
722  StatusCode sc = findObject( from, objPath.substr( 0, sep ), pO );
723  return sc.isSuccess() ? unlinkObject( pO->registry(), objPath.substr( sep ) ) : sc;
724  }
725  StatusCode status = from_entry->remove( objPath );
726  if ( status.isSuccess() ) return status;
727  return Status::INVALID_OBJ_PATH;
728  }
729  } catch ( ... ) {}
730  return Status::INVALID_PARENT;
731 }

◆ unlinkObject() [4/7]

virtual StatusCode IDataProviderSvc::unlinkObject

Remove a link to another object.

Both objects must be registered with the data store. This entry point can be used to unlink objects e.g. in order to unregister them.

Parameters
fromPointer to data directory the link originates.
objPathPath of the entry to be linked relative to from.
Returns
Status code indicating success or failure.

◆ unlinkObject() [5/7]

StatusCode IDataProviderSvc::unlinkObject
inline

Remove a link to another object.

Both objects must be registered with the data store. This entry point can be used to unlink objects e.g. in order to unregister them.

Parameters
fromPathPath to the object the link originates.
objPathPath of the entry to be linked relative to from.
Returns
Status code indicating success or failure.

Definition at line 527 of file IDataProviderSvc.h.

527  {
528  DataObject* pObject = nullptr;
529  StatusCode status = findObject( fromPath, pObject );
530  return status.isSuccess() ? unlinkObject( pObject->registry(), objPath ) : status;
531  }

◆ unlinkObject() [6/7]

StatusCode DataSvc::unlinkObject ( std::string_view  fullPath)
override

Remove a link to another object.

Definition at line 734 of file DataSvc.cpp.

734  {
735  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
736  if ( fullPath.front() != SEPARATOR ) return unlinkObject( m_rootName.value(), fullPath );
737  auto sep = fullPath.rfind( SEPARATOR );
738  return unlinkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ) );
739 }

◆ unlinkObject() [7/7]

virtual StatusCode IDataProviderSvc::unlinkObject

Remove a link to another object.

Both objects must be registered with the data store. This entry point can be used to unlink objects e.g. in order to unregister them.

Parameters
fullPathFull path of the entry to be linked.
Returns
Status code indicating success or failure.

◆ unregisterAddress() [1/5]

StatusCode IDataManagerSvc::unregisterAddress
inline

Unregister object address from the data store.

The object is identified by parent object and the path of the object relative to the parent.

Parameters
pParent[IN] Pointer to parent object.
objPath[IN] Path name of the object relative to the parent.
Returns
Status code indicating success or failure.

Definition at line 238 of file IDataManagerSvc.h.

238  {
239  return unregisterAddress( pParent ? pParent->registry() : nullptr, objPath );
240  }

◆ unregisterAddress() [2/5]

StatusCode DataSvc::unregisterAddress ( IRegistry pParent,
std::string_view  objPath 
)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 247 of file DataSvc.cpp.

247  {
248  if ( !checkRoot() ) return Status::INVALID_ROOT;
249  if ( objPath.empty() ) return Status::INVALID_OBJ_PATH;
250 
251  if ( !pParent ) {
252  if ( objPath.front() != SEPARATOR ) return unregisterAddress( m_root.get(), objPath );
253  auto sep = find( objPath, SEPARATOR, 1 );
254  if ( sep != std::string_view::npos && objPath.substr( 0, sep ) == m_rootName.value() ) {
255  return unregisterAddress( m_root.get(), objPath.substr( sep ) );
256  }
257  return Status::INVALID_PARENT;
258  }
259  if ( objPath.front() != SEPARATOR ) { return unregisterAddress( pParent, char( SEPARATOR ) + objPath ); }
260  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pParent );
261  if ( node_entry ) {
262  RegEntry* leaf_entry = node_entry->findLeaf( objPath );
263  if ( leaf_entry ) {
264  auto sep = objPath.rfind( SEPARATOR );
265  if ( sep > 0 && sep != std::string_view::npos ) {
266  return unregisterAddress( leaf_entry->parent(), objPath.substr( sep ) );
267  }
268  StatusCode status = node_entry->remove( objPath );
269  if ( status.isSuccess() ) return status;
270  }
271  }
272  return Status::INVALID_PARENT;
273 }

◆ unregisterAddress() [3/5]

virtual StatusCode IDataManagerSvc::unregisterAddress

Unregister object address from the data store.

The object is identified by parent object and the path of the object relative to the parent.

Parameters
pParent[IN] Pointer to parent object.
objPath[IN] Path name of the object relative to the parent.
Returns
Status code indicating success or failure.

◆ unregisterAddress() [4/5]

StatusCode DataSvc::unregisterAddress ( std::string_view  fullPath)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 241 of file DataSvc.cpp.

241  {
242  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
243  return unregisterAddress( fullPath.front() != SEPARATOR ? m_root.get() : nullptr, fullPath );
244 }

◆ unregisterAddress() [5/5]

virtual StatusCode IDataManagerSvc::unregisterAddress

Unregister object address from the data store.

The object is identified by full path name.

Parameters
fullPath[IN] Path name of the object.
Returns
Status code indicating success or failure.

◆ unregisterObject() [1/3]

StatusCode DataSvc::unregisterObject ( DataObject pObject)
override

Unregister object from the data store.

Definition at line 371 of file DataSvc.cpp.

371  {
372  if ( !checkRoot() ) return Status::INVALID_ROOT;
373  RegEntry* entry = m_root->findLeaf( pObject );
374  if ( !entry ) return Status::INVALID_OBJECT;
375  RegEntry* parent = entry->parentEntry();
376  if ( !parent ) return Status::INVALID_PARENT;
377  if ( !entry->isEmpty() ) return Status::DIR_NOT_EMPTY;
378  if ( entry->object() ) entry->object()->addRef();
379  if ( parent ) parent->remove( entry );
380  return StatusCode::SUCCESS;
381 }

◆ unregisterObject() [2/3]

StatusCode DataSvc::unregisterObject ( DataObject pObject,
std::string_view  objectPath 
)
override

Unregister object from the data store.

Definition at line 384 of file DataSvc.cpp.

384  {
385  if ( checkRoot() ) {
386  try {
387  RegEntry* parent = CAST_REGENTRY( RegEntry*, pParentObj->registry() );
388  if ( parent ) {
389  RegEntry* entry = parent->findLeaf( objectPath );
390  if ( entry ) {
391  if ( entry->isEmpty() ) {
392  if ( entry->object() ) { entry->object()->addRef(); }
393  parent->remove( entry );
394  return StatusCode::SUCCESS;
395  }
396  return Status::DIR_NOT_EMPTY;
397  }
398  return Status::INVALID_OBJECT;
399  }
400  } catch ( ... ) {}
401  return Status::INVALID_PARENT;
402  }
403  return Status::INVALID_ROOT;
404 }

◆ unregisterObject() [3/3]

StatusCode DataSvc::unregisterObject ( std::string_view  fullPath)
override

Unregister object from the data store.

Definition at line 356 of file DataSvc.cpp.

356  {
357  DataObject* pObject = nullptr;
358  StatusCode status = findObject( fullPath, pObject );
359  if ( status.isFailure() ) return status;
360  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pObject->registry() );
361  if ( !pEntry ) return Status::INVALID_ROOT;
362  if ( !pEntry->isEmpty() ) return Status::DIR_NOT_EMPTY;
363  RegEntry* pParent = pEntry->parentEntry();
364  if ( !pParent ) return Status::INVALID_PARENT;
365  pObject->addRef();
366  pParent->remove( pEntry );
367  return StatusCode::SUCCESS;
368 }

◆ updateObject() [1/2]

StatusCode DataSvc::updateObject ( DataObject toUpdate)
override

Update object.

Definition at line 646 of file DataSvc.cpp.

646  {
647  StatusCode status = Status::INVALID_OBJ_ADDR;
648  if ( !toUpdate ) { // Precondition:
649  return Status::INVALID_OBJECT; // Address must be valid
650  }
651  IRegistry* pRegistry = toUpdate->registry(); // Precondition:
652  if ( !pRegistry ) { // Need valid registry
653  return Status::INVALID_OBJECT;
654  }
655  IOpaqueAddress* pAddress = pRegistry->address(); // Precondition:
656  if ( !pAddress ) { // Need valid address
657  return Status::INVALID_OBJ_ADDR;
658  }
659  IConversionSvc* pLoader = getDataLoader( pRegistry );
660  if ( !pLoader ) { // Precondition:
661  return Status::NO_DATA_LOADER; // Data loader must be present
662  }
663  if ( !m_inhibitPathes.empty() ) {
664  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), pRegistry->identifier() );
665  if ( inhibit != m_inhibitPathes.end() ) { return Status::NO_ACCESS; }
666  }
667  try {
668  status = pLoader->updateObj( pAddress, toUpdate ); // Call data loader
669  if ( status.isSuccess() ) { status = pLoader->updateObjRefs( pAddress, toUpdate ); }
670  } catch ( const GaudiException& exc ) {
671  throw GaudiException( "GaudiException in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE, exc );
672  } catch ( const std::exception& x ) {
673  throw GaudiException( "std::exception in updateObject() " + pRegistry->name() + ": " +
674  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
676  } catch ( ... ) {
677  throw GaudiException( "UNKN exception in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE );
678  }
679  return status;
680 }

◆ updateObject() [2/2]

StatusCode DataSvc::updateObject ( IRegistry pDirectory)
override

Update object identified by its directory entry.

Update object.

Definition at line 634 of file DataSvc.cpp.

634  {
635  if ( !pRegistry ) { // Precondition:
636  return Status::INVALID_OBJ_ADDR; // Addres must be valid
637  }
638  DataObject* toUpdate = pRegistry->object();
639  if ( !toUpdate ) { // Try first to load
640  return loadObject( pRegistry );
641  }
642  return updateObject( toUpdate );
643 }

Member Data Documentation

◆ m_accessName

Gaudi::Property<std::string> DataSvc::m_accessName { this, "DataAccessName", "DataAccess", "Name of the data access incident" }
private

Definition at line 66 of file DataSvc.h.

◆ m_dataLoader

SmartIF<IConversionSvc> DataSvc::m_dataLoader = nullptr
private

Pointer to data loader service.

Definition at line 46 of file DataSvc.h.

◆ m_enableAccessHdlr

Gaudi::Property<bool> DataSvc::m_enableAccessHdlr
private
Initial value:
{ this, "EnableAccessHandler", false,
"enable incidents on data access requests" }

Definition at line 64 of file DataSvc.h.

◆ m_enableFaultHdlr

Gaudi::Property<bool> DataSvc::m_enableFaultHdlr
private
Initial value:
{ this, "EnableFaultHandler", false,
"enable incidents on data creation requests" }

Definition at line 60 of file DataSvc.h.

◆ m_faultName

Gaudi::Property<std::string> DataSvc::m_faultName { this, "DataFaultName", "DataFault", "Name of the data fault incident" }
private

Definition at line 62 of file DataSvc.h.

◆ m_forceLeaves

Gaudi::Property<bool> DataSvc::m_forceLeaves
private
Initial value:
{ this, "ForceLeaves", false,
"force creation of default leaves on registerObject" }

Definition at line 56 of file DataSvc.h.

◆ m_incidentSvc

SmartIF<IIncidentSvc> DataSvc::m_incidentSvc = nullptr
protected

Pointer to incident service.

Definition at line 50 of file DataSvc.h.

◆ m_inhibitPathes

Gaudi::Property<std::vector<std::string> > DataSvc::m_inhibitPathes { this, "InhibitPathes", {}, "inhibited leaves" }
private

Definition at line 58 of file DataSvc.h.

◆ m_preLoads

std::vector<DataStoreItem> DataSvc::m_preLoads
private

Items to be pre-loaded.

Definition at line 69 of file DataSvc.h.

◆ m_root

std::unique_ptr<DataSvcHelpers::RegistryEntry> DataSvc::m_root
protected

Pointer to root entry.

Definition at line 73 of file DataSvc.h.

◆ m_rootCLID

Gaudi::Property<CLID> DataSvc::m_rootCLID { this, "RootCLID", 110 , "CLID of root entry" }
protected

Definition at line 52 of file DataSvc.h.

◆ m_rootName

Gaudi::Property<std::string> DataSvc::m_rootName { this, "RootName", "/Event", "name of root entry" }
protected

Definition at line 53 of file DataSvc.h.


The documentation for this class was generated from the following files:
DataSvcHelpers::RegistryEntry::find
IRegistry * find(const IRegistry *obj) const
Try to find an object identified by its pointer.
Definition: RegistryEntry.h:144
DataObject::setRegistry
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition: DataObject.h:77
GaudiPython.Bindings.DataObject
DataObject
Definition: Bindings.py:82
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:118
DataSvcHelpers::RegistryEntry::setAddress
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
Definition: RegistryEntry.cpp:94
DataSvcHelpers::RegistryEntry::findLeaf
RegistryEntry * findLeaf(std::string_view path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:98
AtlasMCRecoFullPrecedenceDump.path
path
Definition: AtlasMCRecoFullPrecedenceDump.py:49
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:314
DataSvcHelpers::RegistryEntry::isSoft
bool isSoft() const
Is the link soft or hard.
Definition: RegistryEntry.h:132
IOpaqueAddress
Definition: IOpaqueAddress.h:28
DataSvc::resetPreLoad
StatusCode resetPreLoad() override
Clear the preload list.
Definition: DataSvc.cpp:762
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
CAST_REGENTRY
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:46
DataObject::release
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:56
DataSvc::setDataLoader
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data pro...
Definition: DataSvc.cpp:160
GaudiException
Definition: GaudiException.h:29
DataSvc::unlinkObject
StatusCode unlinkObject(IRegistry *from, std::string_view objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:714
DataSvc::i_retrieveEntry
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, std::string_view path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:515
IConverter::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
Service::service
SmartIF< IFace > service(const std::string &name, bool createIf=true) const
Definition: Service.h:79
IRegistry
Definition: IRegistry.h:29
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:301
DataSvc::findObject
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:623
DataSvc::retrieveObject
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:601
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:223
DataSvc::clearStore
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:85
DataSvc::i_handleDataFault
DataObject * i_handleDataFault(IRegistry *pReg, std::string_view path=std::string_view{})
Definition: DataSvc.cpp:412
DataSvc::m_dataLoader
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
Definition: DataSvc.h:46
DataSvcHelpers::RegistryEntry::address
IOpaqueAddress * address() const override
Retrieve opaque storage address.
Definition: RegistryEntry.h:128
IRegistry::name
virtual const name_type & name() const =0
Name of the directory (or key)
DataSvcHelpers::RegistryEntry::leaves
const Store & leaves() const
Access the leaves of the object.
Definition: RegistryEntry.h:134
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:135
DataSvc::createDefaultObject
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:844
DataSvcHelpers::RegistryEntry::object
DataObject * object() const override
Retrive object behind the link.
Definition: RegistryEntry.h:126
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:333
StatusCode
Definition: StatusCode.h:64
DataSvc::handleDataFault
DataObject * handleDataFault(IRegistry *pReg, std::string_view path="")
Invoke data fault handling if enabled.
Definition: DataSvc.cpp:408
DataSvc::m_rootName
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:53
DataSvc::traverseSubTree
StatusCode traverseSubTree(std::string_view sub_tree_path, IDataStoreAgent *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full pat...
Definition: DataSvc.cpp:93
DataIncident
ON_VERBOSE
#define ON_VERBOSE
Definition: DataSvc.cpp:51
DataSvcHelpers::RegistryEntry::remove
StatusCode remove(std::string_view name)
Remove an entry from the store.
Definition: RegistryEntry.cpp:127
DataSvcHelpers::RegistryEntry::setObject
void setObject(DataObject *obj)
Set/Update object address.
Definition: RegistryEntry.cpp:104
DataSvc::i_setRoot
virtual StatusCode i_setRoot(std::string root_name, DataObject *pRootObj)
Initialize data store for new event by giving new event path and root object.
Definition: DataSvc.cpp:125
IConverter::updateObj
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
DataSvc::m_enableFaultHdlr
Gaudi::Property< bool > m_enableFaultHdlr
Definition: DataSvc.h:60
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:229
DataSvcHelpers::RegistryEntry::isEmpty
bool isEmpty() const
Simple check if the Container is empty.
Definition: RegistryEntry.h:138
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:16
genconfuser.verbose
verbose
Definition: genconfuser.py:28
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:198
DataSvcHelpers::RegistryEntry::parent
IRegistry * parent() const
Pointer to parent directory entry.
Definition: RegistryEntry.h:130
DataSvc::unregisterAddress
StatusCode unregisterAddress(std::string_view fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:241
DataSvc::m_faultName
Gaudi::Property< std::string > m_faultName
Definition: DataSvc.h:62
DataSvc::m_inhibitPathes
Gaudi::Property< std::vector< std::string > > m_inhibitPathes
Definition: DataSvc.h:58
DataSvc::preLoad
StatusCode preLoad() override
load all preload items of the list
Definition: DataSvc.cpp:784
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition: StatusCode.h:139
SEPARATOR
constexpr char SEPARATOR
Definition: RegistryEntry.cpp:25
DataSvc::m_root
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:73
IRegistry::address
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
DataSvc::checkRoot
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:255
DataSvc::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:50
DataSvc::m_forceLeaves
Gaudi::Property< bool > m_forceLeaves
Definition: DataSvc.h:56
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:99
DataSvc::objectLeaves
StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
Definition: DataSvc.cpp:181
VERMSG
#define VERMSG
Definition: DataSvc.cpp:54
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
IConverter::updateObjRefs
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
DataSvcHelpers::RegistryEntry
Definition: RegistryEntry.h:41
DataSvc::getDataLoader
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
Definition: DataSvc.cpp:849
IRegistry::object
virtual DataObject * object() const =0
Retrieve object behind the link.
DataSvc::linkObject
StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:683
DataSvcHelpers::RegistryEntry::add
StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
Definition: RegistryEntry.cpp:173
IRegistry::identifier
virtual const id_type & identifier() const =0
Full identifier (or key)
DataObject
Definition: DataObject.h:37
DataSvc::objectParent
StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
Definition: DataSvc.cpp:167
Service::reinitialize
StatusCode reinitialize() override
Definition: Service.cpp:296
DataSvc::registerObject
StatusCode registerObject(std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:276
DataSvcHelpers::RegistryEntry::identifier
const std::string & identifier() const override
Full identifier (or key)
Definition: RegistryEntry.h:122
IConverter::fillObjRefs
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
DataSvc::m_accessName
Gaudi::Property< std::string > m_accessName
Definition: DataSvc.h:66
IOTest.end
end
Definition: IOTest.py:125
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:100
DataSvc::m_rootCLID
Gaudi::Property< CLID > m_rootCLID
Definition: DataSvc.h:52
DataSvcHelpers::RegistryEntry::traverseTree
StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
Definition: RegistryEntry.cpp:256
DataSvc::m_enableAccessHdlr
Gaudi::Property< bool > m_enableAccessHdlr
Definition: DataSvc.h:64
DataSvc::updateObject
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:634
DataObject::registry
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:79
DataSvc::m_preLoads
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:69
DataSvc::registerAddress
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:198
DataObject::addRef
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:63
DataSvc::loadObject
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: DataSvc.cpp:443
DataSvcHelpers::RegistryEntry::parentEntry
RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:96
IConversionSvc
Definition: IConversionSvc.h:43