The Gaudi Framework  v28r2p1 (f1a77ff4)
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 declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
 Declare used Private tool. More...
 
template<class T >
StatusCode declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
 Declare used Public 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 1220 of file DataSvc.cpp.

1220  {
1221  setDataLoader(nullptr).ignore();
1222  resetPreLoad().ignore();
1223  clearStore().ignore();
1224 }
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:202
void ignore() const
Definition: StatusCode.h:106
StatusCode resetPreLoad() override
Clear the preload list.
Definition: DataSvc.cpp:1116
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:114
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 1090 of file DataSvc.cpp.

1090  {
1091  auto i = std::find(std::begin(m_preLoads), std::end(m_preLoads), item);
1092  if ( i == std::end(m_preLoads) ) {
1093  m_preLoads.push_back(item);
1094  }
1095  return StatusCode::SUCCESS;
1096 }
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 1099 of file DataSvc.cpp.

1099  {
1100  return addPreLoadItem( DataStoreItem(itemPath,1) );
1101 }
StatusCode addPreLoadItem(const DataStoreItem &item) override
Add an item to the preload list.
Definition: DataSvc.cpp:1090
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 114 of file DataSvc.cpp.

114  {
115  if ( checkRoot() ) {
116  m_root->release();
117  m_root = nullptr;
118  return SUCCESS;
119  }
120  return INVALID_ROOT;
121 }
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 76 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:74
virtual long remove(const std::string &name)
Remove an entry from the store.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:91
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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:30
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.

97  {
98  if ( checkRoot() ) {
99  RegEntry* entry = CAST_REGENTRY(RegEntry*,pObject->registry());
100  if ( entry ) {
101  RegEntry* parent = entry->parentEntry();
102  if ( parent ) {
103  parent->remove(entry);
104  return SUCCESS;
105  }
106  return INVALID_PARENT;
107  }
108  return INVALID_OBJECT;
109  }
110  return INVALID_ROOT;
111 }
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:74
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:91
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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 1208 of file DataSvc.cpp.

1208  {
1209  return new DataObject();
1210 }
StatusCode DataSvc::finalize ( )
override

Service initialization.

Service initialisation.

Definition at line 1188 of file DataSvc.cpp.

1188  {
1189  // Nothing to do: just call base class initialisation
1190  setDataLoader(nullptr).ignore();
1191  resetPreLoad().ignore();
1192  clearStore().ignore();
1193  m_incidentSvc.reset();
1194  return Service::finalize();
1195 }
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:202
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:88
void ignore() const
Definition: StatusCode.h:106
StatusCode resetPreLoad() override
Clear the preload list.
Definition: DataSvc.cpp:1116
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:114
StatusCode DataSvc::findObject ( const std::string fullPath,
DataObject *&  pObject 
)
override

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

Definition at line 828 of file DataSvc.cpp.

829  {
830  pObject = nullptr;
831  if ( checkRoot() ) {
832  if ( path.empty() || path == m_rootName ) {
833  pObject = m_root->object();
834  return !pObject ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
835  }
836  else if ( path.front() != SEPARATOR ) {
837  return findObject(m_rootName, path, pObject);
838  }
839  return findObject((IRegistry*)nullptr, path, pObject);
840  }
841  return INVALID_ROOT;
842 }
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:828
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 813 of file DataSvc.cpp.

815  {
816  pObject = nullptr;
817  IRegistry* pReg = ( pRegistry ? pRegistry : m_root );
818  RegEntry* root_entry = CAST_REGENTRY(RegEntry*, pReg);
819  if ( root_entry ) {
820  if ( !path.empty() ) pReg = root_entry->find(path);
821  if ( !pReg ) return INVALID_OBJ_PATH;
822  pObject = pReg->object();
823  }
824  return (!pObject) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
825 }
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:63
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 845 of file DataSvc.cpp.

847  {
848  DataObject* parent = nullptr;
849  StatusCode status = findObject(parentPath, parent);
850  return status.isSuccess() ? findObject (parent, objectPath, pObject)
851  : status;
852 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
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 855 of file DataSvc.cpp.

856  {
857  return findObject(parentPath, itemToPath(item), pObject);
858 }
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
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 868 of file DataSvc.cpp.

870  {
871  IRegistry* pDir = ( parentObj ? parentObj->registry() : nullptr );
872  return findObject(pDir, path, pObject);
873 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
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 861 of file DataSvc.cpp.

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

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

Reimplemented in NTupleSvc.

Definition at line 1215 of file DataSvc.cpp.

1215  {
1216  return m_dataLoader.get();
1217 }
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
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 546 of file DataSvc.cpp.

546  {
547  return i_handleDataFault(pReg,path);
548 }
DataObject * i_handleDataFault(IRegistry *pReg, boost::string_ref path=boost::string_ref{})
Definition: DataSvc.cpp:550
DataObject * DataSvc::i_handleDataFault ( IRegistry pReg,
boost::string_ref  path = boost::string_ref{} 
)
private

Definition at line 550 of file DataSvc.cpp.

551 {
552  if ( m_enableFaultHdlr ) {
553  IRegistry* pLeaf = nullptr;
554  if ( pReg && path.empty() ) {
555  DataIncident incident(name(), m_faultName, pReg->identifier());
556  m_incidentSvc->fireIncident(incident);
557  return pReg->object();
558  }
559  if ( pReg ) {
560  std::string p = pReg->identifier();
561  if (path.front() != SEPARATOR ) p += SEPARATOR;
562  p.append(path.data(),path.size());
563  DataIncident incident(name(), m_faultName, p);
564  m_incidentSvc->fireIncident(incident);
565  pLeaf = m_root->findLeaf(p);
566  } else {
568  if (path.front() != SEPARATOR ) p += SEPARATOR;
569  p.append(path.data(),path.size());
570  DataIncident incident(name(), m_faultName, p);
571  m_incidentSvc->fireIncident(incident);
572  pLeaf = m_root->findLeaf(p);
573  }
574  if ( pLeaf ) {
575  return pLeaf->object();
576  }
577  }
578  return nullptr;
579 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
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 673 of file DataSvc.cpp.

675  {
676  // A.Valassi 16.08.2001 avoid core dump if store is empty
677  if ( !checkRoot() ) return StatusCode(INVALID_ROOT,true);
678 
679  static const auto empty = boost::string_ref{};
680  auto sep = find(path,SEPARATOR,1);
681  pEntry = nullptr;
682 
683  if ( !parentObj ) {
684  if ( path.empty() || path == m_rootName ) {
685  parentObj = m_root;
686  path = empty;
687  } else if ( path.front() != SEPARATOR ) {
688  parentObj = m_root;
689  } else if ( sep != boost::string_ref::npos ) {
690  if ( !m_root->object() ) {
691  RegEntry* r = nullptr;
692  auto status = i_retrieveEntry(m_root, empty, r);
693  if ( !status.isSuccess() ) return status;
694  }
695  parentObj = m_root;
696  path = path.substr(sep);
697  } else {
698  return INVALID_OBJ_PATH;
699  }
700  sep = find(path,SEPARATOR,1);
701  }
702 
703  StatusCode status = StatusCode(INVALID_ROOT,true);
704  if ( sep != boost::string_ref::npos ) { // the string contains a separator (after pos 0)
705  if (!parentObj->object()) { // if the parent object has not been loaded yet, load it now
706  status = loadObject(parentObj);
707  if ( !status.isSuccess() ) return status;
708  }
709  auto p_path = path.substr(0,sep);
710  RegEntry* root_entry = parentObj->findLeaf(p_path);
711  if ( !root_entry && m_enableFaultHdlr ) {
712  // If not even the parent is there, an incident
713  // to load the parent must be fired...
714  i_handleDataFault(parentObj, p_path);
715  root_entry = parentObj->findLeaf(p_path);
716  }
717  if ( root_entry ) {
718  DataObject* pO = root_entry->object();
719  if ( !pO ) {
720  // Object is not loaded: load the object if at all possible
721  status = loadObject(root_entry);
722  if ( !status.isSuccess() ) return status;
723  }
724  if ( root_entry->isSoft() ) {
725  root_entry = CAST_REGENTRY(RegEntry*,pO->registry());
726  }
727  return i_retrieveEntry(root_entry, path.substr(sep), pEntry);
728  }
729  return status;
730  } else if ( path.empty() ) {
731  pEntry = parentObj;
732  } else {
733  if (!parentObj->object()) { // if the parent object has not been loaded yet, load it now
734  status = loadObject(parentObj);
735  if ( !status.isSuccess() ) return status;
736  }
737  // last leave in search: find leaf and load
738  pEntry = parentObj->findLeaf(path);
739  // If no registry entry was found, trigger incident for action-on-demand
740  if ( !pEntry && m_enableFaultHdlr ) {
741  i_handleDataFault(parentObj, path);
742  pEntry = (path.empty() ? parentObj : parentObj->findLeaf(path) );
743  }
744  }
745 
746  // Check results and return
747  if ( !pEntry ) return INVALID_OBJ_PATH;
748  if ( !pEntry->object() ) return loadObject(pEntry);
749 
750  if ( m_enableAccessHdlr ) {
751  // Fire data access incident
752  // I do not know if this is a good idea....
753  // This fires too often!
754  //
755  //DataIncident incident(name(), m_accessName, pEntry->identifier());
756  //m_incidentSvc->fireIncident(incident);
757  return SUCCESS;
758  }
759  return SUCCESS;
760 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
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:74
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:584
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:550
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
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:673
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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:30
StatusCode DataSvc::i_setRoot ( std::string  root_path,
DataObject pRootObj 
)
virtual

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

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

Definition at line 164 of file DataSvc.cpp.

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

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

Service initialization.

Definition at line 1153 of file DataSvc.cpp.

1153  {
1154  // Nothing to do: just call base class initialisation
1156  if ( UNLIKELY(!sc.isSuccess()) ) return sc;
1157  m_incidentSvc = service("IncidentSvc", true);
1158  if ( UNLIKELY(!m_incidentSvc) ) {
1159  error() << "Failed to access incident service." << endmsg;
1160  }
1161  return sc;
1162 }
StatusCode initialize() override
Definition: Service.cpp:64
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
#define UNLIKELY(x)
Definition: Kernel.h:126
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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:244
StatusCode DataSvc::linkObject ( IRegistry from,
const std::string objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 966 of file DataSvc.cpp.

967  {
968  if ( checkRoot() ) {
969  try {
970  RegEntry* from_entry = CAST_REGENTRY(RegEntry*,from);
971  if ( from_entry ) {
972  // First check if both objects are already registered to the store
973  RegEntry* to_entry = m_root->findLeaf(to);
974  if ( !to_entry ) {
975  return INVALID_OBJECT;
976  }
977  std::string::size_type sep = objPath.rfind(SEPARATOR);
978  if ( sep > 0 && sep != std::string::npos ) { // in case the objPath is a sub-directory itself
979  DataObject* pO = nullptr;
980  StatusCode sc = retrieveObject(from, objPath.substr(0,sep), pO);
981  if ( sc.isSuccess() ) {
982  sc = linkObject(pO->registry(), objPath.substr(sep), to);
983  }
984  return sc;
985  }
986  // Now register the soft link
987  StatusCode status = from_entry->add( objPath, to, true);
988  return status.isSuccess() ? IDataProviderSvc_NO_ERROR : DOUBL_OBJ_PATH;
989  }
990  }
991  catch (...) {
992  }
993  return INVALID_PARENT;
994  }
995  return INVALID_ROOT;
996 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
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:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:763
StatusCode linkObject(IRegistry *from, const std::string &objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:966
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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:30
StatusCode DataSvc::linkObject ( const std::string fromPath,
const std::string objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 1012 of file DataSvc.cpp.

1014  {
1015  DataObject* pO = nullptr;
1016  StatusCode status = retrieveObject(from, pO);
1017  return status.isSuccess() ? linkObject(pO->registry(), objPath, to)
1018  : status;
1019 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:763
StatusCode linkObject(IRegistry *from, const std::string &objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:966
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::linkObject ( DataObject from,
const std::string objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 1022 of file DataSvc.cpp.

1024  {
1025  if ( from ) {
1026  IRegistry* from_entry = from->registry();
1027  if ( from_entry ) {
1028  return linkObject( from_entry, objPath, to);
1029  }
1030  }
1031  return INVALID_PARENT;
1032 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
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:966
StatusCode DataSvc::linkObject ( const std::string fullPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 999 of file DataSvc.cpp.

1000  {
1001  if ( !fullPath.empty() ) {
1002  if ( fullPath.front() != SEPARATOR ) {
1003  return linkObject(m_rootName, fullPath, to);
1004  }
1005  auto sep = fullPath.rfind(SEPARATOR);
1006  return linkObject( fullPath.substr( 0, sep), fullPath.substr(sep), to);
1007  }
1008  return INVALID_OBJ_PATH;
1009 }
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:966
T substr(T...args)
StatusCode DataSvc::loadObject ( IRegistry pNode)
protectedvirtual

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

Definition at line 584 of file DataSvc.cpp.

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

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

Definition at line 592 of file DataSvc.cpp.

592  {
593  StatusCode status = INVALID_OBJ_ADDR;
594  DataObject* pObject = nullptr;
595  if ( !pLoader ) { // Precondition: Data loader must be present
596  return handleDataFault(pRegistry) ? StatusCode{SUCCESS} : NO_DATA_LOADER;
597  }
598  if ( !pRegistry ) { // Precondition: Directory must be valid
599  return handleDataFault(pRegistry) ? StatusCode{SUCCESS} : INVALID_OBJ_ADDR;
600  }
601 
602  VERMSG << "Requested object " << pRegistry->identifier() << endmsg;
603 
604  if ( m_enableAccessHdlr ) {
605  // Fire data access incident
606  DataIncident incident(name(), m_accessName, pRegistry->identifier());
607  m_incidentSvc->fireIncident(incident);
608  }
609  if ( !m_inhibitPathes.empty() ) {
610  auto inhibit = std::find(m_inhibitPathes.begin(), m_inhibitPathes.end(),
611  pRegistry->identifier());
612  if ( inhibit != m_inhibitPathes.end() ) {
613  return NO_ACCESS;
614  }
615  }
616  IOpaqueAddress* pAddress = pRegistry->address();
617  if ( !pAddress ) { // Precondition:
618  return INVALID_OBJ_ADDR; // Address must be valid
619  }
620  try {
621  status = pLoader->createObj(pAddress, pObject); // Call data loader
622  if ( status.isSuccess() ) {
623 
624  VERMSG << "Object " << pRegistry->identifier() << " created" << endmsg;
625 
626  RegEntry *pEntry = CAST_REGENTRY(RegEntry*,pRegistry);
627  pEntry->setObject(pObject);
628 
629  VERMSG << "Filling object " << pRegistry->identifier() << endmsg;
630  status = pLoader->fillObjRefs(pAddress, pObject);
631  }
632  }
633  catch( const GaudiException& exc ) {
634  if ( handleDataFault(pRegistry) ) {
635  return SUCCESS;
636  }
637  throw GaudiException("GaudiException in loadObject() " + pRegistry->identifier(),
638  name(), StatusCode::FAILURE, exc);
639  }
640  catch( const std::exception& x) {
641  if ( handleDataFault(pRegistry) ) {
642  return SUCCESS;
643  }
644  throw GaudiException("std::exception in loadObject() " + pRegistry->identifier() +
645  ": " + System::typeinfoName(typeid(x)) + ", " + x.what(),
647  }
648  catch(...) {
649  if ( handleDataFault(pRegistry) ) {
650  return SUCCESS;
651  }
652  throw GaudiException("UNKN exception in loadObject() " + pRegistry->identifier(),
654  }
655  if ( !status.isSuccess() ) {
656  if ( handleDataFault(pRegistry) ) {
657  return StatusCode::SUCCESS;
658  }
659  }
660  ON_VERBOSE if ( status.isSuccess() ) {
661  verbose() << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
662  }
663  return status;
664 }
#define VERMSG
Definition: DataSvc.cpp:71
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:299
Gaudi::Property< std::string > m_accessName
Definition: DataSvc.h:67
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
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:26
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:54
STL class.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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:546
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:30
#define ON_VERBOSE
Definition: DataSvc.cpp:68
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
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 225 of file DataSvc.cpp.

226  {
227  if ( !pObject ) return INVALID_OBJECT;
228  return objectLeaves(pObject->registry(), leaves);
229 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
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:225
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 234 of file DataSvc.cpp.

235  {
236  if ( !checkRoot() ) return INVALID_ROOT;
237  const RegEntry* node_entry = CAST_REGENTRY(const RegEntry*,pRegistry);
238  if ( !node_entry ) return INVALID_OBJECT;
239  leaves = node_entry->leaves();
240  return StatusCode::SUCCESS;
241 }
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:63
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 209 of file DataSvc.cpp.

210  {
211  if ( !pObject ) return INVALID_OBJECT;
212  return objectParent(pObject->registry(), refpParent);
213 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object&#39;s parent.
Definition: DataSvc.cpp:209
StatusCode DataSvc::objectParent ( const IRegistry pRegistry,
IRegistry *&  refpParent 
)
override

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

Definition at line 215 of file DataSvc.cpp.

216  {
217  if ( !checkRoot() ) return INVALID_ROOT;
218  const RegEntry* node_entry = CAST_REGENTRY(const RegEntry*,pRegistry);
219  if ( !node_entry ) return INVALID_OBJECT;
220  refpParent = node_entry->parent();
221  return StatusCode::SUCCESS;
222 }
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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 1122 of file DataSvc.cpp.

1122  {
1123  //unused: StatusCode sc = StatusCode::FAILURE;
1124  if ( pObject && depth++ < load_depth ) {
1125  RegEntry* dir = CAST_REGENTRY(RegEntry*,pObject->registry());
1126  if ( dir ) {
1127  for (const auto& i : *dir) {
1128  DataObject *pObj = nullptr;
1129  StatusCode status = retrieveObject(pObject, i->name(), pObj);
1130  if ( status.isSuccess() && depth < load_depth ) {
1131  preLoad(depth, load_depth, pObj).ignore();
1132  }
1133  }
1134  }
1135  }
1136  return StatusCode::SUCCESS;
1137 }
StatusCode preLoad() override
load all preload items of the list
Definition: DataSvc.cpp:1140
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:763
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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:78
void ignore() const
Definition: StatusCode.h:106
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::preLoad ( )
override

load all preload items of the list

Definition at line 1140 of file DataSvc.cpp.

1140  {
1141  DataObject* pObj = nullptr;
1142  for (const auto& i : m_preLoads ) {
1143  StatusCode sc = retrieveObject( i.path(), pObj);
1144  int load_depth = i.depth();
1145  if ( sc.isSuccess() && load_depth > 1 ) {
1146  preLoad(1, load_depth, pObj).ignore();
1147  }
1148  }
1149  return StatusCode::SUCCESS;
1150 }
StatusCode preLoad() override
load all preload items of the list
Definition: DataSvc.cpp:1140
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
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:26
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:763
void ignore() const
Definition: StatusCode.h:106
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::registerAddress ( const std::string fullPath,
IOpaqueAddress pAddress 
)
override

IDataManagerSvc: Register object address with the data store.

Definition at line 244 of file DataSvc.cpp.

245  {
246  if ( fullPath.empty() ) return INVALID_OBJ_PATH;
247  return registerAddress( fullPath.front() != SEPARATOR ? m_root : nullptr,
248  fullPath, pAddress);
249 }
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:244
StatusCode DataSvc::registerAddress ( DataObject parentObj,
const std::string objectPath,
IOpaqueAddress pAddress 
)
override

IDataManagerSvc: Register object address with the data store.

Definition at line 252 of file DataSvc.cpp.

254  {
255  IRegistry* pRegistry = ( parentObj ? parentObj->registry() : nullptr );
256  return registerAddress(pRegistry, objectPath, pAddress);
257 }
StatusCode registerAddress(const std::string &fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:244
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
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 260 of file DataSvc.cpp.

262  {
263  if ( !checkRoot() ) return INVALID_ROOT;
264  if ( objPath.empty() ) return INVALID_OBJ_PATH;
265 
266  if ( !parentObj ) {
267  if ( objPath.front() != SEPARATOR ) {
268  return registerAddress(m_root, objPath, pAddress);
269  }
270  std::string::size_type sep = objPath.find(SEPARATOR,1);
271  if ( sep == std::string::npos ) {
272  return INVALID_PARENT;
273  }
274  if ( objPath.compare(0,sep,m_rootName) == 0 ) {
275  return registerAddress(m_root, objPath.substr(sep), pAddress);
276  }
277  }
278  if ( objPath.front() != SEPARATOR ) {
279  return registerAddress(parentObj, char(SEPARATOR)+objPath, pAddress);
280  }
281  RegEntry* par_entry = CAST_REGENTRY(RegEntry*,parentObj);
282  if ( !par_entry ) return INVALID_PARENT;
283 
284  std::string::size_type sep = objPath.rfind(SEPARATOR);
285  if ( sep > 0 && sep != std::string::npos ) {
286  auto p_path = objPath.substr( 0, sep);
287  auto o_path = objPath.substr( sep );
288  RegEntry* p_entry = par_entry->findLeaf(p_path);
289  // Create default object leafs if the
290  // intermediate nodes are not present
291  if ( !p_entry && m_forceLeaves ) {
292  DataObject *pLeaf = createDefaultObject();
293  StatusCode sc = registerObject(par_entry->identifier(),
294  p_path,
295  pLeaf);
296  if ( sc.isFailure() ) delete pLeaf;
297  p_entry = par_entry->findLeaf(p_path);
298  }
299  if ( !p_entry ) return INVALID_PARENT;
300  return registerAddress(p_entry, o_path, pAddress);
301  }
302  StatusCode status = par_entry->add(objPath, pAddress);
303  return status.isSuccess() ? status : DOUBL_OBJ_PATH;
304 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
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:356
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:244
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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:30
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:1208
StatusCode DataSvc::registerObject ( const std::string fullPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 356 of file DataSvc.cpp.

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

Register object with the data store.

Definition at line 363 of file DataSvc.cpp.

365  {
366  DataObject* pO = nullptr;
367  StatusCode status = retrieveObject(parentPath, pO);
368  if ( !status.isSuccess() && m_forceLeaves ) {
369  pO = createDefaultObject();
370  status = registerObject(parentPath, pO);
371  if ( !status.isSuccess() ) pO->release();
372  }
373  if ( status.isFailure() ) return status;
374  return registerObject(pO, objPath, pObject);
375 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
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:356
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:763
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:56
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:1208
StatusCode DataSvc::registerObject ( const std::string parentPath,
int  item,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 378 of file DataSvc.cpp.

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

Register object with the data store.

Definition at line 392 of file DataSvc.cpp.

394  {
395  if ( !checkRoot() ) return INVALID_ROOT;
396 
397  if ( !parentObj ) {
398  if ( !objPath.empty() ) {
399  if ( objPath.front() == SEPARATOR ) {
400  auto sep = objPath.find(SEPARATOR,1);
401  if ( sep != std::string::npos ) {
402  return registerObject(objPath.substr( 0, sep), objPath.substr( sep ), pObject);
403  }
404  } else {
405  return registerObject(m_rootName, objPath, pObject);
406  }
407  }
408  return INVALID_OBJ_PATH;
409  }
410  RegEntry* node_entry = CAST_REGENTRY(RegEntry*,parentObj->registry());
411  if ( node_entry ) {
412  StatusCode status = INVALID_PARENT;
413  auto sep = objPath.find(SEPARATOR,1);
414  if ( sep != std::string::npos ) {
415  auto p_path = objPath.substr( 0, sep );
416  auto o_path = objPath.substr( sep );
417  RegEntry* par_entry = node_entry->findLeaf(p_path);
418  // Create default object leafs if the
419  // intermediate nodes are not present
420  if ( !par_entry && m_forceLeaves ) {
421  DataObject *pLeaf = createDefaultObject();
422  StatusCode sc = registerObject(parentObj, p_path, pLeaf);
423  if ( ! sc.isSuccess() ) delete pLeaf;
424  par_entry = node_entry->findLeaf(p_path);
425  }
426  else if ( par_entry && !par_entry->object() ) {
427  status = i_retrieveEntry( node_entry, p_path, par_entry);
428  if ( !status.isSuccess() && !par_entry->address() && m_forceLeaves ) {
429  DataObject *pLeaf = createDefaultObject();
430  StatusCode sc = registerObject(parentObj, p_path, pLeaf);
431  if ( ! sc.isSuccess() ) delete pLeaf;
432  par_entry = node_entry->findLeaf(p_path);
433  }
434  }
435  node_entry = par_entry;
436  if ( node_entry ) {
437  DataObject* obj = node_entry->object();
438  if ( obj ) {
439  status = registerObject( obj, o_path, pObject );
440  }
441  }
442  }
443  else {
444  RegEntry* leaf = node_entry->findLeaf(objPath);
445  if ( !leaf ) {
446  status = node_entry->add( objPath, pObject );
447  }
448  else {
449  DataObject* obj = leaf->object();
450  if ( !obj ) {
451  if ( !pObject ) {
452  error() << "registerObject: trying to register null DataObject" << endmsg;
453  return StatusCode::FAILURE;
454  }
455  pObject->setRegistry(leaf);
456  leaf->setAddress(nullptr);
457  leaf->setObject(pObject);
458  status = StatusCode::SUCCESS;
459  }
460  else {
461  status = DOUBL_OBJ_PATH;
462  }
463  }
464  }
465  return status;
466  }
467  return INVALID_PARENT;
468 }
T empty(T...args)
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
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:74
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:356
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
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:673
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IOpaqueAddress * address() const override
Retrieve opaque storage address.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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:30
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:1208
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode DataSvc::registerObject ( DataObject parentObj,
int  item,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 385 of file DataSvc.cpp.

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

Service initialization.

Service reinitialization.

Definition at line 1165 of file DataSvc.cpp.

1165  {
1166  // the finalize part is copied here
1167  setDataLoader(nullptr).ignore();
1168  resetPreLoad().ignore();
1169  clearStore().ignore();
1170  m_incidentSvc.reset();
1171  // re-initialize the base class
1173  if ( UNLIKELY(!sc.isSuccess()) ) {
1174  error() << "Unable to reinitialize base class" << endmsg;
1175  return sc;
1176  }
1177  // the initialize part is copied here
1178  m_incidentSvc = service("IncidentSvc", true);
1179  if ( UNLIKELY(!m_incidentSvc) ) {
1180  error() << "Failed to access incident service." << endmsg;
1181  return StatusCode::FAILURE;
1182  }
1183  // return
1184  return StatusCode::SUCCESS;
1185 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
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:202
#define UNLIKELY(x)
Definition: Kernel.h:126
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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:88
void ignore() const
Definition: StatusCode.h:106
StatusCode resetPreLoad() override
Clear the preload list.
Definition: DataSvc.cpp:1116
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:114
StatusCode DataSvc::removePreLoadItem ( const DataStoreItem item)
override

Remove an item from the preload list.

Definition at line 1104 of file DataSvc.cpp.

1104  {
1106  std::end(m_preLoads));
1107  return StatusCode::SUCCESS;
1108 }
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 1111 of file DataSvc.cpp.

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

Clear the preload list.

Definition at line 1116 of file DataSvc.cpp.

1116  {
1118  return StatusCode::SUCCESS;
1119 }
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 667 of file DataSvc.cpp.

669  {
670  return i_retrieveEntry(parentObj,path,pEntry);
671 }
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:673
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 763 of file DataSvc.cpp.

765  {
766  pObject = nullptr;
767  RegEntry *result = nullptr, *parent = CAST_REGENTRY(RegEntry*,pRegistry);
768  StatusCode status = i_retrieveEntry(parent, path, result);
769  if ( status.isSuccess() ) pObject = result->object();
770  return status;
771 }
DataObject * object() const override
Retrive object behind the link.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:673
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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 774 of file DataSvc.cpp.

775  {
776  IRegistry* nullDir = nullptr;
777  return retrieveObject(nullDir, fullPath, pObject);
778 }
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:763
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 781 of file DataSvc.cpp.

783  {
784  DataObject* parent = nullptr;
785  StatusCode status = retrieveObject(parentPath, parent);
786  return status.isSuccess() ? retrieveObject (parent, objectPath, pObject)
787  : status;
788 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:763
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
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 791 of file DataSvc.cpp.

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

Retrieve object from data store.

Definition at line 798 of file DataSvc.cpp.

800  {
801  IRegistry* pRegistry = (parentObj ? parentObj->registry() : nullptr);
802  return retrieveObject(pRegistry, path, pObject);
803 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
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:763
StatusCode DataSvc::retrieveObject ( DataObject parentObj,
int  item,
DataObject *&  pObject 
)
override

Retrieve object from data store.

Retrieve registry entry from store.

Definition at line 806 of file DataSvc.cpp.

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

IDataManagerSvc: Accessor for root event CLID.

CLID for root Event.

Definition at line 1198 of file DataSvc.cpp.

1198  {
1199  return( (CLID)m_rootCLID );
1200 }
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 1203 of file DataSvc.cpp.

1203  {
1204  return m_rootName;
1205 }
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 202 of file DataSvc.cpp.

202  {
203  m_dataLoader = pDataLoader;
204  if ( m_dataLoader ) m_dataLoader->setDataProvider(dpsvc ? dpsvc :this).ignore();
205  return SUCCESS;
206 }
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:106
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 153 of file DataSvc.cpp.

154  {
155  clearStore().ignore();
156  return i_setRoot (std::move(root_path), pRootObj);
157 }
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:164
void ignore() const
Definition: StatusCode.h:106
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:114
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 179 of file DataSvc.cpp.

180  {
181  clearStore().ignore();
182  return i_setRoot (std::move(root_path), pRootAddr);
183 }
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:164
void ignore() const
Definition: StatusCode.h:106
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:114
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 126 of file DataSvc.cpp.

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

136  {
137  if ( !checkRoot() ) return INVALID_ROOT;
138  RegEntry* entry = CAST_REGENTRY(RegEntry*,pObject->registry());
139  if ( !entry ) return INVALID_OBJECT;
140  return entry->traverseTree(pAgent);
141 }
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:74
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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 144 of file DataSvc.cpp.

144  {
145  if ( !checkRoot() ) return INVALID_ROOT;
146  return m_root->traverseTree(pAgent);
147 }
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 1035 of file DataSvc.cpp.

1036  {
1037  if ( checkRoot() ) {
1038  try {
1039  RegEntry* from_entry = CAST_REGENTRY(RegEntry*,from);
1040  if ( from_entry ) {
1041  std::string::size_type sep = objPath.rfind(SEPARATOR);
1042  if ( sep > 0 && sep != std::string::npos ) { // in case the objPath is a sub-directory itself
1043  DataObject* pO = nullptr;
1044  StatusCode sc = findObject(from, objPath.substr(0,sep), pO);
1045  if ( sc.isSuccess() ) {
1046  sc = unlinkObject(pO->registry(), objPath.substr(sep));
1047  }
1048  return sc;
1049  }
1050  StatusCode status = from_entry->remove( objPath );
1051  if ( status.isSuccess() ) return status;
1052  return INVALID_OBJ_PATH;
1053  }
1054  }
1055  catch (...) {
1056  }
1057  return INVALID_PARENT;
1058  }
1059  return INVALID_ROOT;
1060 }
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
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:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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:1035
T substr(T...args)
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::unlinkObject ( const std::string fromPath,
const std::string objPath 
)
override

Remove a link to another object.

Definition at line 1073 of file DataSvc.cpp.

1074  {
1075  DataObject* pObject = nullptr;
1076  StatusCode status = findObject(from, pObject);
1077  return status.isSuccess() ? unlinkObject(pObject->registry(), objPath)
1078  : status;
1079 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
StatusCode unlinkObject(IRegistry *from, const std::string &objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:1035
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::unlinkObject ( DataObject fromObj,
const std::string objPath 
)
override

Remove a link to another object.

Definition at line 1082 of file DataSvc.cpp.

1083  {
1084  if ( !checkRoot() ) return INVALID_ROOT;
1085  IRegistry* from_entry = m_root->findLeaf(from);
1086  return unlinkObject(from_entry, objPath);
1087 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
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:1035
StatusCode DataSvc::unlinkObject ( const std::string fullPath)
override

Remove a link to another object.

Definition at line 1063 of file DataSvc.cpp.

1063  {
1064  if ( fullPath.empty() ) return INVALID_OBJ_PATH;
1065  if ( fullPath.front() != SEPARATOR ) {
1066  return unlinkObject(m_rootName, fullPath);
1067  }
1068  auto sep = fullPath.rfind(SEPARATOR);
1069  return unlinkObject(fullPath.substr(0,sep), fullPath.substr(sep));
1070 }
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:1035
T substr(T...args)
StatusCode DataSvc::unregisterAddress ( const std::string fullPath)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 307 of file DataSvc.cpp.

307  {
308  if ( fullPath.empty() ) return INVALID_OBJ_PATH;
309  return unregisterAddress( fullPath.front() != SEPARATOR ? m_root : nullptr,
310  fullPath );
311 }
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:307
StatusCode DataSvc::unregisterAddress ( DataObject pParent,
const std::string objPath 
)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 314 of file DataSvc.cpp.

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

IDataManagerSvc: Unregister object address from the data store.

Definition at line 321 of file DataSvc.cpp.

322  {
323  if ( !checkRoot() ) return INVALID_ROOT;
324  if ( objPath.empty() ) return INVALID_OBJ_PATH;
325 
326  if ( !pParent ) {
327  if ( objPath.front() != SEPARATOR ) {
328  return unregisterAddress(m_root, objPath);
329  }
330  std::string::size_type sep = objPath.find(SEPARATOR,1);
331  if ( sep != std::string::npos &&
332  objPath.compare( 0, sep, m_rootName) == 0 ) {
333  return unregisterAddress(m_root, objPath.substr(sep));
334  }
335  return INVALID_PARENT;
336  }
337  if ( objPath.front() != SEPARATOR ) {
338  return unregisterAddress(pParent, char(SEPARATOR)+objPath);
339  }
340  RegEntry* node_entry = CAST_REGENTRY(RegEntry*,pParent);
341  if ( node_entry ) {
342  RegEntry* leaf_entry = node_entry->findLeaf(objPath);
343  if ( leaf_entry ) {
344  std::string::size_type sep = objPath.rfind(SEPARATOR);
345  if ( sep > 0 && sep != std::string::npos ) {
346  return unregisterAddress(leaf_entry->parent(), objPath.substr(sep));
347  }
348  StatusCode status = node_entry->remove(objPath);
349  if ( status.isSuccess() ) return status;
350  }
351  }
352  return INVALID_PARENT;
353 }
T empty(T...args)
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
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:26
StatusCode unregisterAddress(const std::string &fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:307
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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 471 of file DataSvc.cpp.

471  {
472  DataObject* pObject = nullptr;
473  StatusCode status = findObject(fullPath, pObject);
474  if ( status.isFailure() ) return status;
475  RegEntry* pEntry = CAST_REGENTRY(RegEntry*,pObject->registry());
476  if ( !pEntry ) return INVALID_ROOT;
477  if ( !pEntry->isEmpty() ) return DIR_NOT_EMPTY;
478  RegEntry* pParent = pEntry->parentEntry();
479  if ( !pParent ) return INVALID_PARENT;
480  if ( pObject ) pObject->addRef();
481  pParent->remove(pEntry);
482  return StatusCode::SUCCESS;
483 }
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:84
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:91
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:63
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
virtual bool isEmpty() const
Simple check if the Container is empty.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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:30
StatusCode DataSvc::unregisterObject ( const std::string parentPath,
const std::string objectPath 
)
override

Unregister object from the data store.

Definition at line 486 of file DataSvc.cpp.

487  {
488  DataObject* pO = nullptr;
489  StatusCode status = findObject(parentPath, pO);
490  return status.isSuccess() ? unregisterObject(pO, objPath) : status;
491 }
StatusCode unregisterObject(const std::string &fullPath) override
Unregister object from the data store.
Definition: DataSvc.cpp:471
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::unregisterObject ( const std::string parentPath,
int  item 
)
override

Unregister object from the data store.

Definition at line 494 of file DataSvc.cpp.

494  {
495  return unregisterObject(parentPath, itemToPath(item));
496 }
StatusCode unregisterObject(const std::string &fullPath) override
Unregister object from the data store.
Definition: DataSvc.cpp:471
StatusCode DataSvc::unregisterObject ( DataObject pObject)
override

Unregister object from the data store.

Definition at line 499 of file DataSvc.cpp.

499  {
500  if ( !checkRoot() ) return INVALID_ROOT;
501  RegEntry* entry = m_root->findLeaf(pObject);
502  if ( !entry ) return INVALID_OBJECT;
503  RegEntry* parent = entry->parentEntry();
504  if ( !parent ) return INVALID_PARENT;
505  if ( !entry->isEmpty() ) return DIR_NOT_EMPTY;
506  if ( entry->object() ) entry->object()->addRef();
507  if ( parent ) parent->remove(entry);
508  return SUCCESS;
509 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
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:91
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:63
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 512 of file DataSvc.cpp.

513  {
514  if ( checkRoot() ) {
515  try {
516  RegEntry* parent = CAST_REGENTRY(RegEntry*,pParentObj->registry());
517  if ( parent ) {
518  RegEntry* entry = parent->findLeaf(objectPath);
519  if ( entry ) {
520  if ( entry->isEmpty() ) {
521  if ( entry->object() ) {
522  entry->object()->addRef();
523  }
524  parent->remove(entry);
525  return SUCCESS;
526  }
527  return DIR_NOT_EMPTY;
528  }
529  return INVALID_OBJECT;
530  }
531  }
532  catch(...) {
533  }
534  return INVALID_PARENT;
535  }
536  return INVALID_ROOT;
537 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
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:63
virtual bool isEmpty() const
Simple check if the Container is empty.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
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 540 of file DataSvc.cpp.

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

Update object identified by its directory entry.

Update object.

Definition at line 884 of file DataSvc.cpp.

884  {
885  if ( !pRegistry ) { // Precondition:
886  return INVALID_OBJ_ADDR; // Addres must be valid
887  }
888  DataObject* toUpdate = pRegistry->object();
889  if ( !toUpdate ) { // Try first to load
890  return loadObject(pRegistry);
891  }
892  return updateObject(toUpdate);
893 }
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: DataSvc.cpp:584
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:884
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::updateObject ( const std::string updatePath)
override

Update object.

Definition at line 876 of file DataSvc.cpp.

876  {
877  DataObject* pO = nullptr;
878  StatusCode status = findObject(updatePath, pO);
879  return status.isSuccess() ? updateObject(pO)
880  : retrieveObject(updatePath, pO);
881 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:763
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:884
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::updateObject ( DataObject toUpdate)
override

Update object.

Definition at line 896 of file DataSvc.cpp.

896  {
897  StatusCode status = INVALID_OBJ_ADDR;
898  if ( !toUpdate ) { // Precondition:
899  return INVALID_OBJECT; // Address must be valid
900  }
901  IRegistry* pRegistry = toUpdate->registry(); // Precondition:
902  if ( !pRegistry ) { // Need valid registry
903  return INVALID_OBJECT;
904  }
905  IOpaqueAddress* pAddress = pRegistry->address(); // Precondition:
906  if ( !pAddress ) { // Need valid address
907  return INVALID_OBJ_ADDR;
908  }
909  IConversionSvc* pLoader = getDataLoader(pRegistry);
910  if ( !pLoader ) { // Precondition:
911  return NO_DATA_LOADER; // Data loader must be present
912  }
913  if ( !m_inhibitPathes.empty() ) {
914  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(),
915  pRegistry->identifier());
916  if ( inhibit != m_inhibitPathes.end() ) {
917  return NO_ACCESS;
918  }
919  }
920  try {
921  status = pLoader->updateObj(pAddress, toUpdate); // Call data loader
922  if ( status.isSuccess() ) {
923  status = pLoader->updateObjRefs(pAddress, toUpdate);
924  }
925  }
926  catch( const GaudiException& exc ) {
927  throw GaudiException("GaudiException in updateObject() " +
928  pRegistry->name(),
929  name(),
930  StatusCode::FAILURE, exc);
931  }
932  catch( const std::exception& x) {
933  throw GaudiException("std::exception in updateObject() " +
934  pRegistry->name() + ": " +
935  System::typeinfoName(typeid(x)) + ", " +
936  x.what(),
938  }
939  catch(...) {
940  throw GaudiException("UNKN exception in updateObject() " +
941  pRegistry->name(),
943  }
944  return status;
945 }
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:299
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
virtual const name_type & name() const =0
Name of the directory (or key)
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
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:26
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:1215
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 948 of file DataSvc.cpp.

949  {
950  DataObject* pParent = nullptr;
951  StatusCode status = findObject(parentPath, pParent);
952  return status.isSuccess() ? updateObject( pParent, updatePath)
953  : status;
954 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:884
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::updateObject ( DataObject pParent,
const std::string updatePath 
)
override

Update object.

Definition at line 957 of file DataSvc.cpp.

958  {
959  DataObject* pObject = nullptr;
960  StatusCode status = findObject(parent, updatePath, pObject);
961  return status.isSuccess() ? updateObject(pObject)
962  : status;
963 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:828
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:884
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

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: