The Gaudi Framework  v30r3 (a5ef0a68)
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
using Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 

Public Member Functions

CLID rootCLID () const override
 IDataManagerSvc: Accessor for root event CLID. More...
 
const std::stringrootName () const override
 IDataManagerSvc: Accessor for root event name. More...
 
StatusCode registerAddress (boost::string_ref fullPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store. More...
 
StatusCode registerAddress (DataObject *parentObj, boost::string_ref objectPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store. More...
 
StatusCode registerAddress (IRegistry *parentObj, boost::string_ref objectPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store. More...
 
StatusCode unregisterAddress (boost::string_ref fullPath) override
 IDataManagerSvc: Unregister object address from the data store. More...
 
StatusCode unregisterAddress (DataObject *pParent, boost::string_ref objPath) override
 IDataManagerSvc: Unregister object address from the data store. More...
 
StatusCode unregisterAddress (IRegistry *pParent, boost::string_ref objPath) override
 IDataManagerSvc: Unregister object address from the data store. More...
 
StatusCode objectLeaves (const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object. More...
 
StatusCode objectLeaves (const IRegistry *pRegistry, std::vector< IRegistry * > &refLeaves) override
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object. More...
 
StatusCode objectParent (const DataObject *pObject, IRegistry *&refpParent) override
 IDataManagerSvc: Explore the object store: retrieve the object's parent. More...
 
StatusCode objectParent (const IRegistry *pRegistry, IRegistry *&refpParent) override
 IDataManagerSvc: Explore the object store: retrieve the object's parent. More...
 
StatusCode clearSubTree (boost::string_ref sub_tree_path) override
 IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name. More...
 
StatusCode clearSubTree (DataObject *pObject) override
 IDataManagerSvc: Remove all data objects below the sub tree identified by the object. More...
 
StatusCode clearStore () override
 IDataManagerSvc: Remove all data objects in the data store. More...
 
StatusCode traverseSubTree (boost::string_ref sub_tree_path, IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full path name. More...
 
StatusCode traverseSubTree (DataObject *pObject, IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects below the sub tree. More...
 
StatusCode traverseTree (IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects in the data store. More...
 
StatusCode setRoot (std::string root_name, DataObject *pRootObj) override
 Initialize data store for new event by giving new event path and root object. More...
 
virtual StatusCode i_setRoot (std::string root_name, DataObject *pRootObj)
 Initialize data store for new event by giving new event path and root object. More...
 
StatusCode setRoot (std::string root_path, IOpaqueAddress *pRootAddr) override
 Initialize data store for new event by giving new event path and address of root object. More...
 
virtual StatusCode i_setRoot (std::string root_path, IOpaqueAddress *pRootAddr)
 Initialize data store for new event by giving new event path and address of root object. More...
 
StatusCode setDataLoader (IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
 IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data provider. More...
 
StatusCode addPreLoadItem (const DataStoreItem &item) override
 Add an item to the preload list. More...
 
StatusCode addPreLoadItem (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 (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 (boost::string_ref fullPath, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode registerObject (boost::string_ref parentPath, boost::string_ref objPath, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode registerObject (boost::string_ref parentPath, int item, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode registerObject (DataObject *parentObj, boost::string_ref objPath, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode registerObject (DataObject *parentObj, int item, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode unregisterObject (boost::string_ref fullPath) override
 Unregister object from the data store. More...
 
StatusCode unregisterObject (boost::string_ref parentPath, boost::string_ref objectPath) override
 Unregister object from the data store. More...
 
StatusCode unregisterObject (boost::string_ref 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, boost::string_ref 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, boost::string_ref path, DataObject *&pObject) override
 Retrieve object from data store. More...
 
StatusCode retrieveObject (boost::string_ref fullPath, DataObject *&pObject) override
 Retrieve object identified by its full path from the data store. More...
 
StatusCode retrieveObject (boost::string_ref parentPath, boost::string_ref objPath, DataObject *&pObject) override
 Retrieve object from data store. More...
 
StatusCode retrieveObject (boost::string_ref parentPath, int item, DataObject *&pObject) override
 Retrieve object from data store. More...
 
StatusCode retrieveObject (DataObject *parentObj, boost::string_ref 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 (boost::string_ref fullPath, DataObject *&pObject) override
 Find object identified by its full path in the data store. More...
 
StatusCode findObject (IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
 Find object identified by its full path in the data store. More...
 
StatusCode findObject (boost::string_ref parentPath, boost::string_ref objPath, DataObject *&pObject) override
 Find object in the data store. More...
 
StatusCode findObject (boost::string_ref parentPath, int item, DataObject *&pObject) override
 Find object in the data store. More...
 
StatusCode findObject (DataObject *parentObj, boost::string_ref 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, boost::string_ref objPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode linkObject (boost::string_ref fromPath, boost::string_ref objPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode linkObject (DataObject *from, boost::string_ref objPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode linkObject (boost::string_ref fullPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode unlinkObject (IRegistry *from, boost::string_ref objPath) override
 Remove a link to another object. More...
 
StatusCode unlinkObject (boost::string_ref fromPath, boost::string_ref objPath) override
 Remove a link to another object. More...
 
StatusCode unlinkObject (DataObject *fromObj, boost::string_ref objPath) override
 Remove a link to another object. More...
 
StatusCode unlinkObject (boost::string_ref fullPath) override
 Remove a link to another object. More...
 
StatusCode updateObject (IRegistry *pDirectory) override
 Update object identified by its directory entry. More...
 
StatusCode updateObject (boost::string_ref updatePath) override
 Update object. More...
 
StatusCode updateObject (DataObject *toUpdate) override
 Update object. More...
 
StatusCode updateObject (boost::string_ref parentPath, boost::string_ref updatePath) override
 Update object. More...
 
StatusCode updateObject (DataObject *pParent, boost::string_ref 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...
 
- Public Member Functions inherited from Service
const std::stringname () const override
 Retrieve name of the service. More...
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 Initialize Service. More...
 
StatusCode sysStart () override
 Initialize Service. More...
 
StatusCode sysStop () override
 Initialize Service. More...
 
StatusCode sysFinalize () override
 Finalize Service. More...
 
StatusCode sysReinitialize () override
 Re-initialize the Service. More...
 
StatusCode sysRestart () override
 Re-initialize the Service. More...
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
 Declare used tool. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const
 Backward compatibility function for getting the output level. More...
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 

Protected Member Functions

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

Protected Attributes

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

1149 {
1150  setDataLoader( nullptr ).ignore();
1151  resetPreLoad().ignore();
1152  clearStore().ignore();
1153 }
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:199
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
StatusCode resetPreLoad() override
Clear the preload list.
Definition: DataSvc.cpp:1046
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:112
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 1019 of file DataSvc.cpp.

1020 {
1021  auto i = std::find( begin( m_preLoads ), end( m_preLoads ), item );
1022  if ( i == end( m_preLoads ) ) m_preLoads.push_back( item );
1023  return StatusCode::SUCCESS;
1024 }
LoadItems m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:70
T push_back(T...args)
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
T find(T...args)
AttribStringParser::Iterator begin(const AttribStringParser &parser)
StatusCode DataSvc::addPreLoadItem ( std::string  itemPath)
override

Add an item to the preload list.

Definition at line 1027 of file DataSvc.cpp.

1028 {
1029  return addPreLoadItem( DataStoreItem( std::move( itemPath ), 1 ) );
1030 }
StatusCode addPreLoadItem(const DataStoreItem &item) override
Add an item to the preload list.
Definition: DataSvc.cpp:1019
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
T move(T...args)
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 112 of file DataSvc.cpp.

113 {
114  if ( !checkRoot() ) return Status::INVALID_ROOT;
115  m_root->release();
116  m_root = nullptr;
117  return StatusCode::SUCCESS;
118 }
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
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
StatusCode DataSvc::clearSubTree ( boost::string_ref  sub_tree_path)
override

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

Definition at line 84 of file DataSvc.cpp.

85 {
86  DataObject* pObject = nullptr;
87  StatusCode status = findObject( sub_tree_path, pObject );
88  if ( !status.isSuccess() ) return status;
89  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
90  if ( !node_entry ) return Status::INVALID_OBJECT;
91  RegEntry* parent = node_entry->parentEntry();
92  if ( !parent ) return Status::INVALID_PARENT;
93  parent->remove( node_entry );
94  return StatusCode::SUCCESS;
95 }
bool isSuccess() const
Definition: StatusCode.h:287
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:93
StatusCode remove(boost::string_ref name)
Remove an entry from the store.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
StatusCode DataSvc::clearSubTree ( DataObject pObject)
override

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

Definition at line 100 of file DataSvc.cpp.

101 {
102  if ( !checkRoot() ) return Status::INVALID_ROOT;
103  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
104  if ( !entry ) return Status::INVALID_OBJECT;
105  RegEntry* parent = entry->parentEntry();
106  if ( !parent ) return Status::INVALID_PARENT;
107  parent->remove( entry );
108  return StatusCode::SUCCESS;
109 }
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:93
StatusCode remove(boost::string_ref name)
Remove an entry from the store.
DataObject * DataSvc::createDefaultObject ( ) const
protectedvirtual

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

Definition at line 1140 of file DataSvc.cpp.

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

Service initialization.

Service initialisation.

Definition at line 1123 of file DataSvc.cpp.

1124 {
1125  // Nothing to do: just call base class initialisation
1126  setDataLoader( nullptr ).ignore();
1127  resetPreLoad().ignore();
1128  clearStore().ignore();
1129  m_incidentSvc.reset();
1130  return Service::finalize();
1131 }
StatusCode finalize() override
Definition: Service.cpp:173
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:199
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:54
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:92
StatusCode resetPreLoad() override
Clear the preload list.
Definition: DataSvc.cpp:1046
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:112
StatusCode DataSvc::findObject ( boost::string_ref  fullPath,
DataObject *&  pObject 
)
override

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

Definition at line 795 of file DataSvc.cpp.

796 {
797  pObject = nullptr;
798  if ( !checkRoot() ) return Status::INVALID_ROOT;
799  if ( path.empty() || path == m_rootName.value() ) {
800  pObject = m_root->object();
801  return !pObject ? Status::OBJ_NOT_LOADED : Status::IDataProviderSvc_NO_ERROR;
802  }
803  return ( path.front() != SEPARATOR ) ? findObject( m_rootName.value(), path, pObject )
804  : findObject( static_cast<IRegistry*>( nullptr ), path, pObject );
805 }
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(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
StatusCode DataSvc::findObject ( IRegistry pDirectory,
boost::string_ref  path,
DataObject *&  pObject 
)
override

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

Retrieve object identified by its directory from the data store.

Definition at line 781 of file DataSvc.cpp.

782 {
783  pObject = nullptr;
784  IRegistry* pReg = ( pRegistry ? pRegistry : m_root );
785  RegEntry* root_entry = CAST_REGENTRY( RegEntry*, pReg );
786  if ( root_entry ) {
787  if ( !path.empty() ) pReg = root_entry->find( path );
788  if ( !pReg ) return Status::INVALID_OBJ_PATH;
789  pObject = pReg->object();
790  }
791  return ( !pObject ) ? Status::OBJ_NOT_LOADED : Status::IDataProviderSvc_NO_ERROR;
792 }
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:71
virtual DataObject * object() const =0
Retrieve object behind the link.
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
IRegistry * find(const IRegistry *obj) const
Try to find an object identified by its pointer.
StatusCode DataSvc::findObject ( boost::string_ref  parentPath,
boost::string_ref  objPath,
DataObject *&  pObject 
)
override

Find object in the data store.

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

Definition at line 808 of file DataSvc.cpp.

809 {
810  DataObject* parent = nullptr;
811  StatusCode status = findObject( parentPath, parent );
812  return status.isSuccess() ? findObject( parent, objectPath, pObject ) : status;
813 }
bool isSuccess() const
Definition: StatusCode.h:287
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
StatusCode DataSvc::findObject ( boost::string_ref  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 816 of file DataSvc.cpp.

817 {
818  return findObject( parentPath, itemToPath( item ), pObject );
819 }
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
StatusCode DataSvc::findObject ( DataObject parentObj,
boost::string_ref  objPath,
DataObject *&  pObject 
)
override

Find object in the data store.

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

Definition at line 828 of file DataSvc.cpp.

829 {
830  IRegistry* pDir = ( parentObj ? parentObj->registry() : nullptr );
831  return findObject( pDir, path, pObject );
832 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
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 822 of file DataSvc.cpp.

823 {
824  return findObject( parentObj, itemToPath( item ), pObject );
825 }
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
IConversionSvc * DataSvc::getDataLoader ( IRegistry pReg)
protectedvirtual

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

Reimplemented in NTupleSvc.

Definition at line 1145 of file DataSvc.cpp.

1145 { return m_dataLoader.get(); }
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
Definition: DataSvc.h:52
DataObject * DataSvc::handleDataFault ( IRegistry pReg,
boost::string_ref  path = "" 
)
protected

Invoke data fault handling if enabled.

Parameters
pReg[IN] Pointer to missing registry entry
path[IN] Sub-path of requested object from pReg
Returns
Object corresponding to the specified leaf

Definition at line 523 of file DataSvc.cpp.

524 {
525  return i_handleDataFault( pReg, path );
526 }
DataObject * i_handleDataFault(IRegistry *pReg, boost::string_ref path=boost::string_ref{})
Definition: DataSvc.cpp:528
DataObject * DataSvc::i_handleDataFault ( IRegistry pReg,
boost::string_ref  path = boost::string_ref{} 
)
private

Definition at line 528 of file DataSvc.cpp.

529 {
530  if ( m_enableFaultHdlr ) {
531  IRegistry* pLeaf = nullptr;
532  if ( pReg && path.empty() ) {
533  DataIncident incident( name(), m_faultName, pReg->identifier() );
534  m_incidentSvc->fireIncident( incident );
535  return pReg->object();
536  }
537  if ( pReg ) {
538  std::string p = pReg->identifier();
539  if ( path.front() != SEPARATOR ) p += SEPARATOR;
540  p.append( path.data(), path.size() );
541  DataIncident incident( name(), m_faultName, p );
542  m_incidentSvc->fireIncident( incident );
543  pLeaf = m_root->findLeaf( p );
544  } else {
546  if ( path.front() != SEPARATOR ) p += SEPARATOR;
547  p.append( path.data(), path.size() );
548  DataIncident incident( name(), m_faultName, p );
549  m_incidentSvc->fireIncident( incident );
550  pLeaf = m_root->findLeaf( p );
551  }
552  if ( pLeaf ) {
553  return pLeaf->object();
554  }
555  }
556  return nullptr;
557 }
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:288
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 648 of file DataSvc.cpp.

649 {
650  // A.Valassi 16.08.2001 avoid core dump if store is empty
651  if ( !checkRoot() ) return StatusCode( Status::INVALID_ROOT, true );
652 
653  static const auto empty = boost::string_ref{};
654  auto sep = find( path, SEPARATOR, 1 );
655  pEntry = nullptr;
656 
657  if ( !parentObj ) {
658  if ( path.empty() || path == m_rootName ) {
659  parentObj = m_root;
660  path = empty;
661  } else if ( path.front() != SEPARATOR ) {
662  parentObj = m_root;
663  } else if ( sep != boost::string_ref::npos ) {
664  if ( !m_root->object() ) {
665  RegEntry* r = nullptr;
666  auto status = i_retrieveEntry( m_root, empty, r );
667  if ( !status.isSuccess() ) return status;
668  }
669  parentObj = m_root;
670  path = path.substr( sep );
671  } else {
672  return Status::INVALID_OBJ_PATH;
673  }
674  sep = find( path, SEPARATOR, 1 );
675  }
676 
677  StatusCode status = StatusCode( Status::INVALID_ROOT, true );
678  if ( sep != boost::string_ref::npos ) { // the string contains a separator (after pos 0)
679  if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
680  status = loadObject( parentObj );
681  if ( !status.isSuccess() ) return status;
682  }
683  auto p_path = path.substr( 0, sep );
684  RegEntry* root_entry = parentObj->findLeaf( p_path );
685  if ( !root_entry && m_enableFaultHdlr ) {
686  // If not even the parent is there, an incident
687  // to load the parent must be fired...
688  i_handleDataFault( parentObj, p_path );
689  root_entry = parentObj->findLeaf( p_path );
690  }
691  if ( root_entry ) {
692  DataObject* pO = root_entry->object();
693  if ( !pO ) {
694  // Object is not loaded: load the object if at all possible
695  status = loadObject( root_entry );
696  if ( !status.isSuccess() ) return status;
697  }
698  if ( root_entry->isSoft() ) {
699  root_entry = CAST_REGENTRY( RegEntry*, pO->registry() );
700  }
701  return i_retrieveEntry( root_entry, path.substr( sep ), pEntry );
702  }
703  return status;
704  } else if ( path.empty() ) {
705  pEntry = parentObj;
706  } else {
707  if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
708  status = loadObject( parentObj );
709  if ( !status.isSuccess() ) return status;
710  }
711  // last leave in search: find leaf and load
712  pEntry = parentObj->findLeaf( path );
713  // If no registry entry was found, trigger incident for action-on-demand
714  if ( !pEntry && m_enableFaultHdlr ) {
715  i_handleDataFault( parentObj, path );
716  pEntry = ( path.empty() ? parentObj : parentObj->findLeaf( path ) );
717  }
718  }
719 
720  // Check results and return
721  if ( !pEntry ) return Status::INVALID_OBJ_PATH;
722  if ( !pEntry->object() ) return loadObject( pEntry );
723 
724  if ( m_enableAccessHdlr ) {
725  // Fire data access incident
726  // I do not know if this is a good idea....
727  // This fires too often!
728  //
729  // DataIncident incident(name(), m_accessName, pEntry->identifier());
730  // m_incidentSvc->fireIncident(incident);
731  return StatusCode::SUCCESS;
732  }
733  return StatusCode::SUCCESS;
734 }
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
Definition: StatusCode.h:287
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:562
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:528
bool isSoft() const
Is the link soft or hard.
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:648
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
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 161 of file DataSvc.cpp.

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

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

Service initialization.

Definition at line 1086 of file DataSvc.cpp.

1087 {
1088  // Nothing to do: just call base class initialisation
1090  if ( UNLIKELY( !sc.isSuccess() ) ) return sc;
1091  m_incidentSvc = service( "IncidentSvc", true );
1092  if ( UNLIKELY( !m_incidentSvc ) ) {
1093  error() << "Failed to access incident service." << endmsg;
1094  }
1095  return sc;
1096 }
#define UNLIKELY(x)
Definition: Kernel.h:122
StatusCode initialize() override
Definition: Service.cpp:63
bool isSuccess() const
Definition: StatusCode.h:287
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
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:84
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode DataSvc::linkObject ( IRegistry from,
boost::string_ref  objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 914 of file DataSvc.cpp.

915 {
916  if ( !checkRoot() ) return Status::INVALID_ROOT;
917  try {
918  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
919  if ( from_entry ) {
920  // First check if both objects are already registered to the store
921  RegEntry* to_entry = m_root->findLeaf( to );
922  if ( !to_entry ) return Status::INVALID_OBJECT;
923  auto sep = objPath.rfind( SEPARATOR );
924  if ( sep > 0 && sep != boost::string_ref::npos ) { // in case the objPath is a sub-directory itself
925  DataObject* pO = nullptr;
926  StatusCode sc = retrieveObject( from, objPath.substr( 0, sep ), pO );
927  return sc.isSuccess() ? linkObject( pO->registry(), objPath.substr( sep ), to ) : sc;
928  }
929  // Now register the soft link
930  StatusCode status = from_entry->add( to_string( objPath ), to, true );
931  return status.isSuccess() ? Status::IDataProviderSvc_NO_ERROR : Status::DOUBL_OBJ_PATH;
932  }
933  } catch ( ... ) {
934  }
935  return Status::INVALID_PARENT;
936 }
StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:914
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
constexpr char SEPARATOR
bool isSuccess() const
Definition: StatusCode.h:287
T to_string(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:73
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:737
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::linkObject ( boost::string_ref  fromPath,
boost::string_ref  objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 950 of file DataSvc.cpp.

951 {
952  DataObject* pO = nullptr;
953  StatusCode status = retrieveObject( from, pO );
954  return status.isSuccess() ? linkObject( pO->registry(), objPath, to ) : status;
955 }
StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:914
bool isSuccess() const
Definition: StatusCode.h:287
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:737
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::linkObject ( DataObject from,
boost::string_ref  objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 958 of file DataSvc.cpp.

959 {
960  if ( from ) {
961  IRegistry* from_entry = from->registry();
962  if ( from_entry ) {
963  return linkObject( from_entry, objPath, to );
964  }
965  }
966  return Status::INVALID_PARENT;
967 }
StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:914
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode DataSvc::linkObject ( boost::string_ref  fullPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 939 of file DataSvc.cpp.

940 {
941  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
942  if ( fullPath.front() != SEPARATOR ) {
943  return linkObject( m_rootName.value(), fullPath, to );
944  }
945  auto sep = fullPath.rfind( SEPARATOR );
946  return linkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ), to );
947 }
StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:914
constexpr char SEPARATOR
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:57
StatusCode DataSvc::loadObject ( IRegistry pNode)
protectedvirtual

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

Definition at line 562 of file DataSvc.cpp.

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

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

Definition at line 571 of file DataSvc.cpp.

572 {
573  StatusCode status = Status::INVALID_OBJ_ADDR;
574  DataObject* pObject = nullptr;
575  if ( !pLoader ) { // Precondition: Data loader must be present
576  return handleDataFault( pRegistry ) ? StatusCode::SUCCESS : StatusCode( Status::NO_DATA_LOADER );
577  }
578  if ( !pRegistry ) { // Precondition: Directory must be valid
579  return handleDataFault( pRegistry ) ? StatusCode::SUCCESS : StatusCode( Status::INVALID_OBJ_ADDR );
580  }
581 
582  VERMSG << "Requested object " << pRegistry->identifier() << endmsg;
583 
584  if ( m_enableAccessHdlr ) {
585  // Fire data access incident
586  DataIncident incident( name(), m_accessName, pRegistry->identifier() );
587  m_incidentSvc->fireIncident( incident );
588  }
589  if ( !m_inhibitPathes.empty() ) {
590  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), pRegistry->identifier() );
591  if ( inhibit != m_inhibitPathes.end() ) {
592  return Status::NO_ACCESS;
593  }
594  }
595  IOpaqueAddress* pAddress = pRegistry->address();
596  if ( !pAddress ) { // Precondition:
597  return Status::INVALID_OBJ_ADDR; // Address must be valid
598  }
599  try {
600  status = pLoader->createObj( pAddress, pObject ); // Call data loader
601  if ( status.isSuccess() ) {
602 
603  VERMSG << "Object " << pRegistry->identifier() << " created" << endmsg;
604 
605  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pRegistry );
606  pEntry->setObject( pObject );
607 
608  VERMSG << "Filling object " << pRegistry->identifier() << endmsg;
609  status = pLoader->fillObjRefs( pAddress, pObject );
610  }
611  } catch ( const GaudiException& exc ) {
612  if ( handleDataFault( pRegistry ) ) {
613  return StatusCode::SUCCESS;
614  }
615  throw GaudiException( "GaudiException in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE,
616  exc );
617  } catch ( const std::exception& x ) {
618  if ( handleDataFault( pRegistry ) ) {
619  return StatusCode::SUCCESS;
620  }
621  throw GaudiException( "std::exception in loadObject() " + pRegistry->identifier() + ": " +
622  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
624  } catch ( ... ) {
625  if ( handleDataFault( pRegistry ) ) {
626  return StatusCode::SUCCESS;
627  }
628  throw GaudiException( "UNKN exception in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE );
629  }
630  if ( !status.isSuccess() ) {
631  if ( handleDataFault( pRegistry ) ) {
632  return StatusCode::SUCCESS;
633  }
634  }
635  ON_VERBOSE if ( status.isSuccess() )
636  {
637  verbose() << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
638  }
639  return status;
640 }
#define VERMSG
Definition: DataSvc.cpp:79
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Define general base for Gaudi exception.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:288
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:332
Gaudi::Property< std::string > m_accessName
Definition: DataSvc.h:67
bool isSuccess() const
Definition: StatusCode.h:287
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:51
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:54
STL class.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
Gaudi::Property< std::vector< std::string > > m_inhibitPathes
Definition: DataSvc.h:59
T find(T...args)
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:76
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
DataObject * handleDataFault(IRegistry *pReg, boost::string_ref path="")
Invoke data fault handling if enabled.
Definition: DataSvc.cpp:523
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 223 of file DataSvc.cpp.

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

233 {
234  if ( !checkRoot() ) return Status::INVALID_ROOT;
235  const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
236  if ( !node_entry ) return Status::INVALID_OBJECT;
237  leaves = node_entry->leaves();
238  return StatusCode::SUCCESS;
239 }
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:71
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
StatusCode DataSvc::objectParent ( const DataObject pObject,
IRegistry *&  refpParent 
)
override

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

Definition at line 207 of file DataSvc.cpp.

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

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

Definition at line 213 of file DataSvc.cpp.

214 {
215  if ( !checkRoot() ) return Status::INVALID_ROOT;
216  const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
217  if ( !node_entry ) return Status::INVALID_OBJECT;
218  refpParent = node_entry->parent();
219  return StatusCode::SUCCESS;
220 }
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
IRegistry * parent() const
Pointer to parent directory entry.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
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 1053 of file DataSvc.cpp.

1054 {
1055  // unused: StatusCode sc = StatusCode::FAILURE;
1056  if ( pObject && depth++ < load_depth ) {
1057  RegEntry* dir = CAST_REGENTRY( RegEntry*, pObject->registry() );
1058  if ( dir ) {
1059  for ( const auto& i : *dir ) {
1060  DataObject* pObj = nullptr;
1061  StatusCode status = retrieveObject( pObject, i->name(), pObj );
1062  if ( status.isSuccess() && depth < load_depth ) {
1063  preLoad( depth, load_depth, pObj ).ignore();
1064  }
1065  }
1066  }
1067  }
1068  return StatusCode::SUCCESS;
1069 }
StatusCode preLoad() override
load all preload items of the list
Definition: DataSvc.cpp:1072
bool isSuccess() const
Definition: StatusCode.h:287
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
Definition: DataObject.cpp:68
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:737
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 1072 of file DataSvc.cpp.

1073 {
1074  DataObject* pObj = nullptr;
1075  for ( const auto& i : m_preLoads ) {
1076  StatusCode sc = retrieveObject( i.path(), pObj );
1077  int load_depth = i.depth();
1078  if ( sc.isSuccess() && load_depth > 1 ) {
1079  preLoad( 1, load_depth, pObj ).ignore();
1080  }
1081  }
1082  return StatusCode::SUCCESS;
1083 }
StatusCode preLoad() override
load all preload items of the list
Definition: DataSvc.cpp:1072
bool isSuccess() const
Definition: StatusCode.h:287
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:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:737
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::registerAddress ( boost::string_ref  fullPath,
IOpaqueAddress pAddress 
)
override

IDataManagerSvc: Register object address with the data store.

Definition at line 242 of file DataSvc.cpp.

243 {
244  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
245  return registerAddress( fullPath.front() != SEPARATOR ? m_root : nullptr, fullPath, pAddress );
246 }
StatusCode registerAddress(boost::string_ref fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:242
constexpr char SEPARATOR
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
StatusCode DataSvc::registerAddress ( DataObject parentObj,
boost::string_ref  objectPath,
IOpaqueAddress pAddress 
)
override

IDataManagerSvc: Register object address with the data store.

Definition at line 249 of file DataSvc.cpp.

250 {
251  IRegistry* pRegistry = ( parentObj ? parentObj->registry() : nullptr );
252  return registerAddress( pRegistry, objectPath, pAddress );
253 }
StatusCode registerAddress(boost::string_ref fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:242
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
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,
boost::string_ref  objectPath,
IOpaqueAddress pAddress 
)
override

IDataManagerSvc: Register object address with the data store.

Definition at line 256 of file DataSvc.cpp.

257 {
258  if ( !checkRoot() ) return Status::INVALID_ROOT;
259  if ( objPath.empty() ) return Status::INVALID_OBJ_PATH;
260 
261  if ( !parentObj ) {
262  if ( objPath.front() != SEPARATOR ) {
263  return registerAddress( m_root, objPath, pAddress );
264  }
265  auto sep = find( objPath, SEPARATOR, 1 );
266  if ( sep == boost::string_ref::npos || objPath.substr( 0, sep ) != m_rootName.value() ) {
267  return Status::INVALID_PARENT;
268  }
269  return registerAddress( m_root, objPath.substr( sep ), pAddress );
270  }
271  if ( objPath.front() != SEPARATOR ) {
272  return registerAddress( parentObj, char( SEPARATOR ) + objPath, pAddress );
273  }
274  RegEntry* par_entry = CAST_REGENTRY( RegEntry*, parentObj );
275  if ( !par_entry ) return Status::INVALID_PARENT;
276 
277  auto sep = objPath.rfind( SEPARATOR );
278  if ( sep > 0 && sep != boost::string_ref::npos ) {
279  auto p_path = objPath.substr( 0, sep );
280  auto o_path = objPath.substr( sep );
281  RegEntry* p_entry = par_entry->findLeaf( p_path );
282  // Create default object leafs if the
283  // intermediate nodes are not present
284  if ( !p_entry && m_forceLeaves ) {
285  DataObject* pLeaf = createDefaultObject();
286  StatusCode sc = registerObject( par_entry->identifier(), p_path, pLeaf );
287  if ( sc.isFailure() ) delete pLeaf;
288  p_entry = par_entry->findLeaf( p_path );
289  }
290  if ( !p_entry ) return Status::INVALID_PARENT;
291  return registerAddress( p_entry, o_path, pAddress );
292  }
293  StatusCode status = par_entry->add( to_string( objPath ), pAddress );
294  return status.isSuccess() ? status : Status::DOUBL_OBJ_PATH;
295 }
StatusCode registerAddress(boost::string_ref fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:242
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
constexpr char SEPARATOR
bool isSuccess() const
Definition: StatusCode.h:287
T to_string(T...args)
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
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
bool isFailure() const
Definition: StatusCode.h:139
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:343
T find(T...args)
StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
const std::string & identifier() const override
Full identifier (or key)
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:1140
StatusCode DataSvc::registerObject ( boost::string_ref  fullPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 343 of file DataSvc.cpp.

344 {
345  return registerObject( nullptr, fullPath, pObject );
346 }
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:343
StatusCode DataSvc::registerObject ( boost::string_ref  parentPath,
boost::string_ref  objPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 349 of file DataSvc.cpp.

350 {
351  DataObject* pO = nullptr;
352  StatusCode status = retrieveObject( parentPath, pO );
353  if ( !status.isSuccess() && m_forceLeaves ) {
354  pO = createDefaultObject();
355  status = registerObject( parentPath, pO );
356  if ( !status.isSuccess() ) pO->release();
357  }
358  return status.isSuccess() ? registerObject( pO, objPath, pObject ) : status;
359 }
bool isSuccess() const
Definition: StatusCode.h:287
Gaudi::Property< bool > m_forceLeaves
Definition: DataSvc.h:58
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:51
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:343
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:737
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:1140
StatusCode DataSvc::registerObject ( boost::string_ref  parentPath,
int  item,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 362 of file DataSvc.cpp.

363 {
364  return registerObject( parentPath, itemToPath( item ), pObject );
365 }
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:343
StatusCode DataSvc::registerObject ( DataObject parentObj,
boost::string_ref  objPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 374 of file DataSvc.cpp.

375 {
376  if ( !checkRoot() ) return Status::INVALID_ROOT;
377 
378  if ( !parentObj ) {
379  if ( !objPath.empty() ) {
380  if ( objPath.front() != SEPARATOR ) {
381  return registerObject( m_rootName.value(), objPath, pObject );
382  }
383  auto sep = find( objPath, SEPARATOR, 1 );
384  if ( sep != boost::string_ref::npos ) {
385  return registerObject( objPath.substr( 0, sep ), objPath.substr( sep ), pObject );
386  }
387  }
388  return Status::INVALID_OBJ_PATH;
389  }
390  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, parentObj->registry() );
391  if ( node_entry ) {
392  StatusCode status = Status::INVALID_PARENT;
393  auto sep = find( objPath, SEPARATOR, 1 );
394  if ( sep != boost::string_ref::npos ) {
395  auto p_path = objPath.substr( 0, sep );
396  auto o_path = objPath.substr( sep );
397  RegEntry* par_entry = node_entry->findLeaf( p_path );
398  // Create default object leafs if the
399  // intermediate nodes are not present
400  if ( !par_entry && m_forceLeaves ) {
401  DataObject* pLeaf = createDefaultObject();
402  StatusCode sc = registerObject( parentObj, p_path, pLeaf );
403  if ( !sc.isSuccess() ) delete pLeaf;
404  par_entry = node_entry->findLeaf( p_path );
405  } else if ( par_entry && !par_entry->object() ) {
406  status = i_retrieveEntry( node_entry, p_path, par_entry );
407  if ( !status.isSuccess() && !par_entry->address() && m_forceLeaves ) {
408  DataObject* pLeaf = createDefaultObject();
409  StatusCode sc = registerObject( parentObj, p_path, pLeaf );
410  if ( !sc.isSuccess() ) delete pLeaf;
411  par_entry = node_entry->findLeaf( p_path );
412  }
413  }
414  node_entry = par_entry;
415  if ( node_entry ) {
416  DataObject* obj = node_entry->object();
417  if ( obj ) status = registerObject( obj, o_path, pObject );
418  }
419  } else {
420  RegEntry* leaf = node_entry->findLeaf( objPath );
421  if ( !leaf ) {
422  status = node_entry->add( to_string( objPath ), pObject );
423  } else {
424  DataObject* obj = leaf->object();
425  if ( !obj ) {
426  if ( !pObject ) {
427  error() << "registerObject: trying to register null DataObject" << endmsg;
428  return StatusCode::FAILURE;
429  }
430  pObject->setRegistry( leaf );
431  leaf->setAddress( nullptr );
432  leaf->setObject( pObject );
433  status = StatusCode::SUCCESS;
434  } else {
435  status = Status::DOUBL_OBJ_PATH;
436  }
437  }
438  }
439  return status;
440  }
441  return Status::INVALID_PARENT;
442 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
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
Definition: StatusCode.h:287
T to_string(T...args)
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:71
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
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:648
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
IOpaqueAddress * address() const override
Retrieve opaque storage address.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:343
T find(T...args)
StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:1140
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode DataSvc::registerObject ( DataObject parentObj,
int  item,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 368 of file DataSvc.cpp.

369 {
370  return registerObject( parentObj, itemToPath( item ), pObject );
371 }
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:343
StatusCode DataSvc::reinitialize ( )
override

Service initialization.

Service reinitialization.

Definition at line 1099 of file DataSvc.cpp.

1100 {
1101  // the finalize part is copied here
1102  setDataLoader( nullptr ).ignore();
1103  resetPreLoad().ignore();
1104  clearStore().ignore();
1105  m_incidentSvc.reset();
1106  // re-initialize the base class
1108  if ( UNLIKELY( !sc.isSuccess() ) ) {
1109  error() << "Unable to reinitialize base class" << endmsg;
1110  return sc;
1111  }
1112  // the initialize part is copied here
1113  m_incidentSvc = service( "IncidentSvc", true );
1114  if ( UNLIKELY( !m_incidentSvc ) ) {
1115  error() << "Failed to access incident service." << endmsg;
1116  return StatusCode::FAILURE;
1117  }
1118  // return
1119  return StatusCode::SUCCESS;
1120 }
#define UNLIKELY(x)
Definition: Kernel.h:122
constexpr static const auto FAILURE
Definition: StatusCode.h:88
bool isSuccess() const
Definition: StatusCode.h:287
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:199
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:54
StatusCode reinitialize() override
Definition: Service.cpp:249
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
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:84
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:92
StatusCode resetPreLoad() override
Clear the preload list.
Definition: DataSvc.cpp:1046
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:112
StatusCode DataSvc::removePreLoadItem ( const DataStoreItem item)
override

Remove an item from the preload list.

Definition at line 1033 of file DataSvc.cpp.

1034 {
1036  return StatusCode::SUCCESS;
1037 }
LoadItems m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:70
T remove(T...args)
T erase(T...args)
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
AttribStringParser::Iterator begin(const AttribStringParser &parser)
StatusCode DataSvc::removePreLoadItem ( std::string  itemPath)
override

Add an item to the preload list.

Definition at line 1040 of file DataSvc.cpp.

1041 {
1042  return removePreLoadItem( DataStoreItem( std::move( itemPath ), 1 ) );
1043 }
StatusCode removePreLoadItem(const DataStoreItem &item) override
Remove an item from the preload list.
Definition: DataSvc.cpp:1033
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
T move(T...args)
StatusCode DataSvc::resetPreLoad ( )
override

Clear the preload list.

Definition at line 1046 of file DataSvc.cpp.

1047 {
1049  return StatusCode::SUCCESS;
1050 }
LoadItems m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:70
T erase(T...args)
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
AttribStringParser::Iterator begin(const AttribStringParser &parser)
StatusCode DataSvc::retrieveEntry ( DataSvcHelpers::RegistryEntry pNode,
boost::string_ref  path,
DataSvcHelpers::RegistryEntry *&  pEntry 
)
protected

Retrieve registry entry from store.

Definition at line 643 of file DataSvc.cpp.

644 {
645  return i_retrieveEntry( parentObj, path, pEntry );
646 }
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:648
StatusCode DataSvc::retrieveObject ( IRegistry pDirectory,
boost::string_ref  path,
DataObject *&  pObject 
)
override

Retrieve object from data store.

Retrieve object identified by its directory from the data store.

Definition at line 737 of file DataSvc.cpp.

738 {
739  pObject = nullptr;
740  RegEntry * result = nullptr, *parent = CAST_REGENTRY( RegEntry *, pRegistry );
741  StatusCode status = i_retrieveEntry( parent, path, result );
742  if ( status.isSuccess() ) pObject = result->object();
743  return status;
744 }
DataObject * object() const override
Retrive object behind the link.
bool isSuccess() const
Definition: StatusCode.h:287
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:648
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
StatusCode DataSvc::retrieveObject ( boost::string_ref  fullPath,
DataObject *&  pObject 
)
override

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

Definition at line 747 of file DataSvc.cpp.

748 {
749  IRegistry* nullDir = nullptr;
750  return retrieveObject( nullDir, fullPath, pObject );
751 }
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, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:737
StatusCode DataSvc::retrieveObject ( boost::string_ref  parentPath,
boost::string_ref  objPath,
DataObject *&  pObject 
)
override

Retrieve object from data store.

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

Definition at line 754 of file DataSvc.cpp.

755 {
756  DataObject* parent = nullptr;
757  StatusCode status = retrieveObject( parentPath, parent );
758  return status.isSuccess() ? retrieveObject( parent, objectPath, pObject ) : status;
759 }
bool isSuccess() const
Definition: StatusCode.h:287
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:737
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::retrieveObject ( boost::string_ref  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 762 of file DataSvc.cpp.

763 {
764  return retrieveObject( parentPath, itemToPath( item ), pObject );
765 }
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:737
StatusCode DataSvc::retrieveObject ( DataObject parentObj,
boost::string_ref  objPath,
DataObject *&  pObject 
)
override

Retrieve object from data store.

Definition at line 768 of file DataSvc.cpp.

769 {
770  IRegistry* pRegistry = ( parentObj ? parentObj->registry() : nullptr );
771  return retrieveObject( pRegistry, path, pObject );
772 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
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, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:737
StatusCode DataSvc::retrieveObject ( DataObject parentObj,
int  item,
DataObject *&  pObject 
)
override

Retrieve object from data store.

Retrieve registry entry from store.

Definition at line 775 of file DataSvc.cpp.

776 {
777  return retrieveObject( parentObj, itemToPath( item ), pObject );
778 }
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:737
CLID DataSvc::rootCLID ( ) const
override

IDataManagerSvc: Accessor for root event CLID.

CLID for root Event.

Definition at line 1134 of file DataSvc.cpp.

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

IDataManagerSvc: Accessor for root event name.

Name for root Event.

Definition at line 1137 of file DataSvc.cpp.

1137 { return m_rootName; }
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:57
StatusCode DataSvc::setDataLoader ( IConversionSvc svc,
IDataProviderSvc dpsvc = nullptr 
)
override

IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data provider.

IDataManagerSvc: Pass a default data loader to the service.

Definition at line 199 of file DataSvc.cpp.

200 {
201  m_dataLoader = pDataLoader;
202  if ( m_dataLoader ) m_dataLoader->setDataProvider( dpsvc ? dpsvc : this ).ignore();
203  return StatusCode::SUCCESS;
204 }
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
Definition: DataSvc.h:52
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
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 150 of file DataSvc.cpp.

151 {
152  clearStore().ignore();
153  return i_setRoot( std::move( root_path ), pRootObj );
154 }
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:161
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:112
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 176 of file DataSvc.cpp.

177 {
178  clearStore().ignore();
179  return i_setRoot( std::move( root_path ), pRootAddr );
180 }
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:161
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:112
StatusCode DataSvc::traverseSubTree ( boost::string_ref  sub_tree_path,
IDataStoreAgent pAgent 
)
override

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

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

Definition at line 123 of file DataSvc.cpp.

124 {
125  DataObject* pO = nullptr;
126  StatusCode status = findObject( sub_tree_path, pO );
127  return status.isSuccess() ? traverseSubTree( pO, pAgent ) : status;
128 }
bool isSuccess() const
Definition: StatusCode.h:287
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode traverseSubTree(boost::string_ref sub_tree_path, IDataStoreAgent *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full pat...
Definition: DataSvc.cpp:123
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
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 131 of file DataSvc.cpp.

132 {
133  if ( !checkRoot() ) return Status::INVALID_ROOT;
134  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
135  if ( !entry ) return Status::INVALID_OBJECT;
136  return entry->traverseTree( pAgent );
137 }
StatusCode 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:73
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
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 140 of file DataSvc.cpp.

141 {
142  if ( !checkRoot() ) return Status::INVALID_ROOT;
143  return m_root->traverseTree( pAgent );
144 }
StatusCode 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,
boost::string_ref  objPath 
)
override

Remove a link to another object.

Definition at line 970 of file DataSvc.cpp.

971 {
972  if ( !checkRoot() ) return Status::INVALID_ROOT;
973  try {
974  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
975  if ( from_entry ) {
976  auto sep = objPath.rfind( SEPARATOR );
977  if ( sep > 0 && sep != boost::string_ref::npos ) { // in case the objPath is a sub-directory itself
978  DataObject* pO = nullptr;
979  StatusCode sc = findObject( from, objPath.substr( 0, sep ), pO );
980  return sc.isSuccess() ? unlinkObject( pO->registry(), objPath.substr( sep ) ) : sc;
981  }
982  StatusCode status = from_entry->remove( objPath );
983  if ( status.isSuccess() ) return status;
984  return Status::INVALID_OBJ_PATH;
985  }
986  } catch ( ... ) {
987  }
988  return Status::INVALID_PARENT;
989 }
constexpr char SEPARATOR
bool isSuccess() const
Definition: StatusCode.h:287
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:970
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
StatusCode remove(boost::string_ref name)
Remove an entry from the store.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
StatusCode DataSvc::unlinkObject ( boost::string_ref  fromPath,
boost::string_ref  objPath 
)
override

Remove a link to another object.

Definition at line 1003 of file DataSvc.cpp.

1004 {
1005  DataObject* pObject = nullptr;
1006  StatusCode status = findObject( from, pObject );
1007  return status.isSuccess() ? unlinkObject( pObject->registry(), objPath ) : status;
1008 }
bool isSuccess() const
Definition: StatusCode.h:287
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:970
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
StatusCode DataSvc::unlinkObject ( DataObject fromObj,
boost::string_ref  objPath 
)
override

Remove a link to another object.

Definition at line 1011 of file DataSvc.cpp.

1012 {
1013  if ( !checkRoot() ) return Status::INVALID_ROOT;
1014  IRegistry* from_entry = m_root->findLeaf( from );
1015  return unlinkObject( from_entry, objPath );
1016 }
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
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:970
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode DataSvc::unlinkObject ( boost::string_ref  fullPath)
override

Remove a link to another object.

Definition at line 992 of file DataSvc.cpp.

993 {
994  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
995  if ( fullPath.front() != SEPARATOR ) {
996  return unlinkObject( m_rootName.value(), fullPath );
997  }
998  auto sep = fullPath.rfind( SEPARATOR );
999  return unlinkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ) );
1000 }
constexpr char SEPARATOR
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:57
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:970
StatusCode DataSvc::unregisterAddress ( boost::string_ref  fullPath)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 298 of file DataSvc.cpp.

299 {
300  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
301  return unregisterAddress( fullPath.front() != SEPARATOR ? m_root : nullptr, fullPath );
302 }
StatusCode unregisterAddress(boost::string_ref fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:298
constexpr char SEPARATOR
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
StatusCode DataSvc::unregisterAddress ( DataObject pParent,
boost::string_ref  objPath 
)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 305 of file DataSvc.cpp.

306 {
307  return unregisterAddress( pParent ? pParent->registry() : nullptr, objPath );
308 }
StatusCode unregisterAddress(boost::string_ref fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:298
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
StatusCode DataSvc::unregisterAddress ( IRegistry pParent,
boost::string_ref  objPath 
)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 311 of file DataSvc.cpp.

312 {
313  if ( !checkRoot() ) return Status::INVALID_ROOT;
314  if ( objPath.empty() ) return Status::INVALID_OBJ_PATH;
315 
316  if ( !pParent ) {
317  if ( objPath.front() != SEPARATOR ) return unregisterAddress( m_root, objPath );
318  auto sep = find( objPath, SEPARATOR, 1 );
319  if ( sep != boost::string_ref::npos && objPath.substr( 0, sep ) == m_rootName ) {
320  return unregisterAddress( m_root, objPath.substr( sep ) );
321  }
322  return Status::INVALID_PARENT;
323  }
324  if ( objPath.front() != SEPARATOR ) {
325  return unregisterAddress( pParent, char( SEPARATOR ) + objPath );
326  }
327  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pParent );
328  if ( node_entry ) {
329  RegEntry* leaf_entry = node_entry->findLeaf( objPath );
330  if ( leaf_entry ) {
331  auto sep = objPath.rfind( SEPARATOR );
332  if ( sep > 0 && sep != boost::string_ref::npos ) {
333  return unregisterAddress( leaf_entry->parent(), objPath.substr( sep ) );
334  }
335  StatusCode status = node_entry->remove( objPath );
336  if ( status.isSuccess() ) return status;
337  }
338  }
339  return Status::INVALID_PARENT;
340 }
StatusCode unregisterAddress(boost::string_ref fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:298
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
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
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
IRegistry * parent() const
Pointer to parent directory entry.
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
T find(T...args)
StatusCode remove(boost::string_ref name)
Remove an entry from the store.
StatusCode DataSvc::unregisterObject ( boost::string_ref  fullPath)
override

Unregister object from the data store.

Definition at line 445 of file DataSvc.cpp.

446 {
447  DataObject* pObject = nullptr;
448  StatusCode status = findObject( fullPath, pObject );
449  if ( status.isFailure() ) return status;
450  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pObject->registry() );
451  if ( !pEntry ) return Status::INVALID_ROOT;
452  if ( !pEntry->isEmpty() ) return Status::DIR_NOT_EMPTY;
453  RegEntry* pParent = pEntry->parentEntry();
454  if ( !pParent ) return Status::INVALID_PARENT;
455  if ( pObject ) pObject->addRef();
456  pParent->remove( pEntry );
457  return StatusCode::SUCCESS;
458 }
bool isFailure() const
Definition: StatusCode.h:139
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:59
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:93
StatusCode remove(boost::string_ref name)
Remove an entry from the store.
bool isEmpty() const
Simple check if the Container is empty.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
StatusCode DataSvc::unregisterObject ( boost::string_ref  parentPath,
boost::string_ref  objectPath 
)
override

Unregister object from the data store.

Definition at line 461 of file DataSvc.cpp.

462 {
463  DataObject* pO = nullptr;
464  StatusCode status = findObject( parentPath, pO );
465  return status.isSuccess() ? unregisterObject( pO, objPath ) : status;
466 }
StatusCode unregisterObject(boost::string_ref fullPath) override
Unregister object from the data store.
Definition: DataSvc.cpp:445
bool isSuccess() const
Definition: StatusCode.h:287
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
StatusCode DataSvc::unregisterObject ( boost::string_ref  parentPath,
int  item 
)
override

Unregister object from the data store.

Definition at line 469 of file DataSvc.cpp.

470 {
471  return unregisterObject( parentPath, itemToPath( item ) );
472 }
StatusCode unregisterObject(boost::string_ref fullPath) override
Unregister object from the data store.
Definition: DataSvc.cpp:445
StatusCode DataSvc::unregisterObject ( DataObject pObject)
override

Unregister object from the data store.

Definition at line 475 of file DataSvc.cpp.

476 {
477  if ( !checkRoot() ) return Status::INVALID_ROOT;
478  RegEntry* entry = m_root->findLeaf( pObject );
479  if ( !entry ) return Status::INVALID_OBJECT;
480  RegEntry* parent = entry->parentEntry();
481  if ( !parent ) return Status::INVALID_PARENT;
482  if ( !entry->isEmpty() ) return Status::DIR_NOT_EMPTY;
483  if ( entry->object() ) entry->object()->addRef();
484  if ( parent ) parent->remove( entry );
485  return StatusCode::SUCCESS;
486 }
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
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:59
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:93
StatusCode remove(boost::string_ref name)
Remove an entry from the store.
bool isEmpty() const
Simple check if the Container is empty.
StatusCode DataSvc::unregisterObject ( DataObject pObject,
boost::string_ref  objectPath 
)
override

Unregister object from the data store.

Definition at line 489 of file DataSvc.cpp.

490 {
491  if ( checkRoot() ) {
492  try {
493  RegEntry* parent = CAST_REGENTRY( RegEntry*, pParentObj->registry() );
494  if ( parent ) {
495  RegEntry* entry = parent->findLeaf( objectPath );
496  if ( entry ) {
497  if ( entry->isEmpty() ) {
498  if ( entry->object() ) {
499  entry->object()->addRef();
500  }
501  parent->remove( entry );
502  return StatusCode::SUCCESS;
503  }
504  return Status::DIR_NOT_EMPTY;
505  }
506  return Status::INVALID_OBJECT;
507  }
508  } catch ( ... ) {
509  }
510  return Status::INVALID_PARENT;
511  }
512  return Status::INVALID_ROOT;
513 }
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 unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:59
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
StatusCode remove(boost::string_ref name)
Remove an entry from the store.
bool isEmpty() const
Simple check if the Container is empty.
StatusCode DataSvc::unregisterObject ( DataObject pObject,
int  item 
)
override

Unregister object from the data store.

Definition at line 516 of file DataSvc.cpp.

517 {
518  return unregisterObject( pParentObj, itemToPath( item ) );
519 }
StatusCode unregisterObject(boost::string_ref fullPath) override
Unregister object from the data store.
Definition: DataSvc.cpp:445
StatusCode DataSvc::updateObject ( IRegistry pDirectory)
override

Update object identified by its directory entry.

Update object.

Definition at line 843 of file DataSvc.cpp.

844 {
845  if ( !pRegistry ) { // Precondition:
846  return Status::INVALID_OBJ_ADDR; // Addres must be valid
847  }
848  DataObject* toUpdate = pRegistry->object();
849  if ( !toUpdate ) { // Try first to load
850  return loadObject( pRegistry );
851  }
852  return updateObject( toUpdate );
853 }
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: DataSvc.cpp:562
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:843
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode DataSvc::updateObject ( boost::string_ref  updatePath)
override

Update object.

Definition at line 835 of file DataSvc.cpp.

836 {
837  DataObject* pO = nullptr;
838  StatusCode status = findObject( updatePath, pO );
839  return status.isSuccess() ? updateObject( pO ) : retrieveObject( updatePath, pO );
840 }
bool isSuccess() const
Definition: StatusCode.h:287
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:737
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:843
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
StatusCode DataSvc::updateObject ( DataObject toUpdate)
override

Update object.

Definition at line 856 of file DataSvc.cpp.

857 {
858  StatusCode status = Status::INVALID_OBJ_ADDR;
859  if ( !toUpdate ) { // Precondition:
860  return Status::INVALID_OBJECT; // Address must be valid
861  }
862  IRegistry* pRegistry = toUpdate->registry(); // Precondition:
863  if ( !pRegistry ) { // Need valid registry
864  return Status::INVALID_OBJECT;
865  }
866  IOpaqueAddress* pAddress = pRegistry->address(); // Precondition:
867  if ( !pAddress ) { // Need valid address
868  return Status::INVALID_OBJ_ADDR;
869  }
870  IConversionSvc* pLoader = getDataLoader( pRegistry );
871  if ( !pLoader ) { // Precondition:
872  return Status::NO_DATA_LOADER; // Data loader must be present
873  }
874  if ( !m_inhibitPathes.empty() ) {
875  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), pRegistry->identifier() );
876  if ( inhibit != m_inhibitPathes.end() ) {
877  return Status::NO_ACCESS;
878  }
879  }
880  try {
881  status = pLoader->updateObj( pAddress, toUpdate ); // Call data loader
882  if ( status.isSuccess() ) {
883  status = pLoader->updateObjRefs( pAddress, toUpdate );
884  }
885  } catch ( const GaudiException& exc ) {
886  throw GaudiException( "GaudiException in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE, exc );
887  } catch ( const std::exception& x ) {
888  throw GaudiException( "std::exception in updateObject() " + pRegistry->name() + ": " +
889  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
891  } catch ( ... ) {
892  throw GaudiException( "UNKN exception in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE );
893  }
894  return status;
895 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Define general base for Gaudi exception.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:288
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:332
bool isSuccess() const
Definition: StatusCode.h:287
virtual const name_type & name() const =0
Name of the directory (or key)
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
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:51
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:1145
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
StatusCode DataSvc::updateObject ( boost::string_ref  parentPath,
boost::string_ref  updatePath 
)
override

Update object.

Definition at line 898 of file DataSvc.cpp.

899 {
900  DataObject* pParent = nullptr;
901  StatusCode status = findObject( parentPath, pParent );
902  return status.isSuccess() ? updateObject( pParent, updatePath ) : status;
903 }
bool isSuccess() const
Definition: StatusCode.h:287
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:843
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
StatusCode DataSvc::updateObject ( DataObject pParent,
boost::string_ref  updatePath 
)
override

Update object.

Definition at line 906 of file DataSvc.cpp.

907 {
908  DataObject* pObject = nullptr;
909  StatusCode status = findObject( parent, updatePath, pObject );
910  return status.isSuccess() ? updateObject( pObject ) : status;
911 }
bool isSuccess() const
Definition: StatusCode.h:287
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:843
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795

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: