The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
DataSvc Class Reference

Data service base class. More...

#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.
 
const std::string & rootName () const override
 IDataManagerSvc: Accessor for root event name.
 
StatusCode registerAddress (std::string_view fullPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store.
 
StatusCode registerAddress (IRegistry *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store.
 
StatusCode unregisterAddress (std::string_view fullPath) override
 IDataManagerSvc: Unregister object address from the data store.
 
StatusCode unregisterAddress (IRegistry *pParent, std::string_view objPath) override
 IDataManagerSvc: Unregister object address from the data store.
 
StatusCode objectLeaves (const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
 
StatusCode objectLeaves (const IRegistry *pRegistry, std::vector< IRegistry * > &refLeaves) override
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
 
StatusCode objectParent (const DataObject *pObject, IRegistry *&refpParent) override
 IDataManagerSvc: Explore the object store: retrieve the object's parent.
 
StatusCode objectParent (const IRegistry *pRegistry, IRegistry *&refpParent) override
 IDataManagerSvc: Explore the object store: retrieve the object's parent.
 
StatusCode clearSubTree (std::string_view sub_tree_path) override
 IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name.
 
StatusCode clearSubTree (DataObject *pObject) override
 IDataManagerSvc: Remove all data objects below the sub tree identified by the object.
 
StatusCode clearStore () override
 IDataManagerSvc: Remove all data objects in the data store.
 
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.
 
StatusCode traverseSubTree (DataObject *pObject, IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects below the sub tree.
 
StatusCode traverseTree (IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects in the data store.
 
StatusCode setRoot (std::string root_name, DataObject *pRootObj) override
 Initialize data store for new event by giving new event path and root object.
 
virtual StatusCode i_setRoot (std::string root_name, DataObject *pRootObj)
 Initialize data store for new event by giving new event path and root object.
 
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.
 
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.
 
StatusCode setDataLoader (IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
 IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data provider.
 
StatusCode addPreLoadItem (const DataStoreItem &item) override
 Add an item to the preload list.
 
StatusCode removePreLoadItem (const DataStoreItem &item) override
 Remove an item from the preload list.
 
StatusCode resetPreLoad () override
 Clear the preload list.
 
virtual StatusCode preLoad (int depth, int load_depth, DataObject *pObject)
 Execute one level of preloading and recursively load until the final level is reached.
 
StatusCode preLoad () override
 load all preload items of the list
 
StatusCode registerObject (std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
 Register object with the data store.
 
StatusCode registerObject (DataObject *parentObj, std::string_view objPath, DataObject *pObject) override
 Register object with the data store.
 
StatusCode unregisterObject (std::string_view fullPath) override
 Unregister object from the data store.
 
StatusCode unregisterObject (DataObject *pObject) override
 Unregister object from the data store.
 
StatusCode unregisterObject (DataObject *pObject, std::string_view objectPath) override
 Unregister object from the data store.
 
StatusCode retrieveObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
 Retrieve object from data store.
 
StatusCode findObject (std::string_view fullPath, DataObject *&pObject) override
 Find object identified by its full path in the data store.
 
StatusCode findObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
 Find object identified by its full path in the data store.
 
StatusCode linkObject (IRegistry *from, std::string_view objPath, DataObject *to) override
 Add a link to another object.
 
StatusCode linkObject (std::string_view fullPath, DataObject *to) override
 Add a link to another object.
 
StatusCode unlinkObject (IRegistry *from, std::string_view objPath) override
 Remove a link to another object.
 
StatusCode unlinkObject (DataObject *fromObj, std::string_view objPath) override
 Remove a link to another object.
 
StatusCode unlinkObject (std::string_view fullPath) override
 Remove a link to another object.
 
StatusCode updateObject (IRegistry *pDirectory) override
 Update object identified by its directory entry.
 
StatusCode updateObject (DataObject *toUpdate) override
 Update object.
 
StatusCode initialize () override
 Service initialization.
 
StatusCode reinitialize () override
 Service initialization.
 
StatusCode finalize () override
 Service initialization.
 
 DataSvc (const DataSvc &)=delete
 copy constructor disabled
 
DataSvcoperator= (const DataSvc &)=delete
 Fake assignment operator (never implemented).
 
StatusCode registerAddress (DataObject *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress)
 Register object address with the data store.
 
StatusCode unregisterAddress (DataObject *pParent, std::string_view objPath)
 Unregister object address from the data store.
 
StatusCode registerObject (std::string_view fullPath, DataObject *pObject)
 Register object with the data store.
 
StatusCode registerObject (std::string_view parentPath, int item, DataObject *pObject)
 Register object with the data store.
 
StatusCode registerObject (DataObject *parentObj, int item, DataObject *pObject)
 Register object with the data store.
 
StatusCode retrieveObject (std::string_view fullPath, DataObject *&pObject)
 Retrieve object identified by its full path from the data store.
 
StatusCode retrieveObject (std::string_view parentPath, std::string_view objectPath, DataObject *&pObject)
 Retrieve object from data store.
 
StatusCode retrieveObject (std::string_view parentPath, int item, DataObject *&pObject)
 Retrieve object from data store.
 
StatusCode retrieveObject (DataObject *parentObj, std::string_view objectPath, DataObject *&pObject)
 Retrieve object from data store.
 
StatusCode retrieveObject (DataObject *parentObj, int item, DataObject *&pObject)
 Retrieve object from data store.
 
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.
 
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.
 
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.
 
StatusCode findObject (DataObject *parentObj, int item, DataObject *&pObject)
 Find object identified by its parent object and an integer identifier in the data store.
 
StatusCode linkObject (std::string_view fromPath, std::string_view objPath, DataObject *toObj)
 Add a link to another object.
 
StatusCode linkObject (DataObject *fromObj, std::string_view objPath, DataObject *toObj)
 Add a link to another object.
 
StatusCode unlinkObject (std::string_view fromPath, std::string_view objPath)
 Remove a link to another object.
 
- Public Member Functions inherited from extends< Service, IDataProviderSvc, IDataManagerSvc >
void const * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast.
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface.
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames.
 
- Public Member Functions inherited from Service
const std::string & name () const override
 Retrieve name of the service.
 
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.
 
StatusCode sysStart () override
 Initialize Service.
 
StatusCode sysStop () override
 Initialize Service.
 
StatusCode sysFinalize () override
 Finalize Service.
 
StatusCode sysReinitialize () override
 Re-initialize the Service.
 
StatusCode sysRestart () override
 Re-initialize the Service.
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor.
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator.
 
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.
 
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.
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property.
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property.
 
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.
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property.
 
StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p) override
 set the property from another property with a different name
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property
 
const Gaudi::Details::PropertyBasegetProperty (std::string_view name) const override
 get the property by name
 
StatusCode getProperty (std::string_view n, std::string &v) const override
 convert the property to the string
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties
 
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name.
 
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected
 
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)
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor.
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream.
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS)
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL)
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING)
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO)
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG)
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO)
 

Protected Member Functions

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

Protected Attributes

SmartIF< IIncidentSvcm_incidentSvc = nullptr
 Pointer to incident service.
 
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.
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state.
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state.
 
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools
 
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.
 

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.
 
Gaudi::Property< bool > m_forceLeaves
 
Gaudi::Property< std::vector< std::string > > m_inhibitPathes { this, "InhibitPaths", {}, "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.
 

Additional Inherited Members

- Public Types inherited from extends< Service, IDataProviderSvc, IDataManagerSvc >
using base_class
 Typedef to this class.
 
using extend_interfaces_base
 Typedef to the base of this class.
 
- 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
 Typedef used to refer to this class from derived classes, as in.
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids
 take union of the ext_iids of all Interfaces...
 

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}
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition DataSvc.h:69
constexpr static const auto SUCCESS
Definition StatusCode.h:99
AttribStringParser::Iterator begin(const AttribStringParser &parser)

◆ checkRoot()

bool DataSvc::checkRoot ( )
inlineprotected

Check if root path is valid.

Definition at line 255 of file DataSvc.h.

255{ return 0 != m_root; }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition DataSvc.h:73

◆ 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();
88}
bool checkRoot()
Check if root path is valid.
Definition DataSvc.h:255

◆ 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 );
82}
DataSvcHelpers::RegistryEntry RegEntry
Definition DataSvc.cpp:48
#define CAST_REGENTRY(x, y)
Definition DataSvc.cpp:46
IRegistry * registry() const
Get pointer to Registry.
Definition DataObject.h:79
RegistryEntry * parentEntry()
Pointer to parent registry entry.
StatusCode remove(std::string_view name)
Remove an entry from the store.

◆ 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 );
69}
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition DataSvc.cpp:623
bool isSuccess() const
Definition StatusCode.h:314

◆ 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();
832 clearStore().ignore();
833 m_incidentSvc.reset();
834 return Service::finalize();
835}
StatusCode resetPreLoad() override
Clear the preload list.
Definition DataSvc.cpp:762
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
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition DataSvc.h:50
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition DataSvc.cpp:85
StatusCode finalize() override
Definition Service.cpp:223
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition StatusCode.h:139

◆ findObject() [1/6]

StatusCode IDataProviderSvc::findObject ( DataObject * parentObj,
int item,
DataObject *& pObject )
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/6]

StatusCode IDataProviderSvc::findObject ( DataObject * parentObj,
std::string_view objectPath,
DataObject *& pObject )
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/6]

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}
IRegistry * find(const IRegistry *obj) const
Try to find an object identified by its pointer.
virtual DataObject * object() const =0
Retrieve object behind the link.
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram

◆ findObject() [4/6]

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}
Gaudi::Property< std::string > m_rootName
Definition DataSvc.h:53

◆ findObject() [5/6]

StatusCode IDataProviderSvc::findObject ( std::string_view parentPath,
int item,
DataObject *& pObject )
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() [6/6]

StatusCode IDataProviderSvc::findObject ( std::string_view parentPath,
std::string_view objectPath,
DataObject *& pObject )
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(); }
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
Definition DataSvc.h:46

◆ 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}
DataObject * i_handleDataFault(IRegistry *pReg, std::string_view path=std::string_view{})
Definition DataSvc.cpp:412

◆ 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}
ContextIncident< std::string > DataIncident
Specific incident type used by the data-on-demand-service.
constexpr char SEPARATOR
Gaudi::Property< bool > m_enableFaultHdlr
Definition DataSvc.h:60
Gaudi::Property< std::string > m_faultName
Definition DataSvc.h:62
virtual const id_type & identifier() const =0
Full identifier (or key)
const std::string & name() const override
Retrieve name of the service.
Definition Service.cpp:333

◆ 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}
bool isSoft() const
Is the link soft or hard.
RegistryEntry * findLeaf(std::string_view path) const
Find identified leaf in this registry node.
DataObject * object() const override
Retrive object behind the link.
Gaudi::Property< bool > m_enableAccessHdlr
Definition DataSvc.h:64
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, std::string_view path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition DataSvc.cpp:515
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition DataSvc.cpp:443

◆ 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
797 StatusCode sc = Service::initialize();
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}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
SmartIF< IFace > service(const std::string &name, bool createIf=true) const
Definition Service.h:79
StatusCode initialize() override
Definition Service.cpp:118

◆ linkObject() [1/4]

StatusCode IDataProviderSvc::linkObject ( DataObject * fromObj,
std::string_view objPath,
DataObject * toObj )
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}
StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *to) override
Add a link to another object.
Definition DataSvc.cpp:683

◆ linkObject() [2/4]

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}
StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition DataSvc.cpp:601

◆ linkObject() [3/4]

StatusCode IDataProviderSvc::linkObject ( std::string_view fromPath,
std::string_view objPath,
DataObject * toObj )
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() [4/4]

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}

◆ 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}
#define ON_VERBOSE
#define VERMSG
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
void setObject(DataObject *obj)
Set/Update object address.
DataObject * handleDataFault(IRegistry *pReg, std::string_view path="")
Invoke data fault handling if enabled.
Definition DataSvc.cpp:408
Gaudi::Property< std::vector< std::string > > m_inhibitPathes
Definition DataSvc.h:58
Gaudi::Property< std::string > m_accessName
Definition DataSvc.h:66
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
constexpr static const auto FAILURE
Definition StatusCode.h:100
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition System.cpp:260

◆ 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}
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
Definition DataSvc.cpp:849

◆ 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}
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

◆ 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}
const Store & leaves() const
Access the leaves of the object.

◆ 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}
StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
Definition DataSvc.cpp:167

◆ 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}
IRegistry * parent() const
Pointer to parent directory entry.

◆ 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}
StatusCode preLoad() override
load all preload items of the list
Definition DataSvc.cpp:784

◆ 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/3]

StatusCode IDataManagerSvc::registerAddress ( DataObject * parentObj,
std::string_view objectPath,
IOpaqueAddress * pAddress )
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 }
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition DataSvc.cpp:198

◆ registerAddress() [2/3]

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 ) {
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}
const std::string & identifier() const override
Full identifier (or key)
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition DataSvc.cpp:844
StatusCode registerObject(std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
Register object with the data store.
Definition DataSvc.cpp:276
Gaudi::Property< bool > m_forceLeaves
Definition DataSvc.h:56
bool isFailure() const
Definition StatusCode.h:129

◆ registerAddress() [3/3]

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}

◆ registerObject() [1/5]

StatusCode IDataProviderSvc::registerObject ( DataObject * parentObj,
int item,
DataObject * pObject )
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/5]

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 ) {
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 ) {
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}
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition DataObject.h:77
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
IOpaqueAddress * address() const override
Retrieve opaque storage address.

◆ registerObject() [3/5]

StatusCode IDataProviderSvc::registerObject ( std::string_view fullPath,
DataObject * pObject )
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() [4/5]

StatusCode IDataProviderSvc::registerObject ( std::string_view parentPath,
int item,
DataObject * pObject )
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() [5/5]

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}
virtual unsigned long release()
release reference to object

◆ 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();
809 clearStore().ignore();
810 m_incidentSvc.reset();
811 // re-initialize the base class
812 StatusCode sc = Service::reinitialize();
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}
StatusCode reinitialize() override
Definition Service.cpp:296

◆ 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/6]

StatusCode IDataProviderSvc::retrieveObject ( DataObject * parentObj,
int item,
DataObject *& pObject )
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/6]

StatusCode IDataProviderSvc::retrieveObject ( DataObject * parentObj,
std::string_view objectPath,
DataObject *& pObject )
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/6]

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/6]

StatusCode IDataProviderSvc::retrieveObject ( std::string_view fullPath,
DataObject *& pObject )
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() [5/6]

StatusCode IDataProviderSvc::retrieveObject ( std::string_view parentPath,
int item,
DataObject *& pObject )
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() [6/6]

StatusCode IDataProviderSvc::retrieveObject ( std::string_view parentPath,
std::string_view objectPath,
DataObject *& pObject )
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; }
unsigned int CLID
Class ID definition.
Definition ClassID.h:16
Gaudi::Property< CLID > m_rootCLID
Definition DataSvc.h:52

◆ 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

Definition at line 115 of file DataSvc.cpp.

115 {
116 clearStore().ignore();
117 return i_setRoot( std::move( root_path ), pRootObj );
118}
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

◆ 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}
StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree

◆ 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}
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

◆ 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/4]

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}
StatusCode unlinkObject(IRegistry *from, std::string_view objPath) override
Remove a link to another object.
Definition DataSvc.cpp:714

◆ unlinkObject() [2/4]

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() [3/4]

StatusCode IDataProviderSvc::unlinkObject ( std::string_view fromPath,
std::string_view objPath )
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() [4/4]

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}

◆ unregisterAddress() [1/3]

StatusCode IDataManagerSvc::unregisterAddress ( DataObject * pParent,
std::string_view objPath )
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 }
StatusCode unregisterAddress(std::string_view fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition DataSvc.cpp:241

◆ unregisterAddress() [2/3]

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/3]

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}

◆ 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}
virtual unsigned long addRef()
Add reference to object.
bool isEmpty() const
Simple check if the Container is empty.

◆ 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}
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
virtual const name_type & name() const =0
Name of the directory (or key)
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.

◆ 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}
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition DataSvc.cpp:634

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.

66{ this, "DataAccessName", "DataAccess", "Name of the data access incident" };

◆ 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.

64 { this, "EnableAccessHandler", false,
65 "enable incidents on data access requests" };

◆ 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.

60 { this, "EnableFaultHandler", false,
61 "enable incidents on data creation requests" };

◆ 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.

62{ this, "DataFaultName", "DataFault", "Name of the data fault incident" };

◆ 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.

56 { this, "ForceLeaves", false,
57 "force creation of default leaves on registerObject" };

◆ 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, "InhibitPaths", {}, "inhibited leaves" }
private

Definition at line 58 of file DataSvc.h.

58{ this, "InhibitPaths", {}, "inhibited leaves" };

◆ 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.

52{ this, "RootCLID", 110 /*CLID_Event*/, "CLID of root entry" };

◆ 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.

53{ this, "RootName", "/Event", "name of root entry" };

The documentation for this class was generated from the following files: