The Gaudi Framework  v31r0 (aeb156f0)
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 (boost::string_ref fullPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store. More...
 
StatusCode registerAddress (IRegistry *parentObj, boost::string_ref objectPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store. More...
 
StatusCode unregisterAddress (boost::string_ref fullPath) override
 IDataManagerSvc: Unregister object address from the data store. More...
 
StatusCode unregisterAddress (IRegistry *pParent, boost::string_ref 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 (boost::string_ref 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 (boost::string_ref 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 (boost::string_ref parentPath, boost::string_ref objPath, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode registerObject (DataObject *parentObj, boost::string_ref objPath, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode unregisterObject (boost::string_ref 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, boost::string_ref objectPath) override
 Unregister object from the data store. More...
 
StatusCode retrieveObject (IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
 Retrieve object from data store. More...
 
StatusCode findObject (boost::string_ref fullPath, DataObject *&pObject) override
 Find object identified by its full path in the data store. More...
 
StatusCode findObject (IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
 Find object identified by its full path in the data store. More...
 
StatusCode linkObject (IRegistry *from, boost::string_ref objPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode linkObject (boost::string_ref fullPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode unlinkObject (IRegistry *from, boost::string_ref objPath) override
 Remove a link to another object. More...
 
StatusCode unlinkObject (DataObject *fromObj, boost::string_ref objPath) override
 Remove a link to another object. More...
 
StatusCode unlinkObject (boost::string_ref 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...
 
- 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, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
 Retrieve registry entry from store. More...
 
DataObjecthandleDataFault (IRegistry *pReg, boost::string_ref 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, "[[deprecated]] 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, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
 
DataObjecti_handleDataFault (IRegistry *pReg, boost::string_ref path=boost::string_ref{})
 

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...
 
DataSvcHelpers::InhibitMap * m_inhibitMap = nullptr
 Map with object paths to be inhibited from loading. 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 ( const DataSvc )
delete

copy constructor disabled

Member Function Documentation

StatusCode DataSvc::addPreLoadItem ( const DataStoreItem item)
override

Add an item to the preload list.

Definition at line 768 of file DataSvc.cpp.

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

Check if root path is valid.

Definition at line 257 of file DataSvc.h.

257 { return 0 != m_root; }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
StatusCode DataSvc::clearStore ( )
override

IDataManagerSvc: Remove all data objects in the data store.

Definition at line 103 of file DataSvc.cpp.

103  {
104  if ( !checkRoot() ) return Status::INVALID_ROOT;
105  m_root.reset();
106  return StatusCode::SUCCESS;
107 }
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:257
T reset(T...args)
StatusCode DataSvc::clearSubTree ( boost::string_ref  sub_tree_path)
override

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

Definition at line 77 of file DataSvc.cpp.

77  {
78  DataObject* pObject = nullptr;
79  StatusCode status = findObject( sub_tree_path, pObject );
80  if ( !status.isSuccess() ) return status;
81  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
82  if ( !node_entry ) return Status::INVALID_OBJECT;
83  RegEntry* parent = node_entry->parentEntry();
84  if ( !parent ) return Status::INVALID_PARENT;
85  parent->remove( node_entry );
86  return StatusCode::SUCCESS;
87 }
bool isSuccess() const
Definition: StatusCode.h:267
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
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
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:64
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 remove(boost::string_ref name)
Remove an entry from the store.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:642
StatusCode DataSvc::clearSubTree ( DataObject pObject)
override

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

Definition at line 92 of file DataSvc.cpp.

92  {
93  if ( !checkRoot() ) return Status::INVALID_ROOT;
94  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
95  if ( !entry ) return Status::INVALID_OBJECT;
96  RegEntry* parent = entry->parentEntry();
97  if ( !parent ) return Status::INVALID_PARENT;
98  parent->remove( entry );
99  return StatusCode::SUCCESS;
100 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:257
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:64
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 remove(boost::string_ref name)
Remove an entry from the store.
DataObject * DataSvc::createDefaultObject ( ) const
protectedvirtual

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

Definition at line 863 of file DataSvc.cpp.

863 { return new DataObject(); }
StatusCode DataSvc::finalize ( )
override

Service initialization.

Service initialisation.

Definition at line 847 of file DataSvc.cpp.

847  {
848  // Nothing to do: just call base class initialisation
849  setDataLoader( nullptr ).ignore();
850  resetPreLoad().ignore();
851  clearStore().ignore();
853  return Service::finalize();
854 }
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:179
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:781
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:103
StatusCode DataSvc::findObject ( boost::string_ref  fullPath,
DataObject *&  pObject 
)
override

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

Definition at line 642 of file DataSvc.cpp.

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

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

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

Reimplemented in NTupleSvc.

Definition at line 868 of file DataSvc.cpp.

868 { 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
DataObject * DataSvc::handleDataFault ( IRegistry pReg,
boost::string_ref  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 427 of file DataSvc.cpp.

427  {
428  return i_handleDataFault( pReg, path );
429 }
DataObject * i_handleDataFault(IRegistry *pReg, boost::string_ref path=boost::string_ref{})
Definition: DataSvc.cpp:431
DataObject * DataSvc::i_handleDataFault ( IRegistry pReg,
boost::string_ref  path = boost::string_ref{} 
)
private

Definition at line 431 of file DataSvc.cpp.

431  {
432  if ( m_enableFaultHdlr ) {
433  IRegistry* pLeaf = nullptr;
434  if ( pReg && path.empty() ) {
435  DataIncident incident( name(), m_faultName, pReg->identifier() );
436  m_incidentSvc->fireIncident( incident );
437  return pReg->object();
438  }
439  if ( pReg ) {
440  std::string p = pReg->identifier();
441  if ( path.front() != SEPARATOR ) p += SEPARATOR;
442  p.append( path.data(), path.size() );
443  DataIncident incident( name(), m_faultName, p );
444  m_incidentSvc->fireIncident( incident );
445  pLeaf = m_root->findLeaf( p );
446  } else {
448  if ( path.front() != SEPARATOR ) p += SEPARATOR;
449  p.append( path.data(), path.size() );
450  DataIncident incident( name(), m_faultName, p );
451  m_incidentSvc->fireIncident( incident );
452  pLeaf = m_root->findLeaf( p );
453  }
454  if ( pLeaf ) { return pLeaf->object(); }
455  }
456  return nullptr;
457 }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: DataSvc.h:71
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
constexpr char SEPARATOR
Gaudi::Property< bool > m_enableFaultHdlr
Definition: DataSvc.h:58
STL class.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
Gaudi::Property< std::string > m_faultName
Definition: DataSvc.h:60
virtual const id_type & identifier() const =0
Full identifier (or key)
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
virtual DataObject * object() const =0
Retrieve object behind the link.
const std::string & identifier() const override
Full identifier (or key)
Data service incident class.
StatusCode DataSvc::i_retrieveEntry ( DataSvcHelpers::RegistryEntry parentObj,
boost::string_ref  path,
DataSvcHelpers::RegistryEntry *&  pEntry 
)
private

Definition at line 534 of file DataSvc.cpp.

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

144  {
145  if ( pRootObj ) {
146  m_root = std::make_unique<RegEntry>( std::move( root_path ) );
147  m_root->makeHard( pRootObj );
148  m_root->setDataSvc( this );
149  // No done with GaudiHive. preLoad().ignore();
150  }
151  return StatusCode::SUCCESS;
152 }
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.
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 168 of file DataSvc.cpp.

168  {
169  if ( pRootAddr ) {
170  m_root = std::make_unique<RegEntry>( std::move( root_path ) );
171  m_root->makeHard( pRootAddr );
172  m_root->setDataSvc( this );
173  // Not done with GaudiHive. preLoad().ignore();
174  }
175  return StatusCode::SUCCESS;
176 }
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.
StatusCode DataSvc::initialize ( )
override

Service initialization.

Definition at line 814 of file DataSvc.cpp.

814  {
815  // Nothing to do: just call base class initialisation
817  if ( UNLIKELY( !sc.isSuccess() ) ) return sc;
818  m_incidentSvc = service( "IncidentSvc", true );
819  if ( UNLIKELY( !m_incidentSvc ) ) { error() << "Failed to access incident service." << endmsg; }
820  return sc;
821 }
#define UNLIKELY(x)
Definition: Kernel.h:89
StatusCode initialize() override
Definition: Service.cpp:60
bool isSuccess() const
Definition: StatusCode.h:267
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 service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;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
StatusCode DataSvc::linkObject ( IRegistry from,
boost::string_ref  objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 702 of file DataSvc.cpp.

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

Add a link to another object.

Definition at line 725 of file DataSvc.cpp.

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

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

Definition at line 462 of file DataSvc.cpp.

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

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

Definition at line 470 of file DataSvc.cpp.

470  {
471  StatusCode status = Status::INVALID_OBJ_ADDR;
472  DataObject* pObject = nullptr;
473  if ( !pLoader ) { // Precondition: Data loader must be present
474  return handleDataFault( pRegistry ) ? StatusCode::SUCCESS : StatusCode( Status::NO_DATA_LOADER );
475  }
476  if ( !pRegistry ) { // Precondition: Directory must be valid
477  return handleDataFault( pRegistry ) ? StatusCode::SUCCESS : StatusCode( Status::INVALID_OBJ_ADDR );
478  }
479 
480  VERMSG << "Requested object " << pRegistry->identifier() << endmsg;
481 
482  if ( m_enableAccessHdlr ) {
483  // Fire data access incident
484  DataIncident incident( name(), m_accessName, pRegistry->identifier() );
485  m_incidentSvc->fireIncident( incident );
486  }
487  if ( !m_inhibitPathes.empty() ) {
488  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), pRegistry->identifier() );
489  if ( inhibit != m_inhibitPathes.end() ) { return Status::NO_ACCESS; }
490  }
491  IOpaqueAddress* pAddress = pRegistry->address();
492  if ( !pAddress ) { // Precondition:
493  return Status::INVALID_OBJ_ADDR; // Address must be valid
494  }
495  try {
496  status = pLoader->createObj( pAddress, pObject ); // Call data loader
497  if ( status.isSuccess() ) {
498 
499  VERMSG << "Object " << pRegistry->identifier() << " created" << endmsg;
500 
501  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pRegistry );
502  pEntry->setObject( pObject );
503 
504  VERMSG << "Filling object " << pRegistry->identifier() << endmsg;
505  status = pLoader->fillObjRefs( pAddress, pObject );
506  }
507  } catch ( const GaudiException& exc ) {
508  if ( handleDataFault( pRegistry ) ) { return StatusCode::SUCCESS; }
509  throw GaudiException( "GaudiException in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE,
510  exc );
511  } catch ( const std::exception& x ) {
512  if ( handleDataFault( pRegistry ) ) { return StatusCode::SUCCESS; }
513  throw GaudiException( "std::exception in loadObject() " + pRegistry->identifier() + ": " +
514  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
516  } catch ( ... ) {
517  if ( handleDataFault( pRegistry ) ) { return StatusCode::SUCCESS; }
518  throw GaudiException( "UNKN exception in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE );
519  }
520  if ( !status.isSuccess() ) {
521  if ( handleDataFault( pRegistry ) ) { return StatusCode::SUCCESS; }
522  }
523  ON_VERBOSE if ( status.isSuccess() ) {
524  verbose() << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
525  }
526  return status;
527 }
#define VERMSG
Definition: DataSvc.cpp:72
Define general base for Gaudi exception.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
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:309
Gaudi::Property< std::string > m_accessName
Definition: DataSvc.h:64
bool isSuccess() const
Definition: StatusCode.h:267
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
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
STL class.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:64
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:69
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
DataObject * handleDataFault(IRegistry *pReg, boost::string_ref path="")
Invoke data fault handling if enabled.
Definition: DataSvc.cpp:427
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 200 of file DataSvc.cpp.

200  {
201  if ( !pObject ) return Status::INVALID_OBJECT;
202  return objectLeaves( pObject->registry(), leaves );
203 }
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:200
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 208 of file DataSvc.cpp.

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

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

Definition at line 186 of file DataSvc.cpp.

186  {
187  if ( !pObject ) return Status::INVALID_OBJECT;
188  return objectParent( pObject->registry(), refpParent );
189 }
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&#39;s parent.
Definition: DataSvc.cpp:186
StatusCode DataSvc::objectParent ( const IRegistry pRegistry,
IRegistry *&  refpParent 
)
override

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

Definition at line 191 of file DataSvc.cpp.

191  {
192  if ( !checkRoot() ) return Status::INVALID_ROOT;
193  const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
194  if ( !node_entry ) return Status::INVALID_OBJECT;
195  refpParent = node_entry->parent();
196  return StatusCode::SUCCESS;
197 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:257
IRegistry * parent() const
Pointer to parent directory entry.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:64
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
DataSvc& DataSvc::operator= ( const DataSvc )
delete

Fake assignment operator (never implemented).

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

787  {
788  // unused: StatusCode sc = StatusCode::FAILURE;
789  if ( pObject && depth++ < load_depth ) {
790  RegEntry* dir = CAST_REGENTRY( RegEntry*, pObject->registry() );
791  if ( dir ) {
792  for ( const auto& i : *dir ) {
793  DataObject* pObj = nullptr;
794  StatusCode status = retrieveObject( pObject, i->name(), pObj );
795  if ( status.isSuccess() && depth < load_depth ) { preLoad( depth, load_depth, pObj ).ignore(); }
796  }
797  }
798  }
799  return StatusCode::SUCCESS;
800 }
StatusCode preLoad() override
load all preload items of the list
Definition: DataSvc.cpp:803
bool isSuccess() const
Definition: StatusCode.h:267
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
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
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:64
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
Definition: DataObject.cpp:62
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:620
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::preLoad ( )
override

load all preload items of the list

Definition at line 803 of file DataSvc.cpp.

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

IDataManagerSvc: Register object address with the data store.

Definition at line 217 of file DataSvc.cpp.

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

IDataManagerSvc: Register object address with the data store.

Definition at line 223 of file DataSvc.cpp.

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

Register object with the data store.

Definition at line 295 of file DataSvc.cpp.

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

Register object with the data store.

Definition at line 307 of file DataSvc.cpp.

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

Service initialization.

Service reinitialization.

Definition at line 824 of file DataSvc.cpp.

824  {
825  // the finalize part is copied here
826  setDataLoader( nullptr ).ignore();
827  resetPreLoad().ignore();
828  clearStore().ignore();
830  // re-initialize the base class
832  if ( UNLIKELY( !sc.isSuccess() ) ) {
833  error() << "Unable to reinitialize base class" << endmsg;
834  return sc;
835  }
836  // the initialize part is copied here
837  m_incidentSvc = service( "IncidentSvc", true );
838  if ( UNLIKELY( !m_incidentSvc ) ) {
839  error() << "Failed to access incident service." << endmsg;
840  return StatusCode::FAILURE;
841  }
842  // return
843  return StatusCode::SUCCESS;
844 }
#define UNLIKELY(x)
Definition: Kernel.h:89
bool isSuccess() const
Definition: StatusCode.h:267
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:179
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
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&#39;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:781
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:103
StatusCode DataSvc::removePreLoadItem ( const DataStoreItem item)
override

Remove an item from the preload list.

Definition at line 775 of file DataSvc.cpp.

775  {
777  return StatusCode::SUCCESS;
778 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T remove(T...args)
T erase(T...args)
AttribStringParser::Iterator begin(const AttribStringParser &parser)
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:67
StatusCode DataSvc::resetPreLoad ( )
override

Clear the preload list.

Definition at line 781 of file DataSvc.cpp.

781  {
783  return StatusCode::SUCCESS;
784 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T erase(T...args)
AttribStringParser::Iterator begin(const AttribStringParser &parser)
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:67
StatusCode DataSvc::retrieveEntry ( DataSvcHelpers::RegistryEntry pNode,
boost::string_ref  path,
DataSvcHelpers::RegistryEntry *&  pEntry 
)
protected

Retrieve registry entry from store.

Definition at line 530 of file DataSvc.cpp.

530  {
531  return i_retrieveEntry( parentObj, path, pEntry );
532 }
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:534
StatusCode DataSvc::retrieveObject ( IRegistry pDirectory,
boost::string_ref  path,
DataObject *&  pObject 
)
override

Retrieve object from data store.

Retrieve object identified by its directory from the data store.

Definition at line 620 of file DataSvc.cpp.

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

IDataManagerSvc: Accessor for root event CLID.

CLID for root Event.

Definition at line 857 of file DataSvc.cpp.

857 { return (CLID)m_rootCLID; }
Gaudi::Property< CLID > m_rootCLID
Definition: DataSvc.h:51
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
const std::string & DataSvc::rootName ( ) const
override

IDataManagerSvc: Accessor for root event name.

Name for root Event.

Definition at line 860 of file DataSvc.cpp.

860 { return m_rootName; }
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:52
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 179 of file DataSvc.cpp.

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

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

158  {
159  clearStore().ignore();
160  return i_setRoot( std::move( root_path ), pRootAddr );
161 }
T move(T...args)
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:144
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:103
StatusCode DataSvc::traverseSubTree ( boost::string_ref  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 112 of file DataSvc.cpp.

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

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

125  {
126  if ( !checkRoot() ) return Status::INVALID_ROOT;
127  return m_root->traverseTree( pAgent );
128 }
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:257
StatusCode DataSvc::unlinkObject ( IRegistry from,
boost::string_ref  objPath 
)
override

Remove a link to another object.

Definition at line 733 of file DataSvc.cpp.

733  {
734  if ( !checkRoot() ) return Status::INVALID_ROOT;
735  try {
736  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
737  if ( from_entry ) {
738  auto sep = objPath.rfind( SEPARATOR );
739  if ( sep > 0 && sep != boost::string_ref::npos ) { // in case the objPath is a sub-directory itself
740  DataObject* pO = nullptr;
741  StatusCode sc = findObject( from, objPath.substr( 0, sep ), pO );
742  return sc.isSuccess() ? unlinkObject( pO->registry(), objPath.substr( sep ) ) : sc;
743  }
744  StatusCode status = from_entry->remove( objPath );
745  if ( status.isSuccess() ) return status;
746  return Status::INVALID_OBJ_PATH;
747  }
748  } catch ( ... ) {}
749  return Status::INVALID_PARENT;
750 }
constexpr char SEPARATOR
bool isSuccess() const
Definition: StatusCode.h:267
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:257
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
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:733
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:64
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
StatusCode remove(boost::string_ref name)
Remove an entry from the store.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:642
StatusCode DataSvc::unlinkObject ( DataObject fromObj,
boost::string_ref  objPath 
)
override

Remove a link to another object.

Definition at line 761 of file DataSvc.cpp.

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

Remove a link to another object.

Definition at line 753 of file DataSvc.cpp.

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

IDataManagerSvc: Unregister object address from the data store.

Definition at line 260 of file DataSvc.cpp.

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

IDataManagerSvc: Unregister object address from the data store.

Definition at line 266 of file DataSvc.cpp.

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

Unregister object from the data store.

Definition at line 375 of file DataSvc.cpp.

375  {
376  DataObject* pObject = nullptr;
377  StatusCode status = findObject( fullPath, pObject );
378  if ( status.isFailure() ) return status;
379  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pObject->registry() );
380  if ( !pEntry ) return Status::INVALID_ROOT;
381  if ( !pEntry->isEmpty() ) return Status::DIR_NOT_EMPTY;
382  RegEntry* pParent = pEntry->parentEntry();
383  if ( !pParent ) return Status::INVALID_PARENT;
384  if ( pObject ) pObject->addRef();
385  pParent->remove( pEntry );
386  return StatusCode::SUCCESS;
387 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
bool isFailure() const
Definition: StatusCode.h:130
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
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
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:64
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 remove(boost::string_ref name)
Remove an entry from the store.
bool isEmpty() const
Simple check if the Container is empty.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:642
StatusCode DataSvc::unregisterObject ( DataObject pObject)
override

Unregister object from the data store.

Definition at line 390 of file DataSvc.cpp.

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

Unregister object from the data store.

Definition at line 403 of file DataSvc.cpp.

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

Update object identified by its directory entry.

Update object.

Definition at line 653 of file DataSvc.cpp.

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

Update object.

Definition at line 665 of file DataSvc.cpp.

665  {
666  StatusCode status = Status::INVALID_OBJ_ADDR;
667  if ( !toUpdate ) { // Precondition:
668  return Status::INVALID_OBJECT; // Address must be valid
669  }
670  IRegistry* pRegistry = toUpdate->registry(); // Precondition:
671  if ( !pRegistry ) { // Need valid registry
672  return Status::INVALID_OBJECT;
673  }
674  IOpaqueAddress* pAddress = pRegistry->address(); // Precondition:
675  if ( !pAddress ) { // Need valid address
676  return Status::INVALID_OBJ_ADDR;
677  }
678  IConversionSvc* pLoader = getDataLoader( pRegistry );
679  if ( !pLoader ) { // Precondition:
680  return Status::NO_DATA_LOADER; // Data loader must be present
681  }
682  if ( !m_inhibitPathes.empty() ) {
683  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), pRegistry->identifier() );
684  if ( inhibit != m_inhibitPathes.end() ) { return Status::NO_ACCESS; }
685  }
686  try {
687  status = pLoader->updateObj( pAddress, toUpdate ); // Call data loader
688  if ( status.isSuccess() ) { status = pLoader->updateObjRefs( pAddress, toUpdate ); }
689  } catch ( const GaudiException& exc ) {
690  throw GaudiException( "GaudiException in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE, exc );
691  } catch ( const std::exception& x ) {
692  throw GaudiException( "std::exception in updateObject() " + pRegistry->name() + ": " +
693  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
695  } catch ( ... ) {
696  throw GaudiException( "UNKN exception in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE );
697  }
698  return status;
699 }
Define general base for Gaudi exception.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:274
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:309
bool isSuccess() const
Definition: StatusCode.h:267
virtual const name_type & name() const =0
Name of the directory (or key)
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
virtual const id_type & identifier() const =0
Full identifier (or key)
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
STL class.
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
Opaque address interface definition.
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
Definition: DataSvc.cpp:868
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.

Member Data Documentation

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.

SmartIF<IConversionSvc> DataSvc::m_dataLoader = nullptr
private

Pointer to data loader service.

Definition at line 45 of file DataSvc.h.

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.

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.

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.

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.

SmartIF<IIncidentSvc> DataSvc::m_incidentSvc = nullptr
protected

Pointer to incident service.

Definition at line 49 of file DataSvc.h.

DataSvcHelpers::InhibitMap* DataSvc::m_inhibitMap = nullptr
private

Map with object paths to be inhibited from loading.

Definition at line 75 of file DataSvc.h.

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

Definition at line 56 of file DataSvc.h.

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

Items to be pre-loaded.

Definition at line 67 of file DataSvc.h.

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

Pointer to root entry.

Definition at line 71 of file DataSvc.h.

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

Definition at line 51 of file DataSvc.h.

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: