The Gaudi Framework  v32r2 (46d42edc)
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. More...
 
const std::stringrootName () 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 * 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::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
- Public Member Functions inherited from Service
const std::stringname () 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...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
 Declare used tool. More...
 
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, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular 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...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &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 (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
 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...
 
MSG::Level outputLevel () const
 Backward compatibility function for getting the output level. More...
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) 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
 ~Service () override
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBaseproperty (const std::string &name) const
 
- 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::stringm_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"}
 
Gaudi::Property< bool > m_auditInit {this, "AuditServices", false, " unused"}
 
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()"}
 
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 {this, "ForceLeaves", false, "force creation of default leaves on registerObject"}
 
Gaudi::Property< std::vector< std::string > > m_inhibitPathes {this, "InhibitPathes", {}, "inhibited leaves"}
 
Gaudi::Property< bool > m_enableFaultHdlr
 
Gaudi::Property< std::stringm_faultName {this, "DataFaultName", "DataFault", "Name of the data fault incident"}
 
Gaudi::Property< bool > m_enableAccessHdlr
 
Gaudi::Property< std::stringm_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 42 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 766 of file DataSvc.cpp.

766  {
767  auto i = std::find( begin( m_preLoads ), end( m_preLoads ), item );
768  if ( i == end( m_preLoads ) ) m_preLoads.push_back( item );
769  return StatusCode::SUCCESS;
770 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T push_back(T... args)
def end
Definition: IOTest.py:113
T find(T... args)
AttribStringParser::Iterator begin(const AttribStringParser &parser)
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:67

◆ checkRoot()

bool DataSvc::checkRoot ( )
inlineprotected

Check if root path is valid.

Definition at line 253 of file DataSvc.h.

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

◆ clearStore()

StatusCode DataSvc::clearStore ( )
override

IDataManagerSvc: Remove all data objects in the data store.

Definition at line 101 of file DataSvc.cpp.

101  {
102  if ( !checkRoot() ) return Status::INVALID_ROOT;
103  m_root.reset();
104  return StatusCode::SUCCESS;
105 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
T reset(T... args)

◆ clearSubTree() [1/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 75 of file DataSvc.cpp.

75  {
76  DataObject* pObject = nullptr;
77  StatusCode status = findObject( sub_tree_path, pObject );
78  if ( !status.isSuccess() ) return status;
79  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
80  if ( !node_entry ) return Status::INVALID_OBJECT;
81  RegEntry* parent = node_entry->parentEntry();
82  if ( !parent ) return Status::INVALID_PARENT;
83  parent->remove( node_entry );
84  return StatusCode::SUCCESS;
85 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode remove(std::string_view name)
Remove an entry from the store.
bool isSuccess() const
Definition: StatusCode.h:267
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:91
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:640
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

◆ clearSubTree() [2/2]

StatusCode DataSvc::clearSubTree ( DataObject pObject)
override

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

Definition at line 90 of file DataSvc.cpp.

90  {
91  if ( !checkRoot() ) return Status::INVALID_ROOT;
92  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
93  if ( !entry ) return Status::INVALID_OBJECT;
94  RegEntry* parent = entry->parentEntry();
95  if ( !parent ) return Status::INVALID_PARENT;
96  parent->remove( entry );
97  return StatusCode::SUCCESS;
98 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
StatusCode remove(std::string_view name)
Remove an entry from the store.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:91

◆ createDefaultObject()

DataObject * DataSvc::createDefaultObject ( ) const
protectedvirtual

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

Definition at line 861 of file DataSvc.cpp.

861 { return new DataObject(); }

◆ finalize()

StatusCode DataSvc::finalize ( )
override

Service initialization.

Service initialisation.

Definition at line 845 of file DataSvc.cpp.

845  {
846  // Nothing to do: just call base class initialisation
847  setDataLoader( nullptr ).ignore();
848  resetPreLoad().ignore();
849  clearStore().ignore();
851  return Service::finalize();
852 }
StatusCode finalize() override
Definition: Service.cpp:164
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:177
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:49
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:86
StatusCode resetPreLoad() override
Clear the preload list.
Definition: DataSvc.cpp:779
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:101

◆ findObject() [1/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() [2/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() [3/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 324 of file IDataProviderSvc.h.

324  {
325  DataObject* parent = nullptr;
326  StatusCode status = findObject( parentPath, parent );
327  return status.isSuccess() ? findObject( parent, objectPath, pObject ) : status;
328  }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:640
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

◆ findObject() [4/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 338 of file IDataProviderSvc.h.

338  {
339  return findObject( parentPath, itemToPath( item ), pObject );
340  }
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:640

◆ findObject() [5/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 351 of file IDataProviderSvc.h.

351  {
352  return findObject( parentObj ? parentObj->registry() : nullptr, objectPath, pObject );
353  }
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:640

◆ findObject() [6/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 363 of file IDataProviderSvc.h.

363  {
364  return findObject( parentObj, itemToPath( item ), pObject );
365  }
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:640

◆ findObject() [7/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 640 of file DataSvc.cpp.

640  {
641  pObject = nullptr;
642  if ( !checkRoot() ) return Status::INVALID_ROOT;
643  if ( path.empty() || path == m_rootName.value() ) {
644  pObject = m_root->object();
645  return !pObject ? Status::OBJ_NOT_LOADED : Status::IDataProviderSvc_NO_ERROR;
646  }
647  return findObject( path.front() != SEPARATOR ? m_root.get() : nullptr, path, pObject );
648 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
constexpr char SEPARATOR
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:52
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
T get(T... args)
DataObject * object() const override
Retrive object behind the link.
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:640

◆ findObject() [8/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 627 of file DataSvc.cpp.

627  {
628  pObject = nullptr;
629  IRegistry* pReg = ( pRegistry ? pRegistry : m_root.get() );
630  RegEntry* root_entry = CAST_REGENTRY( RegEntry*, pReg );
631  if ( root_entry ) {
632  if ( !path.empty() ) pReg = root_entry->find( path );
633  if ( !pReg ) return Status::INVALID_OBJ_PATH;
634  pObject = pReg->object();
635  }
636  return ( !pObject ) ? Status::OBJ_NOT_LOADED : Status::IDataProviderSvc_NO_ERROR;
637 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
IRegistry * find(const IRegistry *obj) const
Try to find an object identified by its pointer.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual DataObject * object() const =0
Retrieve object behind the link.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
T get(T... args)

◆ getDataLoader()

IConversionSvc * DataSvc::getDataLoader ( IRegistry pReg)
protectedvirtual

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

Reimplemented in NTupleSvc.

Definition at line 866 of file DataSvc.cpp.

866 { return m_dataLoader.get(); }
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
Definition: DataSvc.h:45

◆ 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 425 of file DataSvc.cpp.

425  {
426  return i_handleDataFault( pReg, path );
427 }
DataObject * i_handleDataFault(IRegistry *pReg, std::string_view path=std::string_view{})
Definition: DataSvc.cpp:429

◆ i_handleDataFault()

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

Definition at line 429 of file DataSvc.cpp.

429  {
430  if ( m_enableFaultHdlr ) {
431  IRegistry* pLeaf = nullptr;
432  if ( pReg && path.empty() ) {
433  DataIncident incident( name(), m_faultName, pReg->identifier() );
434  m_incidentSvc->fireIncident( incident );
435  return pReg->object();
436  }
437  if ( pReg ) {
438  std::string p = pReg->identifier();
439  if ( path.front() != SEPARATOR ) p += SEPARATOR;
440  p.append( path.data(), path.size() );
441  DataIncident incident( name(), m_faultName, p );
442  m_incidentSvc->fireIncident( incident );
443  pLeaf = m_root->findLeaf( p );
444  } else {
446  if ( path.front() != SEPARATOR ) p += SEPARATOR;
447  p.append( path.data(), path.size() );
448  DataIncident incident( name(), m_faultName, p );
449  m_incidentSvc->fireIncident( incident );
450  pLeaf = m_root->findLeaf( p );
451  }
452  if ( pLeaf ) { return pLeaf->object(); }
453  }
454  return nullptr;
455 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
constexpr char SEPARATOR
RegistryEntry * findLeaf(std::string_view path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
Gaudi::Property< bool > m_enableFaultHdlr
Definition: DataSvc.h:58
STL class.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
Gaudi::Property< std::string > m_faultName
Definition: DataSvc.h:60
T append(T... args)
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:49
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
const std::string & identifier() const override
Full identifier (or key)
virtual DataObject * object() const =0
Retrieve object behind the link.
virtual const id_type & identifier() const =0
Full identifier (or key)
Data service incident class.

◆ i_retrieveEntry()

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

Definition at line 532 of file DataSvc.cpp.

532  {
533  // A.Valassi 16.08.2001 avoid core dump if store is empty
534  if ( !checkRoot() ) return StatusCode( Status::INVALID_ROOT, true );
535 
536  static constexpr auto empty = std::string_view{};
537  auto sep = find( path, SEPARATOR, 1 );
538  pEntry = nullptr;
539 
540  if ( !parentObj ) {
541  if ( path.empty() || path == m_rootName.value() ) {
542  parentObj = m_root.get();
543  path = empty;
544  } else if ( path.front() != SEPARATOR ) {
545  parentObj = m_root.get();
546  } else if ( sep != std::string_view::npos ) {
547  if ( !m_root->object() ) {
548  RegEntry* r = nullptr;
549  auto status = i_retrieveEntry( m_root.get(), empty, r );
550  if ( !status.isSuccess() ) return status;
551  }
552  parentObj = m_root.get();
553  path = path.substr( sep );
554  } else {
555  return Status::INVALID_OBJ_PATH;
556  }
557  sep = find( path, SEPARATOR, 1 );
558  }
559 
560  StatusCode status = StatusCode( Status::INVALID_ROOT, true );
561  if ( sep != std::string_view::npos ) { // the string contains a separator (after pos 0)
562  if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
563  status = loadObject( parentObj );
564  if ( !status.isSuccess() ) return status;
565  }
566  auto p_path = path.substr( 0, sep );
567  RegEntry* root_entry = parentObj->findLeaf( p_path );
568  if ( !root_entry && m_enableFaultHdlr ) {
569  // If not even the parent is there, an incident
570  // to load the parent must be fired...
571  i_handleDataFault( parentObj, p_path );
572  root_entry = parentObj->findLeaf( p_path );
573  }
574  if ( root_entry ) {
575  DataObject* pO = root_entry->object();
576  if ( !pO ) {
577  // Object is not loaded: load the object if at all possible
578  status = loadObject( root_entry );
579  if ( !status.isSuccess() ) return status;
580  }
581  if ( root_entry->isSoft() ) { root_entry = CAST_REGENTRY( RegEntry*, pO->registry() ); }
582  return i_retrieveEntry( root_entry, path.substr( sep ), pEntry );
583  }
584  return status;
585  } else if ( path.empty() ) {
586  pEntry = parentObj;
587  } else {
588  if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
589  status = loadObject( parentObj );
590  if ( !status.isSuccess() ) return status;
591  }
592  // last leave in search: find leaf and load
593  pEntry = parentObj->findLeaf( path );
594  // If no registry entry was found, trigger incident for action-on-demand
595  if ( !pEntry && m_enableFaultHdlr ) {
596  i_handleDataFault( parentObj, path );
597  pEntry = ( path.empty() ? parentObj : parentObj->findLeaf( path ) );
598  }
599  }
600 
601  // Check results and return
602  if ( !pEntry ) return Status::INVALID_OBJ_PATH;
603  if ( !pEntry->object() ) return loadObject( pEntry );
604 
605  if ( m_enableAccessHdlr ) {
606  // Fire data access incident
607  // I do not know if this is a good idea....
608  // This fires too often!
609  //
610  // DataIncident incident(name(), m_accessName, pEntry->identifier());
611  // m_incidentSvc->fireIncident(incident);
612  return StatusCode::SUCCESS;
613  }
614  return StatusCode::SUCCESS;
615 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
constexpr char SEPARATOR
RegistryEntry * findLeaf(std::string_view path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:52
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: DataSvc.cpp:460
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
Gaudi::Property< bool > m_enableFaultHdlr
Definition: DataSvc.h:58
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
DataObject * i_handleDataFault(IRegistry *pReg, std::string_view path=std::string_view{})
Definition: DataSvc.cpp:429
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, std::string_view path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:532
bool isSuccess() const
Definition: StatusCode.h:267
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
T get(T... args)
T find(T... args)
DataObject * object() const override
Retrive object behind the link.
Gaudi::Property< bool > m_enableAccessHdlr
Definition: DataSvc.h:62
bool isSoft() const
Is the link soft or hard.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

◆ 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 142 of file DataSvc.cpp.

142  {
143  if ( pRootObj ) {
144  m_root = std::make_unique<RegEntry>( std::move( root_path ) );
145  m_root->makeHard( pRootObj );
146  m_root->setDataSvc( this );
147  // No done with GaudiHive. preLoad().ignore();
148  }
149  return StatusCode::SUCCESS;
150 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:89
T move(T... args)
void makeHard(DataObject *pObject)
Initialize link as hard link.

◆ 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 166 of file DataSvc.cpp.

166  {
167  if ( pRootAddr ) {
168  m_root = std::make_unique<RegEntry>( std::move( root_path ) );
169  m_root->makeHard( pRootAddr );
170  m_root->setDataSvc( this );
171  // Not done with GaudiHive. preLoad().ignore();
172  }
173  return StatusCode::SUCCESS;
174 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:89
T move(T... args)
void makeHard(DataObject *pObject)
Initialize link as hard link.

◆ initialize()

StatusCode DataSvc::initialize ( )
override

Service initialization.

Definition at line 812 of file DataSvc.cpp.

812  {
813  // Nothing to do: just call base class initialisation
815  if ( UNLIKELY( !sc.isSuccess() ) ) return sc;
816  m_incidentSvc = service( "IncidentSvc", true );
817  if ( UNLIKELY( !m_incidentSvc ) ) { error() << "Failed to access incident service." << endmsg; }
818  return sc;
819 }
#define UNLIKELY(x)
Definition: Kernel.h:96
StatusCode initialize() override
Definition: Service.cpp:60
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:49
bool isSuccess() const
Definition: StatusCode.h:267
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:83
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

◆ 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
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 479 of file IDataProviderSvc.h.

479  {
480  DataObject* pO = nullptr;
481  StatusCode status = retrieveObject( fromPath, pO );
482  return status.isSuccess() ? linkObject( pO->registry(), objPath, toObj ) : status;
483  }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:700
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:618

◆ linkObject() [2/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() [3/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 580 of file IDataProviderSvc.h.

580  {
581  if ( fromObj ) {
582  IRegistry* from_entry = fromObj->registry();
583  if ( from_entry ) return linkObject( from_entry, objPath, toObj );
584  }
585  return Status::INVALID_PARENT;
586 }
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:700

◆ linkObject() [4/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.

◆ linkObject() [5/6]

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

Add a link to another object.

Definition at line 700 of file DataSvc.cpp.

700  {
701  if ( !checkRoot() ) return Status::INVALID_ROOT;
702  try {
703  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
704  if ( from_entry ) {
705  // First check if both objects are already registered to the store
706  RegEntry* to_entry = m_root->findLeaf( to );
707  if ( !to_entry ) return Status::INVALID_OBJECT;
708  auto sep = objPath.rfind( SEPARATOR );
709  if ( sep > 0 && sep != std::string_view::npos ) { // in case the objPath is a sub-directory itself
710  DataObject* pO = nullptr;
711  StatusCode sc = retrieveObject( from, objPath.substr( 0, sep ), pO );
712  return sc.isSuccess() ? linkObject( pO->registry(), objPath.substr( sep ), to ) : sc;
713  }
714  // Now register the soft link
715  StatusCode status = from_entry->add( to_string( objPath ), to, true );
716  return status.isSuccess() ? Status::IDataProviderSvc_NO_ERROR : Status::DOUBL_OBJ_PATH;
717  }
718  } catch ( ... ) {}
719  return Status::INVALID_PARENT;
720 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
constexpr char SEPARATOR
T to_string(T... args)
RegistryEntry * findLeaf(std::string_view path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:700
StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:618

◆ linkObject() [6/6]

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

Add a link to another object.

Definition at line 723 of file DataSvc.cpp.

723  {
724  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
725  if ( fullPath.front() != SEPARATOR ) { return linkObject( m_rootName.value(), fullPath, to ); }
726  auto sep = fullPath.rfind( SEPARATOR );
727  return linkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ), to );
728 }
constexpr char SEPARATOR
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:52
StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:700

◆ loadObject() [1/2]

StatusCode DataSvc::loadObject ( IRegistry pNode)
protectedvirtual

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

Definition at line 460 of file DataSvc.cpp.

460  {
461  IConversionSvc* pLoader = getDataLoader( pRegistry );
462  return loadObject( pLoader, pRegistry );
463 }
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: DataSvc.cpp:460
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
Definition: DataSvc.cpp:866

◆ loadObject() [2/2]

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

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

Definition at line 468 of file DataSvc.cpp.

468  {
469  StatusCode status = Status::INVALID_OBJ_ADDR;
470  DataObject* pObject = nullptr;
471  if ( !pLoader ) { // Precondition: Data loader must be present
472  return handleDataFault( pRegistry ) ? StatusCode::SUCCESS : StatusCode( Status::NO_DATA_LOADER );
473  }
474  if ( !pRegistry ) { // Precondition: Directory must be valid
475  return handleDataFault( pRegistry ) ? StatusCode::SUCCESS : StatusCode( Status::INVALID_OBJ_ADDR );
476  }
477 
478  VERMSG << "Requested object " << pRegistry->identifier() << endmsg;
479 
480  if ( m_enableAccessHdlr ) {
481  // Fire data access incident
482  DataIncident incident( name(), m_accessName, pRegistry->identifier() );
483  m_incidentSvc->fireIncident( incident );
484  }
485  if ( !m_inhibitPathes.empty() ) {
486  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), pRegistry->identifier() );
487  if ( inhibit != m_inhibitPathes.end() ) { return Status::NO_ACCESS; }
488  }
489  IOpaqueAddress* pAddress = pRegistry->address();
490  if ( !pAddress ) { // Precondition:
491  return Status::INVALID_OBJ_ADDR; // Address must be valid
492  }
493  try {
494  status = pLoader->createObj( pAddress, pObject ); // Call data loader
495  if ( status.isSuccess() ) {
496 
497  VERMSG << "Object " << pRegistry->identifier() << " created" << endmsg;
498 
499  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pRegistry );
500  pEntry->setObject( pObject );
501 
502  VERMSG << "Filling object " << pRegistry->identifier() << endmsg;
503  status = pLoader->fillObjRefs( pAddress, pObject );
504  }
505  } catch ( const GaudiException& exc ) {
506  if ( handleDataFault( pRegistry ) ) { return StatusCode::SUCCESS; }
507  throw GaudiException( "GaudiException in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE,
508  exc );
509  } catch ( const std::exception& x ) {
510  if ( handleDataFault( pRegistry ) ) { return StatusCode::SUCCESS; }
511  throw GaudiException( "std::exception in loadObject() " + pRegistry->identifier() + ": " +
512  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
514  } catch ( ... ) {
515  if ( handleDataFault( pRegistry ) ) { return StatusCode::SUCCESS; }
516  throw GaudiException( "UNKN exception in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE );
517  }
518  if ( !status.isSuccess() ) {
519  if ( handleDataFault( pRegistry ) ) { return StatusCode::SUCCESS; }
520  }
521  ON_VERBOSE if ( status.isSuccess() ) {
522  verbose() << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
523  }
524  return status;
525 }
#define VERMSG
Definition: DataSvc.cpp:70
Define general base for Gaudi exception.
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
Gaudi::Property< std::string > m_accessName
Definition: DataSvc.h:64
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
DataObject * handleDataFault(IRegistry *pReg, std::string_view path="")
Invoke data fault handling if enabled.
Definition: DataSvc.cpp:425
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
void setObject(DataObject *obj)
Set/Update object address.
T what(T... args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:49
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
bool isSuccess() const
Definition: StatusCode.h:267
STL class.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
Gaudi::Property< std::vector< std::string > > m_inhibitPathes
Definition: DataSvc.h:56
T find(T... args)
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
constexpr static const auto FAILURE
Definition: StatusCode.h:86
Gaudi::Property< bool > m_enableAccessHdlr
Definition: DataSvc.h:62
Data service incident class.
Opaque address interface definition.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
#define ON_VERBOSE
Definition: DataSvc.cpp:67
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

◆ 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 198 of file DataSvc.cpp.

198  {
199  if ( !pObject ) return Status::INVALID_OBJECT;
200  return objectLeaves( pObject->registry(), leaves );
201 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
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:198

◆ 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 206 of file DataSvc.cpp.

206  {
207  if ( !checkRoot() ) return Status::INVALID_ROOT;
208  const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
209  if ( !node_entry ) return Status::INVALID_OBJECT;
210  leaves = node_entry->leaves();
211  return StatusCode::SUCCESS;
212 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
const Store & leaves() const
Access the leaves of the object.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36

◆ 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 184 of file DataSvc.cpp.

184  {
185  if ( !pObject ) return Status::INVALID_OBJECT;
186  return objectParent( pObject->registry(), refpParent );
187 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
Definition: DataSvc.cpp:184

◆ 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 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  refpParent = node_entry->parent();
194  return StatusCode::SUCCESS;
195 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
IRegistry * parent() const
Pointer to parent directory entry.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36

◆ operator=()

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

Fake assignment operator (never implemented).

◆ preLoad() [1/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 785 of file DataSvc.cpp.

785  {
786  // unused: StatusCode sc = StatusCode::FAILURE;
787  if ( pObject && depth++ < load_depth ) {
788  RegEntry* dir = CAST_REGENTRY( RegEntry*, pObject->registry() );
789  if ( dir ) {
790  for ( const auto& i : *dir ) {
791  DataObject* pObj = nullptr;
792  StatusCode status = retrieveObject( pObject, i->name(), pObj );
793  if ( status.isSuccess() && depth < load_depth ) { preLoad( depth, load_depth, pObj ).ignore(); }
794  }
795  }
796  }
797  return StatusCode::SUCCESS;
798 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
StatusCode preLoad() override
load all preload items of the list
Definition: DataSvc.cpp:801
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:618

◆ preLoad() [2/2]

StatusCode DataSvc::preLoad ( )
override

load all preload items of the list

Definition at line 801 of file DataSvc.cpp.

801  {
802  DataObject* pObj = nullptr;
803  for ( const auto& i : m_preLoads ) {
804  StatusCode sc = retrieveObject( i.path(), pObj );
805  int load_depth = i.depth();
806  if ( sc.isSuccess() && load_depth > 1 ) { preLoad( 1, load_depth, pObj ).ignore(); }
807  }
808  return StatusCode::SUCCESS;
809 }
StatusCode preLoad() override
load all preload items of the list
Definition: DataSvc.cpp:801
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:618
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:67

◆ registerAddress() [1/5]

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

IDataManagerSvc: Register object address with the data store.

Definition at line 215 of file DataSvc.cpp.

215  {
216  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
217  return registerAddress( fullPath.front() != SEPARATOR ? m_root.get() : nullptr, fullPath, pAddress );
218 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
constexpr char SEPARATOR
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:215
T get(T... args)

◆ registerAddress() [2/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.

◆ registerAddress() [3/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 205 of file IDataManagerSvc.h.

205  {
206  return registerAddress( parentObj ? parentObj->registry() : nullptr, objectPath, pAddress );
207  }
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:215

◆ registerAddress() [4/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() [5/5]

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

IDataManagerSvc: Register object address with the data store.

Definition at line 221 of file DataSvc.cpp.

221  {
222  if ( !checkRoot() ) return Status::INVALID_ROOT;
223  if ( objPath.empty() ) return Status::INVALID_OBJ_PATH;
224 
225  if ( !parentObj ) {
226  if ( objPath.front() != SEPARATOR ) { return registerAddress( m_root.get(), objPath, pAddress ); }
227  auto sep = find( objPath, SEPARATOR, 1 );
228  if ( sep == std::string_view::npos || objPath.substr( 0, sep ) != m_rootName.value() ) {
229  return Status::INVALID_PARENT;
230  }
231  return registerAddress( m_root.get(), objPath.substr( sep ), pAddress );
232  }
233  if ( objPath.front() != SEPARATOR ) { return registerAddress( parentObj, char( SEPARATOR ) + objPath, pAddress ); }
234  RegEntry* par_entry = CAST_REGENTRY( RegEntry*, parentObj );
235  if ( !par_entry ) return Status::INVALID_PARENT;
236 
237  auto sep = objPath.rfind( SEPARATOR );
238  if ( sep > 0 && sep != std::string_view::npos ) {
239  auto p_path = objPath.substr( 0, sep );
240  auto o_path = objPath.substr( sep );
241  RegEntry* p_entry = par_entry->findLeaf( p_path );
242  // Create default object leafs if the
243  // intermediate nodes are not present
244  if ( !p_entry && m_forceLeaves ) {
245  DataObject* pLeaf = createDefaultObject();
246  StatusCode sc = registerObject( par_entry->identifier(), p_path, pLeaf );
247  if ( sc.isFailure() ) delete pLeaf;
248  p_entry = par_entry->findLeaf( p_path );
249  }
250  if ( !p_entry ) return Status::INVALID_PARENT;
251  return registerAddress( p_entry, o_path, pAddress );
252  }
253  StatusCode status = par_entry->add( to_string( objPath ), pAddress );
254  return status.isSuccess() ? status : Status::DOUBL_OBJ_PATH;
255 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
constexpr char SEPARATOR
T to_string(T... args)
RegistryEntry * findLeaf(std::string_view path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:52
Gaudi::Property< bool > m_forceLeaves
Definition: DataSvc.h:55
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:861
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
const std::string & identifier() const override
Full identifier (or key)
bool isSuccess() const
Definition: StatusCode.h:267
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:215
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
T get(T... args)
T find(T... args)
StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
StatusCode registerObject(std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:293
bool isFailure() const
Definition: StatusCode.h:130
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

◆ registerObject() [1/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() [2/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 107 of file IDataProviderSvc.h.

107  {
108  return registerObject( parentObj, itemToPath( item ), pObject );
109  }
StatusCode registerObject(std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:293

◆ registerObject() [3/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 85 of file IDataProviderSvc.h.

85  {
86  return registerObject( parentPath, itemToPath( item ), pObject );
87  }
StatusCode registerObject(std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:293

◆ 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 62 of file IDataProviderSvc.h.

62  {
63  return registerObject( nullptr, fullPath, pObject );
64  }
StatusCode registerObject(std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:293

◆ registerObject() [5/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() [6/7]

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

Register object with the data store.

Definition at line 293 of file DataSvc.cpp.

293  {
294  DataObject* pO = nullptr;
295  StatusCode status = retrieveObject( parentPath, pO );
296  if ( !status.isSuccess() && m_forceLeaves ) {
297  pO = createDefaultObject();
298  status = registerObject( parentPath, pO );
299  if ( !status.isSuccess() ) pO->release();
300  }
301  return status.isSuccess() ? registerObject( pO, objPath, pObject ) : status;
302 }
Gaudi::Property< bool > m_forceLeaves
Definition: DataSvc.h:55
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:861
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:46
StatusCode registerObject(std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:293
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:618

◆ registerObject() [7/7]

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

Register object with the data store.

Definition at line 305 of file DataSvc.cpp.

305  {
306  if ( !checkRoot() ) return Status::INVALID_ROOT;
307 
308  if ( !parentObj ) {
309  if ( !objPath.empty() ) {
310  if ( objPath.front() != SEPARATOR ) { return registerObject( m_rootName.value(), objPath, pObject ); }
311  auto sep = find( objPath, SEPARATOR, 1 );
312  if ( sep != std::string_view::npos ) {
313  return registerObject( objPath.substr( 0, sep ), objPath.substr( sep ), pObject );
314  }
315  }
316  return Status::INVALID_OBJ_PATH;
317  }
318  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, parentObj->registry() );
319  if ( node_entry ) {
320  StatusCode status = Status::INVALID_PARENT;
321  auto sep = find( objPath, SEPARATOR, 1 );
322  if ( sep != std::string_view::npos ) {
323  auto p_path = objPath.substr( 0, sep );
324  auto o_path = objPath.substr( sep );
325  RegEntry* par_entry = node_entry->findLeaf( p_path );
326  // Create default object leafs if the
327  // intermediate nodes are not present
328  if ( !par_entry && m_forceLeaves ) {
329  DataObject* pLeaf = createDefaultObject();
330  StatusCode sc = registerObject( parentObj, p_path, pLeaf );
331  if ( !sc.isSuccess() ) delete pLeaf;
332  par_entry = node_entry->findLeaf( p_path );
333  } else if ( par_entry && !par_entry->object() ) {
334  status = i_retrieveEntry( node_entry, p_path, par_entry );
335  if ( !status.isSuccess() && !par_entry->address() && m_forceLeaves ) {
336  DataObject* pLeaf = createDefaultObject();
337  StatusCode sc = registerObject( parentObj, p_path, pLeaf );
338  if ( !sc.isSuccess() ) delete pLeaf;
339  par_entry = node_entry->findLeaf( p_path );
340  }
341  }
342  node_entry = par_entry;
343  if ( node_entry ) {
344  DataObject* obj = node_entry->object();
345  if ( obj ) status = registerObject( obj, o_path, pObject );
346  }
347  } else {
348  RegEntry* leaf = node_entry->findLeaf( objPath );
349  if ( !leaf ) {
350  status = node_entry->add( to_string( objPath ), pObject );
351  } else {
352  DataObject* obj = leaf->object();
353  if ( !obj ) {
354  if ( !pObject ) {
355  error() << "registerObject: trying to register null DataObject" << endmsg;
356  return StatusCode::FAILURE;
357  }
358  pObject->setRegistry( leaf );
359  leaf->setAddress( nullptr );
360  leaf->setObject( pObject );
361  status = StatusCode::SUCCESS;
362  } else {
363  status = Status::DOUBL_OBJ_PATH;
364  }
365  }
366  }
367  return status;
368  }
369  return Status::INVALID_PARENT;
370 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
constexpr char SEPARATOR
T to_string(T... args)
RegistryEntry * findLeaf(std::string_view path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:52
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
Gaudi::Property< bool > m_forceLeaves
Definition: DataSvc.h:55
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition: DataObject.h:70
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:861
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
void setObject(DataObject *obj)
Set/Update object address.
IOpaqueAddress * address() const override
Retrieve opaque storage address.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, std::string_view path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:532
bool isSuccess() const
Definition: StatusCode.h:267
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
T find(T... args)
StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
DataObject * object() const override
Retrive object behind the link.
constexpr static const auto FAILURE
Definition: StatusCode.h:86
StatusCode registerObject(std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:293
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

◆ reinitialize()

StatusCode DataSvc::reinitialize ( )
override

Service initialization.

Service reinitialization.

Definition at line 822 of file DataSvc.cpp.

822  {
823  // the finalize part is copied here
824  setDataLoader( nullptr ).ignore();
825  resetPreLoad().ignore();
826  clearStore().ignore();
828  // re-initialize the base class
830  if ( UNLIKELY( !sc.isSuccess() ) ) {
831  error() << "Unable to reinitialize base class" << endmsg;
832  return sc;
833  }
834  // the initialize part is copied here
835  m_incidentSvc = service( "IncidentSvc", true );
836  if ( UNLIKELY( !m_incidentSvc ) ) {
837  error() << "Failed to access incident service." << endmsg;
838  return StatusCode::FAILURE;
839  }
840  // return
841  return StatusCode::SUCCESS;
842 }
#define UNLIKELY(x)
Definition: Kernel.h:96
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:177
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:49
StatusCode reinitialize() override
Definition: Service.cpp:237
bool isSuccess() const
Definition: StatusCode.h:267
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
constexpr static const auto FAILURE
Definition: StatusCode.h:86
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:83
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:86
StatusCode resetPreLoad() override
Clear the preload list.
Definition: DataSvc.cpp:779
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:101

◆ removePreLoadItem()

StatusCode DataSvc::removePreLoadItem ( const DataStoreItem item)
override

Remove an item from the preload list.

Definition at line 773 of file DataSvc.cpp.

773  {
775  return StatusCode::SUCCESS;
776 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T remove(T... args)
T erase(T... args)
def end
Definition: IOTest.py:113
AttribStringParser::Iterator begin(const AttribStringParser &parser)
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:67

◆ resetPreLoad()

StatusCode DataSvc::resetPreLoad ( )
override

Clear the preload list.

Definition at line 779 of file DataSvc.cpp.

779  {
781  return StatusCode::SUCCESS;
782 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T erase(T... args)
def end
Definition: IOTest.py:113
AttribStringParser::Iterator begin(const AttribStringParser &parser)
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:67

◆ retrieveEntry()

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

Retrieve registry entry from store.

Definition at line 528 of file DataSvc.cpp.

528  {
529  return i_retrieveEntry( parentObj, path, pEntry );
530 }
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, std::string_view path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:532

◆ retrieveObject() [1/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() [2/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 247 of file IDataProviderSvc.h.

247  {
248  DataObject* parent = nullptr;
249  StatusCode status = retrieveObject( parentPath, parent );
250  return status.isSuccess() ? retrieveObject( parent, objectPath, pObject ) : status;
251  }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:618

◆ retrieveObject() [3/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 277 of file IDataProviderSvc.h.

277  {
278  return retrieveObject( parentObj ? parentObj->registry() : nullptr, objectPath, pObject );
279  }
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:618

◆ retrieveObject() [4/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 233 of file IDataProviderSvc.h.

233  {
234  return retrieveObject( static_cast<IRegistry*>( nullptr ), fullPath, pObject );
235  }
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:618

◆ retrieveObject() [5/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 291 of file IDataProviderSvc.h.

291  {
292  return retrieveObject( parentObj, itemToPath( item ), pObject );
293  }
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:618

◆ 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 263 of file IDataProviderSvc.h.

263  {
264  return retrieveObject( parentPath, itemToPath( item ), pObject );
265  }
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:618

◆ retrieveObject() [7/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 618 of file DataSvc.cpp.

618  {
619  pObject = nullptr;
620  RegEntry * result = nullptr, *parent = CAST_REGENTRY( RegEntry*, pRegistry );
621  StatusCode status = i_retrieveEntry( parent, path, result );
622  if ( status.isSuccess() ) pObject = result->object();
623  return status;
624 }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, std::string_view path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:532
bool isSuccess() const
Definition: StatusCode.h:267
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
DataObject * object() const override
Retrive object behind the link.

◆ rootCLID()

CLID DataSvc::rootCLID ( ) const
override

IDataManagerSvc: Accessor for root event CLID.

CLID for root Event.

Definition at line 855 of file DataSvc.cpp.

855 { return (CLID)m_rootCLID; }
Gaudi::Property< CLID > m_rootCLID
Definition: DataSvc.h:51
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8

◆ rootName()

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

IDataManagerSvc: Accessor for root event name.

Name for root Event.

Definition at line 858 of file DataSvc.cpp.

858 { return m_rootName; }
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:52

◆ 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 177 of file DataSvc.cpp.

177  {
178  m_dataLoader = pDataLoader;
179  if ( m_dataLoader ) m_dataLoader->setDataProvider( dpsvc ? dpsvc : this ).ignore();
180  return StatusCode::SUCCESS;
181 }
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
Definition: DataSvc.h:45

◆ 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 132 of file DataSvc.cpp.

132  {
133  clearStore().ignore();
134  return i_setRoot( std::move( root_path ), pRootObj );
135 }
T move(T... args)
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
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:142
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:101

◆ 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 156 of file DataSvc.cpp.

156  {
157  clearStore().ignore();
158  return i_setRoot( std::move( root_path ), pRootAddr );
159 }
T move(T... args)
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
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:142
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:101

◆ traverseSubTree() [1/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 110 of file DataSvc.cpp.

110  {
111  DataObject* pO = nullptr;
112  StatusCode status = findObject( sub_tree_path, pO );
113  return status.isSuccess() ? traverseSubTree( pO, pAgent ) : status;
114 }
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:110
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:640
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

◆ traverseSubTree() [2/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 117 of file DataSvc.cpp.

117  {
118  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
119  return entry ? entry->traverseTree( pAgent ) : Status::INVALID_OBJECT;
120 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36

◆ 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 123 of file DataSvc.cpp.

123  {
124  if ( !checkRoot() ) return Status::INVALID_ROOT;
125  return m_root->traverseTree( pAgent );
126 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253

◆ unlinkObject() [1/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.

◆ unlinkObject() [2/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 522 of file IDataProviderSvc.h.

522  {
523  DataObject* pObject = nullptr;
524  StatusCode status = findObject( fromPath, pObject );
525  return status.isSuccess() ? unlinkObject( pObject->registry(), objPath ) : status;
526  }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
StatusCode unlinkObject(IRegistry *from, std::string_view objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:731
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:640
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

◆ unlinkObject() [3/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() [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
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() [5/7]

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

Remove a link to another object.

Definition at line 731 of file DataSvc.cpp.

731  {
732  if ( !checkRoot() ) return Status::INVALID_ROOT;
733  try {
734  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
735  if ( from_entry ) {
736  auto sep = objPath.rfind( SEPARATOR );
737  if ( sep > 0 && sep != std::string_view::npos ) { // in case the objPath is a sub-directory itself
738  DataObject* pO = nullptr;
739  StatusCode sc = findObject( from, objPath.substr( 0, sep ), pO );
740  return sc.isSuccess() ? unlinkObject( pO->registry(), objPath.substr( sep ) ) : sc;
741  }
742  StatusCode status = from_entry->remove( objPath );
743  if ( status.isSuccess() ) return status;
744  return Status::INVALID_OBJ_PATH;
745  }
746  } catch ( ... ) {}
747  return Status::INVALID_PARENT;
748 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
constexpr char SEPARATOR
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
StatusCode unlinkObject(IRegistry *from, std::string_view objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:731
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode remove(std::string_view name)
Remove an entry from the store.
bool isSuccess() const
Definition: StatusCode.h:267
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:640
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

◆ unlinkObject() [6/7]

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

Remove a link to another object.

Definition at line 759 of file DataSvc.cpp.

759  {
760  if ( !checkRoot() ) return Status::INVALID_ROOT;
761  IRegistry* from_entry = m_root->findLeaf( from );
762  return unlinkObject( from_entry, objPath );
763 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
RegistryEntry * findLeaf(std::string_view path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
StatusCode unlinkObject(IRegistry *from, std::string_view objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:731
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22

◆ unlinkObject() [7/7]

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

Remove a link to another object.

Definition at line 751 of file DataSvc.cpp.

751  {
752  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
753  if ( fullPath.front() != SEPARATOR ) return unlinkObject( m_rootName.value(), fullPath );
754  auto sep = fullPath.rfind( SEPARATOR );
755  return unlinkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ) );
756 }
constexpr char SEPARATOR
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:52
StatusCode unlinkObject(IRegistry *from, std::string_view objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:731

◆ unregisterAddress() [1/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.

◆ unregisterAddress() [2/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 233 of file IDataManagerSvc.h.

233  {
234  return unregisterAddress( pParent ? pParent->registry() : nullptr, objPath );
235  }
StatusCode unregisterAddress(std::string_view fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:258

◆ 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 258 of file DataSvc.cpp.

258  {
259  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
260  return unregisterAddress( fullPath.front() != SEPARATOR ? m_root.get() : nullptr, fullPath );
261 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
constexpr char SEPARATOR
StatusCode unregisterAddress(std::string_view fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:258
T get(T... args)

◆ unregisterAddress() [5/5]

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

IDataManagerSvc: Unregister object address from the data store.

Definition at line 264 of file DataSvc.cpp.

264  {
265  if ( !checkRoot() ) return Status::INVALID_ROOT;
266  if ( objPath.empty() ) return Status::INVALID_OBJ_PATH;
267 
268  if ( !pParent ) {
269  if ( objPath.front() != SEPARATOR ) return unregisterAddress( m_root.get(), objPath );
270  auto sep = find( objPath, SEPARATOR, 1 );
271  if ( sep != std::string_view::npos && objPath.substr( 0, sep ) == m_rootName.value() ) {
272  return unregisterAddress( m_root.get(), objPath.substr( sep ) );
273  }
274  return Status::INVALID_PARENT;
275  }
276  if ( objPath.front() != SEPARATOR ) { return unregisterAddress( pParent, char( SEPARATOR ) + objPath ); }
277  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pParent );
278  if ( node_entry ) {
279  RegEntry* leaf_entry = node_entry->findLeaf( objPath );
280  if ( leaf_entry ) {
281  auto sep = objPath.rfind( SEPARATOR );
282  if ( sep > 0 && sep != std::string_view::npos ) {
283  return unregisterAddress( leaf_entry->parent(), objPath.substr( sep ) );
284  }
285  StatusCode status = node_entry->remove( objPath );
286  if ( status.isSuccess() ) return status;
287  }
288  }
289  return Status::INVALID_PARENT;
290 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
constexpr char SEPARATOR
RegistryEntry * findLeaf(std::string_view path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:52
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
IRegistry * parent() const
Pointer to parent directory entry.
StatusCode unregisterAddress(std::string_view fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:258
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode remove(std::string_view name)
Remove an entry from the store.
bool isSuccess() const
Definition: StatusCode.h:267
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
T get(T... args)
T find(T... args)

◆ unregisterObject() [1/3]

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

Unregister object from the data store.

Definition at line 373 of file DataSvc.cpp.

373  {
374  DataObject* pObject = nullptr;
375  StatusCode status = findObject( fullPath, pObject );
376  if ( status.isFailure() ) return status;
377  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pObject->registry() );
378  if ( !pEntry ) return Status::INVALID_ROOT;
379  if ( !pEntry->isEmpty() ) return Status::DIR_NOT_EMPTY;
380  RegEntry* pParent = pEntry->parentEntry();
381  if ( !pParent ) return Status::INVALID_PARENT;
382  if ( pObject ) pObject->addRef();
383  pParent->remove( pEntry );
384  return StatusCode::SUCCESS;
385 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
bool isEmpty() const
Simple check if the Container is empty.
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:53
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode remove(std::string_view name)
Remove an entry from the store.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:91
bool isFailure() const
Definition: StatusCode.h:130
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:640
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

◆ unregisterObject() [2/3]

StatusCode DataSvc::unregisterObject ( DataObject pObject)
override

Unregister object from the data store.

Definition at line 388 of file DataSvc.cpp.

388  {
389  if ( !checkRoot() ) return Status::INVALID_ROOT;
390  RegEntry* entry = m_root->findLeaf( pObject );
391  if ( !entry ) return Status::INVALID_OBJECT;
392  RegEntry* parent = entry->parentEntry();
393  if ( !parent ) return Status::INVALID_PARENT;
394  if ( !entry->isEmpty() ) return Status::DIR_NOT_EMPTY;
395  if ( entry->object() ) entry->object()->addRef();
396  if ( parent ) parent->remove( entry );
397  return StatusCode::SUCCESS;
398 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
RegistryEntry * findLeaf(std::string_view path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
bool isEmpty() const
Simple check if the Container is empty.
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:53
StatusCode remove(std::string_view name)
Remove an entry from the store.
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
DataObject * object() const override
Retrive object behind the link.
RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:91

◆ unregisterObject() [3/3]

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

Unregister object from the data store.

Definition at line 401 of file DataSvc.cpp.

401  {
402  if ( checkRoot() ) {
403  try {
404  RegEntry* parent = CAST_REGENTRY( RegEntry*, pParentObj->registry() );
405  if ( parent ) {
406  RegEntry* entry = parent->findLeaf( objectPath );
407  if ( entry ) {
408  if ( entry->isEmpty() ) {
409  if ( entry->object() ) { entry->object()->addRef(); }
410  parent->remove( entry );
411  return StatusCode::SUCCESS;
412  }
413  return Status::DIR_NOT_EMPTY;
414  }
415  return Status::INVALID_OBJECT;
416  }
417  } catch ( ... ) {}
418  return Status::INVALID_PARENT;
419  }
420  return Status::INVALID_ROOT;
421 }
RegistryEntry * findLeaf(std::string_view path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
bool isEmpty() const
Simple check if the Container is empty.
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:253
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:53
StatusCode remove(std::string_view name)
Remove an entry from the store.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
DataObject * object() const override
Retrive object behind the link.

◆ updateObject() [1/2]

StatusCode DataSvc::updateObject ( IRegistry pDirectory)
override

Update object identified by its directory entry.

Update object.

Definition at line 651 of file DataSvc.cpp.

651  {
652  if ( !pRegistry ) { // Precondition:
653  return Status::INVALID_OBJ_ADDR; // Addres must be valid
654  }
655  DataObject* toUpdate = pRegistry->object();
656  if ( !toUpdate ) { // Try first to load
657  return loadObject( pRegistry );
658  }
659  return updateObject( toUpdate );
660 }
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: DataSvc.cpp:460
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:651
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

◆ updateObject() [2/2]

StatusCode DataSvc::updateObject ( DataObject toUpdate)
override

Update object.

Definition at line 663 of file DataSvc.cpp.

663  {
664  StatusCode status = Status::INVALID_OBJ_ADDR;
665  if ( !toUpdate ) { // Precondition:
666  return Status::INVALID_OBJECT; // Address must be valid
667  }
668  IRegistry* pRegistry = toUpdate->registry(); // Precondition:
669  if ( !pRegistry ) { // Need valid registry
670  return Status::INVALID_OBJECT;
671  }
672  IOpaqueAddress* pAddress = pRegistry->address(); // Precondition:
673  if ( !pAddress ) { // Need valid address
674  return Status::INVALID_OBJ_ADDR;
675  }
676  IConversionSvc* pLoader = getDataLoader( pRegistry );
677  if ( !pLoader ) { // Precondition:
678  return Status::NO_DATA_LOADER; // Data loader must be present
679  }
680  if ( !m_inhibitPathes.empty() ) {
681  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), pRegistry->identifier() );
682  if ( inhibit != m_inhibitPathes.end() ) { return Status::NO_ACCESS; }
683  }
684  try {
685  status = pLoader->updateObj( pAddress, toUpdate ); // Call data loader
686  if ( status.isSuccess() ) { status = pLoader->updateObjRefs( pAddress, toUpdate ); }
687  } catch ( const GaudiException& exc ) {
688  throw GaudiException( "GaudiException in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE, exc );
689  } catch ( const std::exception& x ) {
690  throw GaudiException( "std::exception in updateObject() " + pRegistry->name() + ": " +
691  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
693  } catch ( ... ) {
694  throw GaudiException( "UNKN exception in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE );
695  }
696  return status;
697 }
Define general base for Gaudi exception.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
virtual const name_type & name() const =0
Name of the directory (or key)
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
T what(T... args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
bool isSuccess() const
Definition: StatusCode.h:267
STL class.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
Gaudi::Property< std::vector< std::string > > m_inhibitPathes
Definition: DataSvc.h:56
T find(T... args)
constexpr static const auto FAILURE
Definition: StatusCode.h:86
virtual const id_type & identifier() const =0
Full identifier (or key)
Opaque address interface definition.
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
Definition: DataSvc.cpp:866

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 64 of file DataSvc.h.

◆ m_dataLoader

SmartIF<IConversionSvc> DataSvc::m_dataLoader = nullptr
private

Pointer to data loader service.

Definition at line 45 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 62 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 58 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 60 of file DataSvc.h.

◆ m_forceLeaves

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

Definition at line 55 of file DataSvc.h.

◆ m_incidentSvc

SmartIF<IIncidentSvc> DataSvc::m_incidentSvc = nullptr
protected

Pointer to incident service.

Definition at line 49 of file DataSvc.h.

◆ m_inhibitPathes

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

Definition at line 56 of file DataSvc.h.

◆ m_preLoads

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

Items to be pre-loaded.

Definition at line 67 of file DataSvc.h.

◆ m_root

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

Pointer to root entry.

Definition at line 71 of file DataSvc.h.

◆ m_rootCLID

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

Definition at line 51 of file DataSvc.h.

◆ m_rootName

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

Definition at line 52 of file DataSvc.h.


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