The Gaudi Framework  v29r0 (ff2e7097)
DataSvc Class Reference

Data service base class. More...

#include <GaudiKernel/DataSvc.h>

Inheritance diagram for DataSvc:
Collaboration diagram for DataSvc:

Public Types

typedef std::vector< DataStoreItemLoadItems
 Define set of load items. More...
 
- 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
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > Factory
 
- 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...
 

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 (const std::string &fullPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store. More...
 
StatusCode registerAddress (DataObject *parentObj, const std::string &objectPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store. More...
 
StatusCode registerAddress (IRegistry *parentObj, const std::string &objectPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store. More...
 
StatusCode unregisterAddress (const std::string &fullPath) override
 IDataManagerSvc: Unregister object address from the data store. More...
 
StatusCode unregisterAddress (DataObject *pParent, const std::string &objPath) override
 IDataManagerSvc: Unregister object address from the data store. More...
 
StatusCode unregisterAddress (IRegistry *pParent, const std::string &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 (const std::string &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 (const std::string &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 addPreLoadItem (const std::string &itemPath) override
 Add an item to the preload list. More...
 
StatusCode removePreLoadItem (const DataStoreItem &item) override
 Remove an item from the preload list. More...
 
StatusCode removePreLoadItem (const std::string &itemPath) override
 Add an item to 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 (const std::string &fullPath, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode registerObject (const std::string &parentPath, const std::string &objPath, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode registerObject (const std::string &parentPath, int item, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode registerObject (DataObject *parentObj, const std::string &objPath, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode registerObject (DataObject *parentObj, int item, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode unregisterObject (const std::string &fullPath) override
 Unregister object from the data store. More...
 
StatusCode unregisterObject (const std::string &parentPath, const std::string &objectPath) override
 Unregister object from the data store. More...
 
StatusCode unregisterObject (const std::string &parentPath, int item) override
 Unregister object from the data store. More...
 
StatusCode unregisterObject (DataObject *pObject) override
 Unregister object from the data store. More...
 
StatusCode unregisterObject (DataObject *pObject, const std::string &objectPath) override
 Unregister object from the data store. More...
 
StatusCode unregisterObject (DataObject *pObject, int item) override
 Unregister object from the data store. More...
 
StatusCode retrieveObject (IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
 Retrieve object from data store. More...
 
StatusCode retrieveObject (const std::string &fullPath, DataObject *&pObject) override
 Retrieve object identified by its full path from the data store. More...
 
StatusCode retrieveObject (const std::string &parentPath, const std::string &objPath, DataObject *&pObject) override
 Retrieve object from data store. More...
 
StatusCode retrieveObject (const std::string &parentPath, int item, DataObject *&pObject) override
 Retrieve object from data store. More...
 
StatusCode retrieveObject (DataObject *parentObj, const std::string &objPath, DataObject *&pObject) override
 Retrieve object from data store. More...
 
StatusCode retrieveObject (DataObject *parentObj, int item, DataObject *&pObject) override
 Retrieve object from data store. More...
 
StatusCode findObject (const std::string &fullPath, DataObject *&pObject) override
 Find object identified by its full path in the data store. More...
 
StatusCode findObject (IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
 Find object identified by its full path in the data store. More...
 
StatusCode findObject (const std::string &parentPath, const std::string &objPath, DataObject *&pObject) override
 Find object in the data store. More...
 
StatusCode findObject (const std::string &parentPath, int item, DataObject *&pObject) override
 Find object in the data store. More...
 
StatusCode findObject (DataObject *parentObj, const std::string &objPath, DataObject *&pObject) override
 Find object in the data store. More...
 
StatusCode findObject (DataObject *parentObj, int item, DataObject *&pObject) override
 Find object in the data store. More...
 
StatusCode linkObject (IRegistry *from, const std::string &objPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode linkObject (const std::string &fromPath, const std::string &objPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode linkObject (DataObject *from, const std::string &objPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode linkObject (const std::string &fullPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode unlinkObject (IRegistry *from, const std::string &objPath) override
 Remove a link to another object. More...
 
StatusCode unlinkObject (const std::string &fromPath, const std::string &objPath) override
 Remove a link to another object. More...
 
StatusCode unlinkObject (DataObject *fromObj, const std::string &objPath) override
 Remove a link to another object. More...
 
StatusCode unlinkObject (const std::string &fullPath) override
 Remove a link to another object. More...
 
StatusCode updateObject (IRegistry *pDirectory) override
 Update object identified by its directory entry. More...
 
StatusCode updateObject (const std::string &updatePath) override
 Update object. More...
 
StatusCode updateObject (DataObject *toUpdate) override
 Update object. More...
 
StatusCode updateObject (const std::string &parentPath, const std::string &updatePath) override
 Update object. More...
 
StatusCode updateObject (DataObject *pParent, const std::string &updatePath) override
 Update object. More...
 
StatusCode initialize () override
 Service initialization. More...
 
StatusCode reinitialize () override
 Service initialization. More...
 
StatusCode finalize () override
 Service initialization. More...
 
 ~DataSvc () override
 Standard Destructor. 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...
 
 ~extends () override=default
 Virtual destructor. 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
 
 ~PropertyHolder () override=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, TYPE &value, const std::string &doc="none") const
 
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
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
 Specializations for various GaudiHandles. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
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...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const __attribute__((deprecated))
 Backward compatibility function for getting the output level. More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces... >
 ~extend_interfaces () override=default
 Virtual destructor. 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, const std::string &path, DataSvcHelpers::RegistryEntry *&pEntry)
 Retrieve registry entry from store. More...
 
DataObjecthandleDataFault (IRegistry *pReg, const std::string &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 > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Protected Attributes

SmartIF< IConversionSvcm_dataLoader = nullptr
 Pointer to data loader service. More...
 
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"}
 
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"}
 
LoadItems m_preLoads
 Items to be pre-loaded. More...
 
DataSvcHelpers::RegistryEntrym_root = nullptr
 Pointer to root entry. More...
 
DataSvcHelpers::InhibitMap * m_inhibitMap = nullptr
 Map with object paths to be inhibited from loading. 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

 DataSvc (const DataSvc &)=delete
 Fake copy constructor (never implemented). More...
 
DataSvcoperator= (const DataSvc &)=delete
 Fake assignment operator (never implemented). More...
 
StatusCode i_retrieveEntry (DataSvcHelpers::RegistryEntry *parentObj, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
 
DataObjecti_handleDataFault (IRegistry *pReg, boost::string_ref path=boost::string_ref{})
 

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

Member Typedef Documentation

Define set of load items.

Definition at line 48 of file DataSvc.h.

Constructor & Destructor Documentation

DataSvc::~DataSvc ( )
override

Standard Destructor.

Definition at line 1181 of file DataSvc.cpp.

1182 {
1183  setDataLoader( nullptr ).ignore();
1184  resetPreLoad().ignore();
1185  clearStore().ignore();
1186 }
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:205
void ignore() const
Definition: StatusCode.h:109
StatusCode resetPreLoad() override
Clear the preload list.
Definition: DataSvc.cpp:1079
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:115
DataSvc::DataSvc ( const DataSvc )
privatedelete

Fake copy constructor (never implemented).

Member Function Documentation

StatusCode DataSvc::addPreLoadItem ( const DataStoreItem item)
override

Add an item to the preload list.

Definition at line 1050 of file DataSvc.cpp.

1051 {
1052  auto i = std::find( std::begin( m_preLoads ), std::end( m_preLoads ), item );
1053  if ( i == std::end( m_preLoads ) ) {
1054  m_preLoads.push_back( item );
1055  }
1056  return StatusCode::SUCCESS;
1057 }
LoadItems m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:70
T end(T...args)
T push_back(T...args)
T find(T...args)
T begin(T...args)
StatusCode DataSvc::addPreLoadItem ( const std::string itemPath)
override

Add an item to the preload list.

Definition at line 1060 of file DataSvc.cpp.

1061 {
1062  return addPreLoadItem( DataStoreItem( itemPath, 1 ) );
1063 }
StatusCode addPreLoadItem(const DataStoreItem &item) override
Add an item to the preload list.
Definition: DataSvc.cpp:1050
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
bool DataSvc::checkRoot ( )
inlineprotected

Check if root path is valid.

Definition at line 321 of file DataSvc.h.

321 { return 0 != m_root; }
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
StatusCode DataSvc::clearStore ( )
override

IDataManagerSvc: Remove all data objects in the data store.

Definition at line 115 of file DataSvc.cpp.

116 {
117  if ( checkRoot() ) {
118  m_root->release();
119  m_root = nullptr;
120  return SUCCESS;
121  }
122  return INVALID_ROOT;
123 }
unsigned long release() override
IInterface implementation: Reference the object.
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
StatusCode DataSvc::clearSubTree ( const std::string 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.

76 {
77  DataObject* pObject = nullptr;
78  StatusCode status = findObject( sub_tree_path, pObject );
79  if ( status.isSuccess() ) {
80  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
81  if ( node_entry ) {
82  RegEntry* parent = node_entry->parentEntry();
83  if ( parent ) {
84  parent->remove( node_entry );
85  return StatusCode::SUCCESS;
86  }
87  return INVALID_PARENT;
88  }
89  return INVALID_OBJECT;
90  }
91  return status;
92 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
virtual long remove(const std::string &name)
Remove an entry from the store.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:92
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::clearSubTree ( DataObject pObject)
override

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

Definition at line 97 of file DataSvc.cpp.

98 {
99  if ( checkRoot() ) {
100  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
101  if ( entry ) {
102  RegEntry* parent = entry->parentEntry();
103  if ( parent ) {
104  parent->remove( entry );
105  return SUCCESS;
106  }
107  return INVALID_PARENT;
108  }
109  return INVALID_OBJECT;
110  }
111  return INVALID_ROOT;
112 }
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
virtual long remove(const std::string &name)
Remove an entry from the store.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:92
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
DataObject * DataSvc::createDefaultObject ( ) const
protectedvirtual

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

Definition at line 1173 of file DataSvc.cpp.

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

Service initialization.

Service initialisation.

Definition at line 1156 of file DataSvc.cpp.

1157 {
1158  // Nothing to do: just call base class initialisation
1159  setDataLoader( nullptr ).ignore();
1160  resetPreLoad().ignore();
1161  clearStore().ignore();
1162  m_incidentSvc.reset();
1163  return Service::finalize();
1164 }
StatusCode finalize() override
Definition: Service.cpp:174
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:205
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:54
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:92
void ignore() const
Definition: StatusCode.h:109
StatusCode resetPreLoad() override
Clear the preload list.
Definition: DataSvc.cpp:1079
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:115
StatusCode DataSvc::findObject ( const std::string fullPath,
DataObject *&  pObject 
)
override

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

Definition at line 809 of file DataSvc.cpp.

810 {
811  pObject = nullptr;
812  if ( checkRoot() ) {
813  if ( path.empty() || path == m_rootName ) {
814  pObject = m_root->object();
815  return !pObject ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
816  } else if ( path.front() != SEPARATOR ) {
817  return findObject( m_rootName, path, pObject );
818  }
819  return findObject( (IRegistry*)nullptr, path, pObject );
820  }
821  return INVALID_ROOT;
822 }
DataObject * object() const override
Retrive object behind the link.
constexpr char SEPARATOR
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:57
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode DataSvc::findObject ( IRegistry pDirectory,
const std::string 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 795 of file DataSvc.cpp.

796 {
797  pObject = nullptr;
798  IRegistry* pReg = ( pRegistry ? pRegistry : m_root );
799  RegEntry* root_entry = CAST_REGENTRY( RegEntry*, pReg );
800  if ( root_entry ) {
801  if ( !path.empty() ) pReg = root_entry->find( path );
802  if ( !pReg ) return INVALID_OBJ_PATH;
803  pObject = pReg->object();
804  }
805  return ( !pObject ) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
806 }
T empty(T...args)
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
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:62
virtual DataObject * object() const =0
Retrieve object behind the link.
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
virtual IRegistry * find(const IRegistry *obj) const
Try to find an object identified by its pointer.
StatusCode DataSvc::findObject ( const std::string parentPath,
const std::string objPath,
DataObject *&  pObject 
)
override

Find object in the data store.

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

Definition at line 825 of file DataSvc.cpp.

826 {
827  DataObject* parent = nullptr;
828  StatusCode status = findObject( parentPath, parent );
829  return status.isSuccess() ? findObject( parent, objectPath, pObject ) : status;
830 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::findObject ( const std::string parentPath,
int  item,
DataObject *&  pObject 
)
override

Find object in the data store.

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

Definition at line 833 of file DataSvc.cpp.

834 {
835  return findObject( parentPath, itemToPath( item ), pObject );
836 }
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
StatusCode DataSvc::findObject ( DataObject parentObj,
const std::string objPath,
DataObject *&  pObject 
)
override

Find object in the data store.

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

Definition at line 845 of file DataSvc.cpp.

846 {
847  IRegistry* pDir = ( parentObj ? parentObj->registry() : nullptr );
848  return findObject( pDir, path, pObject );
849 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode DataSvc::findObject ( DataObject parentObj,
int  item,
DataObject *&  pObject 
)
override

Find object in the data store.

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

Definition at line 839 of file DataSvc.cpp.

840 {
841  return findObject( parentObj, itemToPath( item ), pObject );
842 }
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
IConversionSvc * DataSvc::getDataLoader ( IRegistry pReg)
protectedvirtual

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

Reimplemented in NTupleSvc.

Definition at line 1178 of file DataSvc.cpp.

1178 { return m_dataLoader.get(); }
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
Definition: DataSvc.h:52
DataObject * DataSvc::handleDataFault ( IRegistry pReg,
const std::string 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 537 of file DataSvc.cpp.

538 {
539  return i_handleDataFault( pReg, path );
540 }
DataObject * i_handleDataFault(IRegistry *pReg, boost::string_ref path=boost::string_ref{})
Definition: DataSvc.cpp:542
DataObject * DataSvc::i_handleDataFault ( IRegistry pReg,
boost::string_ref  path = boost::string_ref{} 
)
private

Definition at line 542 of file DataSvc.cpp.

543 {
544  if ( m_enableFaultHdlr ) {
545  IRegistry* pLeaf = nullptr;
546  if ( pReg && path.empty() ) {
547  DataIncident incident( name(), m_faultName, pReg->identifier() );
548  m_incidentSvc->fireIncident( incident );
549  return pReg->object();
550  }
551  if ( pReg ) {
552  std::string p = pReg->identifier();
553  if ( path.front() != SEPARATOR ) p += SEPARATOR;
554  p.append( path.data(), path.size() );
555  DataIncident incident( name(), m_faultName, p );
556  m_incidentSvc->fireIncident( incident );
557  pLeaf = m_root->findLeaf( p );
558  } else {
560  if ( path.front() != SEPARATOR ) p += SEPARATOR;
561  p.append( path.data(), path.size() );
562  DataIncident incident( name(), m_faultName, p );
563  m_incidentSvc->fireIncident( incident );
564  pLeaf = m_root->findLeaf( p );
565  }
566  if ( pLeaf ) {
567  return pLeaf->object();
568  }
569  }
570  return nullptr;
571 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
constexpr char SEPARATOR
Gaudi::Property< bool > m_enableFaultHdlr
Definition: DataSvc.h:61
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
STL class.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
Gaudi::Property< std::string > m_faultName
Definition: DataSvc.h:63
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:54
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 662 of file DataSvc.cpp.

663 {
664  // A.Valassi 16.08.2001 avoid core dump if store is empty
665  if ( !checkRoot() ) return StatusCode( INVALID_ROOT, true );
666 
667  static const auto empty = boost::string_ref{};
668  auto sep = find( path, SEPARATOR, 1 );
669  pEntry = nullptr;
670 
671  if ( !parentObj ) {
672  if ( path.empty() || path == m_rootName ) {
673  parentObj = m_root;
674  path = empty;
675  } else if ( path.front() != SEPARATOR ) {
676  parentObj = m_root;
677  } else if ( sep != boost::string_ref::npos ) {
678  if ( !m_root->object() ) {
679  RegEntry* r = nullptr;
680  auto status = i_retrieveEntry( m_root, empty, r );
681  if ( !status.isSuccess() ) return status;
682  }
683  parentObj = m_root;
684  path = path.substr( sep );
685  } else {
686  return INVALID_OBJ_PATH;
687  }
688  sep = find( path, SEPARATOR, 1 );
689  }
690 
691  StatusCode status = StatusCode( INVALID_ROOT, true );
692  if ( sep != boost::string_ref::npos ) { // the string contains a separator (after pos 0)
693  if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
694  status = loadObject( parentObj );
695  if ( !status.isSuccess() ) return status;
696  }
697  auto p_path = path.substr( 0, sep );
698  RegEntry* root_entry = parentObj->findLeaf( p_path );
699  if ( !root_entry && m_enableFaultHdlr ) {
700  // If not even the parent is there, an incident
701  // to load the parent must be fired...
702  i_handleDataFault( parentObj, p_path );
703  root_entry = parentObj->findLeaf( p_path );
704  }
705  if ( root_entry ) {
706  DataObject* pO = root_entry->object();
707  if ( !pO ) {
708  // Object is not loaded: load the object if at all possible
709  status = loadObject( root_entry );
710  if ( !status.isSuccess() ) return status;
711  }
712  if ( root_entry->isSoft() ) {
713  root_entry = CAST_REGENTRY( RegEntry*, pO->registry() );
714  }
715  return i_retrieveEntry( root_entry, path.substr( sep ), pEntry );
716  }
717  return status;
718  } else if ( path.empty() ) {
719  pEntry = parentObj;
720  } else {
721  if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
722  status = loadObject( parentObj );
723  if ( !status.isSuccess() ) return status;
724  }
725  // last leave in search: find leaf and load
726  pEntry = parentObj->findLeaf( path );
727  // If no registry entry was found, trigger incident for action-on-demand
728  if ( !pEntry && m_enableFaultHdlr ) {
729  i_handleDataFault( parentObj, path );
730  pEntry = ( path.empty() ? parentObj : parentObj->findLeaf( path ) );
731  }
732  }
733 
734  // Check results and return
735  if ( !pEntry ) return INVALID_OBJ_PATH;
736  if ( !pEntry->object() ) return loadObject( pEntry );
737 
738  if ( m_enableAccessHdlr ) {
739  // Fire data access incident
740  // I do not know if this is a good idea....
741  // This fires too often!
742  //
743  // DataIncident incident(name(), m_accessName, pEntry->identifier());
744  // m_incidentSvc->fireIncident(incident);
745  return SUCCESS;
746  }
747  return SUCCESS;
748 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
DataObject * object() const override
Retrive object behind the link.
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:57
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: DataSvc.cpp:576
Gaudi::Property< bool > m_enableFaultHdlr
Definition: DataSvc.h:61
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
DataObject * i_handleDataFault(IRegistry *pReg, boost::string_ref path=boost::string_ref{})
Definition: DataSvc.cpp:542
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
virtual bool isSoft() const
Is the link soft or hard.
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:662
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
#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)
Gaudi::Property< bool > m_enableAccessHdlr
Definition: DataSvc.h:65
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
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 167 of file DataSvc.cpp.

168 {
169  if ( pRootObj ) {
170  m_root = new RegEntry( std::move( root_path ) );
171  m_root->makeHard( pRootObj );
172  m_root->setDataSvc( this );
173  // No done with GaudiHive. preLoad().ignore();
174  }
175  return SUCCESS;
176 }
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:90
T move(T...args)
DataSvcHelpers::RegistryEntry RegEntry
Definition: DataSvc.cpp:64
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 193 of file DataSvc.cpp.

194 {
195  if ( pRootAddr ) {
196  m_root = new RegEntry( std::move( root_path ) );
197  m_root->makeHard( pRootAddr );
198  m_root->setDataSvc( this );
199  // Not done with GaudiHive. preLoad().ignore();
200  }
201  return SUCCESS;
202 }
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:90
T move(T...args)
DataSvcHelpers::RegistryEntry RegEntry
Definition: DataSvc.cpp:64
void makeHard(DataObject *pObject)
Initialize link as hard link.
StatusCode DataSvc::initialize ( )
override

Service initialization.

Definition at line 1119 of file DataSvc.cpp.

1120 {
1121  // Nothing to do: just call base class initialisation
1123  if ( UNLIKELY( !sc.isSuccess() ) ) return sc;
1124  m_incidentSvc = service( "IncidentSvc", true );
1125  if ( UNLIKELY( !m_incidentSvc ) ) {
1126  error() << "Failed to access incident service." << endmsg;
1127  }
1128  return sc;
1129 }
#define UNLIKELY(x)
Definition: Kernel.h:128
StatusCode initialize() override
Definition: Service.cpp:64
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:54
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:85
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode DataSvc::linkObject ( IRegistry from,
const std::string objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 931 of file DataSvc.cpp.

932 {
933  if ( checkRoot() ) {
934  try {
935  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
936  if ( from_entry ) {
937  // First check if both objects are already registered to the store
938  RegEntry* to_entry = m_root->findLeaf( to );
939  if ( !to_entry ) {
940  return INVALID_OBJECT;
941  }
942  std::string::size_type sep = objPath.rfind( SEPARATOR );
943  if ( sep > 0 && sep != std::string::npos ) { // in case the objPath is a sub-directory itself
944  DataObject* pO = nullptr;
945  StatusCode sc = retrieveObject( from, objPath.substr( 0, sep ), pO );
946  if ( sc.isSuccess() ) {
947  sc = linkObject( pO->registry(), objPath.substr( sep ), to );
948  }
949  return sc;
950  }
951  // Now register the soft link
952  StatusCode status = from_entry->add( objPath, to, true );
953  return status.isSuccess() ? IDataProviderSvc_NO_ERROR : DOUBL_OBJ_PATH;
954  }
955  } catch ( ... ) {
956  }
957  return INVALID_PARENT;
958  }
959  return INVALID_ROOT;
960 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
virtual long add(const std::string &name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
T rfind(T...args)
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
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:28
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:751
StatusCode linkObject(IRegistry *from, const std::string &objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:931
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
T substr(T...args)
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::linkObject ( const std::string fromPath,
const std::string objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 976 of file DataSvc.cpp.

977 {
978  DataObject* pO = nullptr;
979  StatusCode status = retrieveObject( from, pO );
980  return status.isSuccess() ? linkObject( pO->registry(), objPath, to ) : status;
981 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
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:28
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:751
StatusCode linkObject(IRegistry *from, const std::string &objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:931
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::linkObject ( DataObject from,
const std::string objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 984 of file DataSvc.cpp.

985 {
986  if ( from ) {
987  IRegistry* from_entry = from->registry();
988  if ( from_entry ) {
989  return linkObject( from_entry, objPath, to );
990  }
991  }
992  return INVALID_PARENT;
993 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
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, const std::string &objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:931
StatusCode DataSvc::linkObject ( const std::string fullPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 963 of file DataSvc.cpp.

964 {
965  if ( !fullPath.empty() ) {
966  if ( fullPath.front() != SEPARATOR ) {
967  return linkObject( m_rootName, fullPath, to );
968  }
969  auto sep = fullPath.rfind( SEPARATOR );
970  return linkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ), to );
971  }
972  return INVALID_OBJ_PATH;
973 }
T empty(T...args)
constexpr char SEPARATOR
T front(T...args)
T rfind(T...args)
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:57
StatusCode linkObject(IRegistry *from, const std::string &objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:931
T substr(T...args)
StatusCode DataSvc::loadObject ( IRegistry pNode)
protectedvirtual

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

Definition at line 576 of file DataSvc.cpp.

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

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

Definition at line 585 of file DataSvc.cpp.

586 {
587  StatusCode status = INVALID_OBJ_ADDR;
588  DataObject* pObject = nullptr;
589  if ( !pLoader ) { // Precondition: Data loader must be present
590  return handleDataFault( pRegistry ) ? StatusCode{SUCCESS} : NO_DATA_LOADER;
591  }
592  if ( !pRegistry ) { // Precondition: Directory must be valid
593  return handleDataFault( pRegistry ) ? StatusCode{SUCCESS} : INVALID_OBJ_ADDR;
594  }
595 
596  VERMSG << "Requested object " << pRegistry->identifier() << endmsg;
597 
598  if ( m_enableAccessHdlr ) {
599  // Fire data access incident
600  DataIncident incident( name(), m_accessName, pRegistry->identifier() );
601  m_incidentSvc->fireIncident( incident );
602  }
603  if ( !m_inhibitPathes.empty() ) {
604  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), pRegistry->identifier() );
605  if ( inhibit != m_inhibitPathes.end() ) {
606  return NO_ACCESS;
607  }
608  }
609  IOpaqueAddress* pAddress = pRegistry->address();
610  if ( !pAddress ) { // Precondition:
611  return INVALID_OBJ_ADDR; // Address must be valid
612  }
613  try {
614  status = pLoader->createObj( pAddress, pObject ); // Call data loader
615  if ( status.isSuccess() ) {
616 
617  VERMSG << "Object " << pRegistry->identifier() << " created" << endmsg;
618 
619  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pRegistry );
620  pEntry->setObject( pObject );
621 
622  VERMSG << "Filling object " << pRegistry->identifier() << endmsg;
623  status = pLoader->fillObjRefs( pAddress, pObject );
624  }
625  } catch ( const GaudiException& exc ) {
626  if ( handleDataFault( pRegistry ) ) {
627  return SUCCESS;
628  }
629  throw GaudiException( "GaudiException in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE,
630  exc );
631  } catch ( const std::exception& x ) {
632  if ( handleDataFault( pRegistry ) ) {
633  return SUCCESS;
634  }
635  throw GaudiException( "std::exception in loadObject() " + pRegistry->identifier() + ": " +
636  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
638  } catch ( ... ) {
639  if ( handleDataFault( pRegistry ) ) {
640  return SUCCESS;
641  }
642  throw GaudiException( "UNKN exception in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE );
643  }
644  if ( !status.isSuccess() ) {
645  if ( handleDataFault( pRegistry ) ) {
646  return StatusCode::SUCCESS;
647  }
648  }
649  ON_VERBOSE if ( status.isSuccess() )
650  {
651  verbose() << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
652  }
653  return status;
654 }
#define VERMSG
Definition: DataSvc.cpp:70
Define general base for Gaudi exception.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
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:329
Gaudi::Property< std::string > m_accessName
Definition: DataSvc.h:67
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
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:28
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:54
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:59
T find(T...args)
DataObject * handleDataFault(IRegistry *pReg, const std::string &path="")
Invoke data fault handling if enabled.
Definition: DataSvc.cpp:537
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
Gaudi::Property< bool > m_enableAccessHdlr
Definition: DataSvc.h:65
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:29
#define ON_VERBOSE
Definition: DataSvc.cpp:67
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
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 229 of file DataSvc.cpp.

230 {
231  if ( !pObject ) return INVALID_OBJECT;
232  return objectLeaves( pObject->registry(), leaves );
233 }
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:229
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 238 of file DataSvc.cpp.

239 {
240  if ( !checkRoot() ) return INVALID_ROOT;
241  const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
242  if ( !node_entry ) return INVALID_OBJECT;
243  leaves = node_entry->leaves();
244  return StatusCode::SUCCESS;
245 }
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
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
StatusCode DataSvc::objectParent ( const DataObject pObject,
IRegistry *&  refpParent 
)
override

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

Definition at line 213 of file DataSvc.cpp.

214 {
215  if ( !pObject ) return INVALID_OBJECT;
216  return objectParent( pObject->registry(), refpParent );
217 }
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:213
StatusCode DataSvc::objectParent ( const IRegistry pRegistry,
IRegistry *&  refpParent 
)
override

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

Definition at line 219 of file DataSvc.cpp.

220 {
221  if ( !checkRoot() ) return INVALID_ROOT;
222  const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
223  if ( !node_entry ) return INVALID_OBJECT;
224  refpParent = node_entry->parent();
225  return StatusCode::SUCCESS;
226 }
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
virtual IRegistry * parent() const
Pointer to parent directory entry.
DataSvc& DataSvc::operator= ( const DataSvc )
privatedelete

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

1087 {
1088  // unused: StatusCode sc = StatusCode::FAILURE;
1089  if ( pObject && depth++ < load_depth ) {
1090  RegEntry* dir = CAST_REGENTRY( RegEntry*, pObject->registry() );
1091  if ( dir ) {
1092  for ( const auto& i : *dir ) {
1093  DataObject* pObj = nullptr;
1094  StatusCode status = retrieveObject( pObject, i->name(), pObj );
1095  if ( status.isSuccess() && depth < load_depth ) {
1096  preLoad( depth, load_depth, pObj ).ignore();
1097  }
1098  }
1099  }
1100  }
1101  return StatusCode::SUCCESS;
1102 }
StatusCode preLoad() override
load all preload items of the list
Definition: DataSvc.cpp:1105
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
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:28
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:751
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
Definition: DataObject.cpp:68
void ignore() const
Definition: StatusCode.h:109
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::preLoad ( )
override

load all preload items of the list

Definition at line 1105 of file DataSvc.cpp.

1106 {
1107  DataObject* pObj = nullptr;
1108  for ( const auto& i : m_preLoads ) {
1109  StatusCode sc = retrieveObject( i.path(), pObj );
1110  int load_depth = i.depth();
1111  if ( sc.isSuccess() && load_depth > 1 ) {
1112  preLoad( 1, load_depth, pObj ).ignore();
1113  }
1114  }
1115  return StatusCode::SUCCESS;
1116 }
StatusCode preLoad() override
load all preload items of the list
Definition: DataSvc.cpp:1105
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
LoadItems m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:70
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:751
void ignore() const
Definition: StatusCode.h:109
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::registerAddress ( const std::string fullPath,
IOpaqueAddress pAddress 
)
override

IDataManagerSvc: Register object address with the data store.

Definition at line 248 of file DataSvc.cpp.

249 {
250  if ( fullPath.empty() ) return INVALID_OBJ_PATH;
251  return registerAddress( fullPath.front() != SEPARATOR ? m_root : nullptr, fullPath, pAddress );
252 }
T empty(T...args)
constexpr char SEPARATOR
T front(T...args)
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
StatusCode registerAddress(const std::string &fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:248
StatusCode DataSvc::registerAddress ( DataObject parentObj,
const std::string objectPath,
IOpaqueAddress pAddress 
)
override

IDataManagerSvc: Register object address with the data store.

Definition at line 255 of file DataSvc.cpp.

256 {
257  IRegistry* pRegistry = ( parentObj ? parentObj->registry() : nullptr );
258  return registerAddress( pRegistry, objectPath, pAddress );
259 }
StatusCode registerAddress(const std::string &fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:248
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode DataSvc::registerAddress ( IRegistry parentObj,
const std::string objectPath,
IOpaqueAddress pAddress 
)
override

IDataManagerSvc: Register object address with the data store.

Definition at line 262 of file DataSvc.cpp.

263 {
264  if ( !checkRoot() ) return INVALID_ROOT;
265  if ( objPath.empty() ) return INVALID_OBJ_PATH;
266 
267  if ( !parentObj ) {
268  if ( objPath.front() != SEPARATOR ) {
269  return registerAddress( m_root, objPath, pAddress );
270  }
271  std::string::size_type sep = objPath.find( SEPARATOR, 1 );
272  if ( sep == std::string::npos ) {
273  return INVALID_PARENT;
274  }
275  if ( objPath.compare( 0, sep, m_rootName ) == 0 ) {
276  return registerAddress( m_root, objPath.substr( sep ), pAddress );
277  }
278  }
279  if ( objPath.front() != SEPARATOR ) {
280  return registerAddress( parentObj, char( SEPARATOR ) + objPath, pAddress );
281  }
282  RegEntry* par_entry = CAST_REGENTRY( RegEntry*, parentObj );
283  if ( !par_entry ) return INVALID_PARENT;
284 
285  std::string::size_type sep = objPath.rfind( SEPARATOR );
286  if ( sep > 0 && sep != std::string::npos ) {
287  auto p_path = objPath.substr( 0, sep );
288  auto o_path = objPath.substr( sep );
289  RegEntry* p_entry = par_entry->findLeaf( p_path );
290  // Create default object leafs if the
291  // intermediate nodes are not present
292  if ( !p_entry && m_forceLeaves ) {
293  DataObject* pLeaf = createDefaultObject();
294  StatusCode sc = registerObject( par_entry->identifier(), p_path, pLeaf );
295  if ( sc.isFailure() ) delete pLeaf;
296  p_entry = par_entry->findLeaf( p_path );
297  }
298  if ( !p_entry ) return INVALID_PARENT;
299  return registerAddress( p_entry, o_path, pAddress );
300  }
301  StatusCode status = par_entry->add( objPath, pAddress );
302  return status.isSuccess() ? status : DOUBL_OBJ_PATH;
303 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
virtual long add(const std::string &name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:57
Gaudi::Property< bool > m_forceLeaves
Definition: DataSvc.h:58
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
StatusCode registerObject(const std::string &fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:353
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
StatusCode registerAddress(const std::string &fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:248
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
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:29
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:1173
StatusCode DataSvc::registerObject ( const std::string fullPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 353 of file DataSvc.cpp.

354 {
355  return registerObject( nullptr, fullPath, pObject );
356 }
StatusCode registerObject(const std::string &fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:353
StatusCode DataSvc::registerObject ( const std::string parentPath,
const std::string objPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 359 of file DataSvc.cpp.

360 {
361  DataObject* pO = nullptr;
362  StatusCode status = retrieveObject( parentPath, pO );
363  if ( !status.isSuccess() && m_forceLeaves ) {
364  pO = createDefaultObject();
365  status = registerObject( parentPath, pO );
366  if ( !status.isSuccess() ) pO->release();
367  }
368  if ( status.isFailure() ) return status;
369  return registerObject( pO, objPath, pObject );
370 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
Gaudi::Property< bool > m_forceLeaves
Definition: DataSvc.h:58
StatusCode registerObject(const std::string &fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:353
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:751
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:51
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:1173
StatusCode DataSvc::registerObject ( const std::string parentPath,
int  item,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 373 of file DataSvc.cpp.

374 {
375  return registerObject( parentPath, itemToPath( item ), pObject );
376 }
StatusCode registerObject(const std::string &fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:353
StatusCode DataSvc::registerObject ( DataObject parentObj,
const std::string objPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 385 of file DataSvc.cpp.

386 {
387  if ( !checkRoot() ) return INVALID_ROOT;
388 
389  if ( !parentObj ) {
390  if ( !objPath.empty() ) {
391  if ( objPath.front() == SEPARATOR ) {
392  auto sep = objPath.find( SEPARATOR, 1 );
393  if ( sep != std::string::npos ) {
394  return registerObject( objPath.substr( 0, sep ), objPath.substr( sep ), pObject );
395  }
396  } else {
397  return registerObject( m_rootName, objPath, pObject );
398  }
399  }
400  return INVALID_OBJ_PATH;
401  }
402  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, parentObj->registry() );
403  if ( node_entry ) {
404  StatusCode status = INVALID_PARENT;
405  auto sep = objPath.find( SEPARATOR, 1 );
406  if ( sep != std::string::npos ) {
407  auto p_path = objPath.substr( 0, sep );
408  auto o_path = objPath.substr( sep );
409  RegEntry* par_entry = node_entry->findLeaf( p_path );
410  // Create default object leafs if the
411  // intermediate nodes are not present
412  if ( !par_entry && m_forceLeaves ) {
413  DataObject* pLeaf = createDefaultObject();
414  StatusCode sc = registerObject( parentObj, p_path, pLeaf );
415  if ( !sc.isSuccess() ) delete pLeaf;
416  par_entry = node_entry->findLeaf( p_path );
417  } else if ( par_entry && !par_entry->object() ) {
418  status = i_retrieveEntry( node_entry, p_path, par_entry );
419  if ( !status.isSuccess() && !par_entry->address() && m_forceLeaves ) {
420  DataObject* pLeaf = createDefaultObject();
421  StatusCode sc = registerObject( parentObj, p_path, pLeaf );
422  if ( !sc.isSuccess() ) delete pLeaf;
423  par_entry = node_entry->findLeaf( p_path );
424  }
425  }
426  node_entry = par_entry;
427  if ( node_entry ) {
428  DataObject* obj = node_entry->object();
429  if ( obj ) {
430  status = registerObject( obj, o_path, pObject );
431  }
432  }
433  } else {
434  RegEntry* leaf = node_entry->findLeaf( objPath );
435  if ( !leaf ) {
436  status = node_entry->add( objPath, pObject );
437  } else {
438  DataObject* obj = leaf->object();
439  if ( !obj ) {
440  if ( !pObject ) {
441  error() << "registerObject: trying to register null DataObject" << endmsg;
442  return StatusCode::FAILURE;
443  }
444  pObject->setRegistry( leaf );
445  leaf->setAddress( nullptr );
446  leaf->setObject( pObject );
447  status = StatusCode::SUCCESS;
448  } else {
449  status = DOUBL_OBJ_PATH;
450  }
451  }
452  }
453  return status;
454  }
455  return INVALID_PARENT;
456 }
T empty(T...args)
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
DataObject * object() const override
Retrive object behind the link.
constexpr char SEPARATOR
T front(T...args)
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
virtual long add(const std::string &name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:57
Gaudi::Property< bool > m_forceLeaves
Definition: DataSvc.h:58
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition: DataObject.h:70
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
StatusCode registerObject(const std::string &fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:353
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
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:662
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
IOpaqueAddress * address() const override
Retrieve opaque storage address.
#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)
T substr(T...args)
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:1173
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode DataSvc::registerObject ( DataObject parentObj,
int  item,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 379 of file DataSvc.cpp.

380 {
381  return registerObject( parentObj, itemToPath( item ), pObject );
382 }
StatusCode registerObject(const std::string &fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:353
StatusCode DataSvc::reinitialize ( )
override

Service initialization.

Service reinitialization.

Definition at line 1132 of file DataSvc.cpp.

1133 {
1134  // the finalize part is copied here
1135  setDataLoader( nullptr ).ignore();
1136  resetPreLoad().ignore();
1137  clearStore().ignore();
1138  m_incidentSvc.reset();
1139  // re-initialize the base class
1141  if ( UNLIKELY( !sc.isSuccess() ) ) {
1142  error() << "Unable to reinitialize base class" << endmsg;
1143  return sc;
1144  }
1145  // the initialize part is copied here
1146  m_incidentSvc = service( "IncidentSvc", true );
1147  if ( UNLIKELY( !m_incidentSvc ) ) {
1148  error() << "Failed to access incident service." << endmsg;
1149  return StatusCode::FAILURE;
1150  }
1151  // return
1152  return StatusCode::SUCCESS;
1153 }
#define UNLIKELY(x)
Definition: Kernel.h:128
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
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:205
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:54
StatusCode reinitialize() override
Definition: Service.cpp:250
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:85
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:92
void ignore() const
Definition: StatusCode.h:109
StatusCode resetPreLoad() override
Clear the preload list.
Definition: DataSvc.cpp:1079
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:115
StatusCode DataSvc::removePreLoadItem ( const DataStoreItem item)
override

Remove an item from the preload list.

Definition at line 1066 of file DataSvc.cpp.

1067 {
1069  return StatusCode::SUCCESS;
1070 }
LoadItems m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:70
T end(T...args)
T remove(T...args)
T erase(T...args)
T begin(T...args)
StatusCode DataSvc::removePreLoadItem ( const std::string itemPath)
override

Add an item to the preload list.

Definition at line 1073 of file DataSvc.cpp.

1074 {
1075  return removePreLoadItem( DataStoreItem( itemPath, 1 ) );
1076 }
StatusCode removePreLoadItem(const DataStoreItem &item) override
Remove an item from the preload list.
Definition: DataSvc.cpp:1066
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
StatusCode DataSvc::resetPreLoad ( )
override

Clear the preload list.

Definition at line 1079 of file DataSvc.cpp.

1080 {
1082  return StatusCode::SUCCESS;
1083 }
LoadItems m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:70
T end(T...args)
T erase(T...args)
T begin(T...args)
StatusCode DataSvc::retrieveEntry ( DataSvcHelpers::RegistryEntry pNode,
const std::string path,
DataSvcHelpers::RegistryEntry *&  pEntry 
)
protected

Retrieve registry entry from store.

Definition at line 657 of file DataSvc.cpp.

658 {
659  return i_retrieveEntry( parentObj, path, pEntry );
660 }
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:662
StatusCode DataSvc::retrieveObject ( IRegistry pDirectory,
const std::string path,
DataObject *&  pObject 
)
override

Retrieve object from data store.

Retrieve object identified by its directory from the data store.

Definition at line 751 of file DataSvc.cpp.

752 {
753  pObject = nullptr;
754  RegEntry *result = nullptr, *parent = CAST_REGENTRY( RegEntry *, pRegistry );
755  StatusCode status = i_retrieveEntry( parent, path, result );
756  if ( status.isSuccess() ) pObject = result->object();
757  return status;
758 }
DataObject * object() const override
Retrive object behind the link.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:662
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
StatusCode DataSvc::retrieveObject ( const std::string fullPath,
DataObject *&  pObject 
)
override

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

Definition at line 761 of file DataSvc.cpp.

762 {
763  IRegistry* nullDir = nullptr;
764  return retrieveObject( nullDir, fullPath, pObject );
765 }
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:751
StatusCode DataSvc::retrieveObject ( const std::string parentPath,
const std::string objPath,
DataObject *&  pObject 
)
override

Retrieve object from data store.

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

Definition at line 768 of file DataSvc.cpp.

769 {
770  DataObject* parent = nullptr;
771  StatusCode status = retrieveObject( parentPath, parent );
772  return status.isSuccess() ? retrieveObject( parent, objectPath, pObject ) : status;
773 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:751
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::retrieveObject ( const std::string parentPath,
int  item,
DataObject *&  pObject 
)
override

Retrieve object from data store.

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

Definition at line 776 of file DataSvc.cpp.

777 {
778  return retrieveObject( parentPath, itemToPath( item ), pObject );
779 }
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:751
StatusCode DataSvc::retrieveObject ( DataObject parentObj,
const std::string objPath,
DataObject *&  pObject 
)
override

Retrieve object from data store.

Definition at line 782 of file DataSvc.cpp.

783 {
784  IRegistry* pRegistry = ( parentObj ? parentObj->registry() : nullptr );
785  return retrieveObject( pRegistry, path, pObject );
786 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:751
StatusCode DataSvc::retrieveObject ( DataObject parentObj,
int  item,
DataObject *&  pObject 
)
override

Retrieve object from data store.

Retrieve registry entry from store.

Definition at line 789 of file DataSvc.cpp.

790 {
791  return retrieveObject( parentObj, itemToPath( item ), pObject );
792 }
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:751
CLID DataSvc::rootCLID ( ) const
override

IDataManagerSvc: Accessor for root event CLID.

CLID for root Event.

Definition at line 1167 of file DataSvc.cpp.

1167 { return ( (CLID)m_rootCLID ); }
Gaudi::Property< CLID > m_rootCLID
Definition: DataSvc.h:56
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 1170 of file DataSvc.cpp.

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

206 {
207  m_dataLoader = pDataLoader;
208  if ( m_dataLoader ) m_dataLoader->setDataProvider( dpsvc ? dpsvc : this ).ignore();
209  return SUCCESS;
210 }
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
Definition: DataSvc.h:52
void ignore() const
Definition: StatusCode.h:109
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 156 of file DataSvc.cpp.

157 {
158  clearStore().ignore();
159  return i_setRoot( std::move( root_path ), pRootObj );
160 }
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:167
void ignore() const
Definition: StatusCode.h:109
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:115
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 182 of file DataSvc.cpp.

183 {
184  clearStore().ignore();
185  return i_setRoot( std::move( root_path ), pRootAddr );
186 }
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:167
void ignore() const
Definition: StatusCode.h:109
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:115
StatusCode DataSvc::traverseSubTree ( const std::string 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 128 of file DataSvc.cpp.

129 {
130  DataObject* pO = nullptr;
131  StatusCode status = findObject( sub_tree_path, pO );
132  if ( status.isFailure() ) return status;
133  return traverseSubTree( pO, pAgent );
134 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
StatusCode traverseSubTree(const std::string &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:128
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
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 137 of file DataSvc.cpp.

138 {
139  if ( !checkRoot() ) return INVALID_ROOT;
140  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
141  if ( !entry ) return INVALID_OBJECT;
142  return entry->traverseTree( pAgent );
143 }
virtual long traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
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 146 of file DataSvc.cpp.

147 {
148  if ( !checkRoot() ) return INVALID_ROOT;
149  return m_root->traverseTree( pAgent );
150 }
virtual long traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
StatusCode DataSvc::unlinkObject ( IRegistry from,
const std::string objPath 
)
override

Remove a link to another object.

Definition at line 996 of file DataSvc.cpp.

997 {
998  if ( checkRoot() ) {
999  try {
1000  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
1001  if ( from_entry ) {
1002  std::string::size_type sep = objPath.rfind( SEPARATOR );
1003  if ( sep > 0 && sep != std::string::npos ) { // in case the objPath is a sub-directory itself
1004  DataObject* pO = nullptr;
1005  StatusCode sc = findObject( from, objPath.substr( 0, sep ), pO );
1006  if ( sc.isSuccess() ) {
1007  sc = unlinkObject( pO->registry(), objPath.substr( sep ) );
1008  }
1009  return sc;
1010  }
1011  StatusCode status = from_entry->remove( objPath );
1012  if ( status.isSuccess() ) return status;
1013  return INVALID_OBJ_PATH;
1014  }
1015  } catch ( ... ) {
1016  }
1017  return INVALID_PARENT;
1018  }
1019  return INVALID_ROOT;
1020 }
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
T rfind(T...args)
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
virtual long remove(const std::string &name)
Remove an entry from the store.
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:28
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
StatusCode unlinkObject(IRegistry *from, const std::string &objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:996
T substr(T...args)
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::unlinkObject ( const std::string fromPath,
const std::string objPath 
)
override

Remove a link to another object.

Definition at line 1034 of file DataSvc.cpp.

1035 {
1036  DataObject* pObject = nullptr;
1037  StatusCode status = findObject( from, pObject );
1038  return status.isSuccess() ? unlinkObject( pObject->registry(), objPath ) : status;
1039 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
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:28
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
StatusCode unlinkObject(IRegistry *from, const std::string &objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:996
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::unlinkObject ( DataObject fromObj,
const std::string objPath 
)
override

Remove a link to another object.

Definition at line 1042 of file DataSvc.cpp.

1043 {
1044  if ( !checkRoot() ) return INVALID_ROOT;
1045  IRegistry* from_entry = m_root->findLeaf( from );
1046  return unlinkObject( from_entry, objPath );
1047 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode unlinkObject(IRegistry *from, const std::string &objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:996
StatusCode DataSvc::unlinkObject ( const std::string fullPath)
override

Remove a link to another object.

Definition at line 1023 of file DataSvc.cpp.

1024 {
1025  if ( fullPath.empty() ) return INVALID_OBJ_PATH;
1026  if ( fullPath.front() != SEPARATOR ) {
1027  return unlinkObject( m_rootName, fullPath );
1028  }
1029  auto sep = fullPath.rfind( SEPARATOR );
1030  return unlinkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ) );
1031 }
T empty(T...args)
constexpr char SEPARATOR
T front(T...args)
T rfind(T...args)
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:57
StatusCode unlinkObject(IRegistry *from, const std::string &objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:996
T substr(T...args)
StatusCode DataSvc::unregisterAddress ( const std::string fullPath)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 306 of file DataSvc.cpp.

307 {
308  if ( fullPath.empty() ) return INVALID_OBJ_PATH;
309  return unregisterAddress( fullPath.front() != SEPARATOR ? m_root : nullptr, fullPath );
310 }
T empty(T...args)
constexpr char SEPARATOR
T front(T...args)
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
StatusCode unregisterAddress(const std::string &fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:306
StatusCode DataSvc::unregisterAddress ( DataObject pParent,
const std::string objPath 
)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 313 of file DataSvc.cpp.

314 {
315  return unregisterAddress( pParent ? pParent->registry() : nullptr, objPath );
316 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
StatusCode unregisterAddress(const std::string &fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:306
StatusCode DataSvc::unregisterAddress ( IRegistry pParent,
const std::string objPath 
)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 319 of file DataSvc.cpp.

320 {
321  if ( !checkRoot() ) return INVALID_ROOT;
322  if ( objPath.empty() ) return INVALID_OBJ_PATH;
323 
324  if ( !pParent ) {
325  if ( objPath.front() != SEPARATOR ) {
326  return unregisterAddress( m_root, objPath );
327  }
328  std::string::size_type sep = objPath.find( SEPARATOR, 1 );
329  if ( sep != std::string::npos && objPath.compare( 0, sep, m_rootName ) == 0 ) {
330  return unregisterAddress( m_root, objPath.substr( sep ) );
331  }
332  return INVALID_PARENT;
333  }
334  if ( objPath.front() != SEPARATOR ) {
335  return unregisterAddress( pParent, char( SEPARATOR ) + objPath );
336  }
337  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pParent );
338  if ( node_entry ) {
339  RegEntry* leaf_entry = node_entry->findLeaf( objPath );
340  if ( leaf_entry ) {
341  std::string::size_type sep = objPath.rfind( SEPARATOR );
342  if ( sep > 0 && sep != std::string::npos ) {
343  return unregisterAddress( leaf_entry->parent(), objPath.substr( sep ) );
344  }
345  StatusCode status = node_entry->remove( objPath );
346  if ( status.isSuccess() ) return status;
347  }
348  }
349  return INVALID_PARENT;
350 }
T empty(T...args)
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
constexpr char SEPARATOR
T front(T...args)
T rfind(T...args)
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:57
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
virtual long remove(const std::string &name)
Remove an entry from the store.
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode unregisterAddress(const std::string &fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:306
#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)
virtual IRegistry * parent() const
Pointer to parent directory entry.
T substr(T...args)
T compare(T...args)
StatusCode DataSvc::unregisterObject ( const std::string fullPath)
override

Unregister object from the data store.

Definition at line 459 of file DataSvc.cpp.

460 {
461  DataObject* pObject = nullptr;
462  StatusCode status = findObject( fullPath, pObject );
463  if ( status.isFailure() ) return status;
464  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pObject->registry() );
465  if ( !pEntry ) return INVALID_ROOT;
466  if ( !pEntry->isEmpty() ) return DIR_NOT_EMPTY;
467  RegEntry* pParent = pEntry->parentEntry();
468  if ( !pParent ) return INVALID_PARENT;
469  if ( pObject ) pObject->addRef();
470  pParent->remove( pEntry );
471  return StatusCode::SUCCESS;
472 }
virtual long remove(const std::string &name)
Remove an entry from the store.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:92
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:59
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
virtual bool isEmpty() const
Simple check if the Container is empty.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::unregisterObject ( const std::string parentPath,
const std::string objectPath 
)
override

Unregister object from the data store.

Definition at line 475 of file DataSvc.cpp.

476 {
477  DataObject* pO = nullptr;
478  StatusCode status = findObject( parentPath, pO );
479  return status.isSuccess() ? unregisterObject( pO, objPath ) : status;
480 }
StatusCode unregisterObject(const std::string &fullPath) override
Unregister object from the data store.
Definition: DataSvc.cpp:459
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::unregisterObject ( const std::string parentPath,
int  item 
)
override

Unregister object from the data store.

Definition at line 483 of file DataSvc.cpp.

484 {
485  return unregisterObject( parentPath, itemToPath( item ) );
486 }
StatusCode unregisterObject(const std::string &fullPath) override
Unregister object from the data store.
Definition: DataSvc.cpp:459
StatusCode DataSvc::unregisterObject ( DataObject pObject)
override

Unregister object from the data store.

Definition at line 489 of file DataSvc.cpp.

490 {
491  if ( !checkRoot() ) return INVALID_ROOT;
492  RegEntry* entry = m_root->findLeaf( pObject );
493  if ( !entry ) return INVALID_OBJECT;
494  RegEntry* parent = entry->parentEntry();
495  if ( !parent ) return INVALID_PARENT;
496  if ( !entry->isEmpty() ) return DIR_NOT_EMPTY;
497  if ( entry->object() ) entry->object()->addRef();
498  if ( parent ) parent->remove( entry );
499  return SUCCESS;
500 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
DataObject * object() const override
Retrive object behind the link.
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
virtual long remove(const std::string &name)
Remove an entry from the store.
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:92
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:59
virtual bool isEmpty() const
Simple check if the Container is empty.
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
StatusCode DataSvc::unregisterObject ( DataObject pObject,
const std::string objectPath 
)
override

Unregister object from the data store.

Definition at line 503 of file DataSvc.cpp.

504 {
505  if ( checkRoot() ) {
506  try {
507  RegEntry* parent = CAST_REGENTRY( RegEntry*, pParentObj->registry() );
508  if ( parent ) {
509  RegEntry* entry = parent->findLeaf( objectPath );
510  if ( entry ) {
511  if ( entry->isEmpty() ) {
512  if ( entry->object() ) {
513  entry->object()->addRef();
514  }
515  parent->remove( entry );
516  return SUCCESS;
517  }
518  return DIR_NOT_EMPTY;
519  }
520  return INVALID_OBJECT;
521  }
522  } catch ( ... ) {
523  }
524  return INVALID_PARENT;
525  }
526  return INVALID_ROOT;
527 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
DataObject * object() const override
Retrive object behind the link.
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
virtual long remove(const std::string &name)
Remove an entry from the store.
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:59
virtual bool isEmpty() const
Simple check if the Container is empty.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:62
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
StatusCode DataSvc::unregisterObject ( DataObject pObject,
int  item 
)
override

Unregister object from the data store.

Definition at line 530 of file DataSvc.cpp.

531 {
532  return unregisterObject( pParentObj, itemToPath( item ) );
533 }
StatusCode unregisterObject(const std::string &fullPath) override
Unregister object from the data store.
Definition: DataSvc.cpp:459
StatusCode DataSvc::updateObject ( IRegistry pDirectory)
override

Update object identified by its directory entry.

Update object.

Definition at line 860 of file DataSvc.cpp.

861 {
862  if ( !pRegistry ) { // Precondition:
863  return INVALID_OBJ_ADDR; // Addres must be valid
864  }
865  DataObject* toUpdate = pRegistry->object();
866  if ( !toUpdate ) { // Try first to load
867  return loadObject( pRegistry );
868  }
869  return updateObject( toUpdate );
870 }
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: DataSvc.cpp:576
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:860
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::updateObject ( const std::string updatePath)
override

Update object.

Definition at line 852 of file DataSvc.cpp.

853 {
854  DataObject* pO = nullptr;
855  StatusCode status = findObject( updatePath, pO );
856  return status.isSuccess() ? updateObject( pO ) : retrieveObject( updatePath, pO );
857 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:751
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:860
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::updateObject ( DataObject toUpdate)
override

Update object.

Definition at line 873 of file DataSvc.cpp.

874 {
875  StatusCode status = INVALID_OBJ_ADDR;
876  if ( !toUpdate ) { // Precondition:
877  return INVALID_OBJECT; // Address must be valid
878  }
879  IRegistry* pRegistry = toUpdate->registry(); // Precondition:
880  if ( !pRegistry ) { // Need valid registry
881  return INVALID_OBJECT;
882  }
883  IOpaqueAddress* pAddress = pRegistry->address(); // Precondition:
884  if ( !pAddress ) { // Need valid address
885  return INVALID_OBJ_ADDR;
886  }
887  IConversionSvc* pLoader = getDataLoader( pRegistry );
888  if ( !pLoader ) { // Precondition:
889  return NO_DATA_LOADER; // Data loader must be present
890  }
891  if ( !m_inhibitPathes.empty() ) {
892  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), pRegistry->identifier() );
893  if ( inhibit != m_inhibitPathes.end() ) {
894  return NO_ACCESS;
895  }
896  }
897  try {
898  status = pLoader->updateObj( pAddress, toUpdate ); // Call data loader
899  if ( status.isSuccess() ) {
900  status = pLoader->updateObjRefs( pAddress, toUpdate );
901  }
902  } catch ( const GaudiException& exc ) {
903  throw GaudiException( "GaudiException in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE, exc );
904  } catch ( const std::exception& x ) {
905  throw GaudiException( "std::exception in updateObject() " + pRegistry->name() + ": " +
906  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
908  } catch ( ... ) {
909  throw GaudiException( "UNKN exception in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE );
910  }
911  return status;
912 }
Define general base for Gaudi exception.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:329
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
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:28
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:59
T find(T...args)
Opaque address interface definition.
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
Definition: DataSvc.cpp:1178
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
StatusCode DataSvc::updateObject ( const std::string parentPath,
const std::string updatePath 
)
override

Update object.

Definition at line 915 of file DataSvc.cpp.

916 {
917  DataObject* pParent = nullptr;
918  StatusCode status = findObject( parentPath, pParent );
919  return status.isSuccess() ? updateObject( pParent, updatePath ) : status;
920 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:860
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
StatusCode DataSvc::updateObject ( DataObject pParent,
const std::string updatePath 
)
override

Update object.

Definition at line 923 of file DataSvc.cpp.

924 {
925  DataObject* pObject = nullptr;
926  StatusCode status = findObject( parent, updatePath, pObject );
927  return status.isSuccess() ? updateObject( pObject ) : status;
928 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:809
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:860
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29

Member Data Documentation

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

Definition at line 67 of file DataSvc.h.

SmartIF<IConversionSvc> DataSvc::m_dataLoader = nullptr
protected

Pointer to data loader service.

Definition at line 52 of file DataSvc.h.

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

Definition at line 65 of file DataSvc.h.

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

Definition at line 61 of file DataSvc.h.

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

Definition at line 63 of file DataSvc.h.

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

Definition at line 58 of file DataSvc.h.

SmartIF<IIncidentSvc> DataSvc::m_incidentSvc = nullptr
protected

Pointer to incident service.

Definition at line 54 of file DataSvc.h.

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

Map with object paths to be inhibited from loading.

Definition at line 74 of file DataSvc.h.

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

Definition at line 59 of file DataSvc.h.

LoadItems DataSvc::m_preLoads
protected

Items to be pre-loaded.

Definition at line 70 of file DataSvc.h.

DataSvcHelpers::RegistryEntry* DataSvc::m_root = nullptr
protected

Pointer to root entry.

Definition at line 72 of file DataSvc.h.

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

Definition at line 56 of file DataSvc.h.

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

Definition at line 57 of file DataSvc.h.


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