The Gaudi Framework  v31r0 (aeb156f0)
TsDataSvc Class Reference

Data service base class. More...

#include <GaudiKernel/TsDataSvc.h>

Inheritance diagram for TsDataSvc:
Collaboration diagram for TsDataSvc:

Public Member Functions

CLID rootCLID () const override
 IDataManagerSvc: Accessor for root event CLID. More...
 
const std::stringrootName () const override
 IDataManagerSvc: Accessor for root event name. More...
 
StatusCode registerAddress (boost::string_ref fullPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store. More...
 
StatusCode registerAddress (IRegistry *parentObj, boost::string_ref objectPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store. More...
 
StatusCode unregisterAddress (boost::string_ref fullPath) override
 IDataManagerSvc: Unregister object address from the data store. More...
 
StatusCode unregisterAddress (IRegistry *pParent, boost::string_ref objPath) override
 IDataManagerSvc: Unregister object address from the data store. More...
 
StatusCode objectLeaves (const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object. More...
 
StatusCode objectLeaves (const IRegistry *pRegistry, std::vector< IRegistry * > &refLeaves) override
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object. More...
 
StatusCode objectParent (const DataObject *pObject, IRegistry *&refpParent) override
 IDataManagerSvc: Explore the object store: retrieve the object's parent. More...
 
StatusCode objectParent (const IRegistry *pRegistry, IRegistry *&refpParent) override
 IDataManagerSvc: Explore the object store: retrieve the object's parent. More...
 
StatusCode clearSubTree (boost::string_ref sub_tree_path) override
 IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name. More...
 
StatusCode clearSubTree (DataObject *pObject) override
 IDataManagerSvc: Remove all data objects below the sub tree identified by the object. More...
 
StatusCode clearStore () override
 IDataManagerSvc: Remove all data objects in the data store. More...
 
StatusCode traverseSubTree (boost::string_ref sub_tree_path, IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full path name. More...
 
StatusCode traverseSubTree (DataObject *pObject, IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects below the sub tree. More...
 
StatusCode traverseTree (IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects in the data store. More...
 
StatusCode setRoot (std::string root_name, DataObject *pRootObj) override
 Initialize data store for new event by giving new event path and root object. More...
 
virtual StatusCode i_setRoot (std::string root_name, DataObject *pRootObj)
 Initialize data store for new event by giving new event path and root object. More...
 
StatusCode i_setRoot (DataObject *pRootObj)
 
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 i_setRoot (IOpaqueAddress *pRootAddr)
 
StatusCode setDataLoader (IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
 IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data provider. More...
 
StatusCode addPreLoadItem (const DataStoreItem &item) override
 Add an item to the preload list. More...
 
StatusCode removePreLoadItem (const DataStoreItem &item) override
 Remove an item from the preload list. More...
 
StatusCode resetPreLoad () override
 Clear the preload list. More...
 
virtual StatusCode preLoad (int depth, int load_depth, DataObject *pObject)
 Execute one level of preloading and recursively load until the final level is reached. More...
 
StatusCode preLoad () override
 load all preload items of the list More...
 
StatusCode registerObject (boost::string_ref parentPath, boost::string_ref objPath, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode registerObject (DataObject *parentObj, boost::string_ref objPath, DataObject *pObject) override
 Register object with the data store. More...
 
StatusCode unregisterObject (boost::string_ref fullPath) override
 Unregister object from the data store. More...
 
StatusCode unregisterObject (DataObject *pObject) override
 Unregister object from the data store. More...
 
StatusCode unregisterObject (DataObject *pObject, boost::string_ref objectPath) override
 Unregister object from the data store. More...
 
StatusCode retrieveObject (IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
 Retrieve object from data store. More...
 
StatusCode findObject (boost::string_ref fullPath, DataObject *&pObject) override
 Find object identified by its full path in the data store. More...
 
StatusCode findObject (IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
 Find object identified by its full path in the data store. More...
 
StatusCode linkObject (IRegistry *from, boost::string_ref objPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode linkObject (boost::string_ref fullPath, DataObject *to) override
 Add a link to another object. More...
 
StatusCode unlinkObject (IRegistry *from, boost::string_ref objPath) override
 Remove a link to another object. More...
 
StatusCode unlinkObject (DataObject *fromObj, boost::string_ref objPath) override
 Remove a link to another object. More...
 
StatusCode unlinkObject (boost::string_ref fullPath) override
 Remove a link to another object. More...
 
StatusCode updateObject (IRegistry *pDirectory) override
 Update object identified by its directory entry. More...
 
StatusCode updateObject (DataObject *toUpdate) override
 Update object. More...
 
StatusCode initialize () override
 Service initialization. More...
 
StatusCode reinitialize () override
 Service initialization. More...
 
StatusCode finalize () override
 Service initialization. More...
 
 TsDataSvc (const TsDataSvc &)=delete
 no copy constructor More...
 
TsDataSvcoperator= (const TsDataSvc &)=delete
 no assignment operator 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

tsDataSvcMutex m_accessMutex
 Mutex to protect access to the store. 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 Attributes

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

Additional Inherited Members

- Public Types inherited from extends< Service, IDataProviderSvc, IDataManagerSvc >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 

Detailed Description

Data service base class.

A data service manages the transient data stores and implements the IDataProviderSvc and IDataManagerSvc interfaces.

The accessor methods are protected with a lock. This is done having in mind the DetDataSvc and the retrieval of subdetectors in a multithreaded FW. This solution cannot solve the problem of having different conditions set available simultaneously but it is the simplest solution to allow multiple algorithms running concurrently to access detector components. In first approximation, since for the data we have the whiteboard, we protect only the retrieval of objects.

Author
Markus Frank
Sebastien Ponce
Danilo Piparo
Version
1.1

Definition at line 57 of file TsDataSvc.h.

Constructor & Destructor Documentation

TsDataSvc::TsDataSvc ( const TsDataSvc )
delete

no copy constructor

Member Function Documentation

StatusCode TsDataSvc::addPreLoadItem ( const DataStoreItem item)
override

Add an item to the preload list.

Definition at line 756 of file TsDataSvc.cpp.

756  {
757  auto i = std::find( m_preLoads.begin(), m_preLoads.end(), item );
758  if ( i == m_preLoads.end() ) m_preLoads.push_back( item );
759  return StatusCode::SUCCESS;
760 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T end(T...args)
T push_back(T...args)
T find(T...args)
T begin(T...args)
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:78
bool TsDataSvc::checkRoot ( )
inlineprotected

Check if root path is valid.

Definition at line 265 of file TsDataSvc.h.

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

IDataManagerSvc: Remove all data objects in the data store.

Definition at line 104 of file TsDataSvc.cpp.

104  {
105  if ( !checkRoot() ) return Status::INVALID_ROOT;
106  m_root.reset();
107  return StatusCode::SUCCESS;
108 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T reset(T...args)
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:80
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:265
StatusCode TsDataSvc::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 78 of file TsDataSvc.cpp.

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

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

Definition at line 93 of file TsDataSvc.cpp.

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

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

Definition at line 859 of file TsDataSvc.cpp.

859 { return new DataObject(); }
StatusCode TsDataSvc::finalize ( )
override

Service initialization.

Service initialisation.

Definition at line 840 of file TsDataSvc.cpp.

840  {
841  // Nothing to do: just call base class initialisation
842  setDataLoader( nullptr ).ignore();
843  resetPreLoad().ignore();
844  clearStore().ignore();
845  if ( m_incidentSvc ) {
847  m_incidentSvc = nullptr;
848  }
849  return Service::finalize();
850 }
StatusCode finalize() override
Definition: Service.cpp:164
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data pro...
Definition: TsDataSvc.cpp:184
StatusCode resetPreLoad() override
Clear the preload list.
Definition: TsDataSvc.cpp:770
IIncidentSvc * m_incidentSvc
Pointer to incident service.
Definition: TsDataSvc.h:62
virtual unsigned long release()=0
Release Interface instance.
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:104
StatusCode TsDataSvc::findObject ( boost::string_ref  fullPath,
DataObject *&  pObject 
)
override

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

Definition at line 637 of file TsDataSvc.cpp.

637  {
638  pObject = nullptr;
640  if ( !checkRoot() ) return Status::INVALID_ROOT;
641  if ( path.empty() || path == m_rootName ) {
642  pObject = m_root->object();
643  return !pObject ? Status::OBJ_NOT_LOADED : Status::IDataProviderSvc_NO_ERROR;
644  }
645  return findObject( path.front() != SEPARATOR ? m_root.get() : nullptr, path, pObject );
646 }
DataObject * object() const override
Retrive object behind the link.
constexpr char SEPARATOR
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: TsDataSvc.cpp:637
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:80
T get(T...args)
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:265
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:44
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:65
StatusCode TsDataSvc::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 623 of file TsDataSvc.cpp.

623  {
625  pObject = nullptr;
626  IRegistry* pReg = ( pRegistry ? pRegistry : m_root.get() );
627  RegEntry* root_entry = CAST_REGENTRY( RegEntry*, pReg );
628  if ( root_entry ) {
629  if ( !path.empty() ) pReg = root_entry->find( path );
630  if ( !pReg ) return Status::INVALID_OBJ_PATH;
631  pObject = pReg->object();
632  }
633  return pObject ? Status::IDataProviderSvc_NO_ERROR : Status::OBJ_NOT_LOADED;
634 }
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.
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:80
T get(T...args)
IRegistry * find(const IRegistry *obj) const
Try to find an object identified by its pointer.
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:44
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:65
IConversionSvc * TsDataSvc::getDataLoader ( IRegistry pReg)
protectedvirtual

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

Definition at line 864 of file TsDataSvc.cpp.

864 { return m_dataLoader; }
IConversionSvc * m_dataLoader
Pointer to data loader service.
Definition: TsDataSvc.h:60
DataObject * TsDataSvc::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 429 of file TsDataSvc.cpp.

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

149  {
150  if ( pRootObj ) {
151  m_root = std::make_unique<RegEntry>( std::move( root_path ) );
152  m_root->makeHard( pRootObj );
153  m_root->setDataSvc( this );
154  // No done with GaudiHive. preLoad().ignore();
155  }
156  return StatusCode::SUCCESS;
157 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:89
T move(T...args)
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:80
void makeHard(DataObject *pObject)
Initialize link as hard link.
StatusCode TsDataSvc::i_setRoot ( DataObject pRootObj)
inline

Definition at line 152 of file TsDataSvc.h.

152 { return i_setRoot( m_rootName, pRootObj ); }
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: TsDataSvc.cpp:149
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:65
StatusCode TsDataSvc::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 173 of file TsDataSvc.cpp.

173  {
174  if ( pRootAddr ) {
175  m_root = std::make_unique<RegEntry>( std::move( root_path ) );
176  m_root->makeHard( pRootAddr );
177  m_root->setDataSvc( this );
178  // Not done with GaudiHive. preLoad().ignore();
179  }
180  return StatusCode::SUCCESS;
181 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:89
T move(T...args)
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:80
void makeHard(DataObject *pObject)
Initialize link as hard link.
StatusCode TsDataSvc::i_setRoot ( IOpaqueAddress pRootAddr)
inline

Definition at line 163 of file TsDataSvc.h.

163 { return i_setRoot( m_rootName, pRootAddr ); }
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: TsDataSvc.cpp:149
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:65
StatusCode TsDataSvc::initialize ( )
override

Service initialization.

Definition at line 803 of file TsDataSvc.cpp.

803  {
804  // Nothing to do: just call base class initialisation
806  if ( !sc.isSuccess() ) return sc;
807  sc = service( "IncidentSvc", m_incidentSvc, true );
808  if ( UNLIKELY( !sc.isSuccess() ) ) { error() << "Failed to access incident service." << endmsg; }
809  return sc;
810 }
#define UNLIKELY(x)
Definition: Kernel.h:89
StatusCode initialize() override
Definition: Service.cpp:60
bool isSuccess() const
Definition: StatusCode.h:267
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
IIncidentSvc * m_incidentSvc
Pointer to incident service.
Definition: TsDataSvc.h:62
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: Service.h:83
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
StatusCode TsDataSvc::linkObject ( IRegistry from,
boost::string_ref  objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 687 of file TsDataSvc.cpp.

687  {
689  if ( !checkRoot() ) return Status::INVALID_ROOT;
690  try {
691  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
692  if ( from_entry ) {
693  // First check if both objects are already registered to the store
694  RegEntry* to_entry = m_root->findLeaf( to );
695  if ( !to_entry ) return Status::INVALID_OBJECT;
696  auto sep = objPath.rfind( SEPARATOR );
697  if ( sep > 0 && sep != boost::string_ref::npos ) { // in case the objPath is a sub-directory itself
698  DataObject* pO = nullptr;
699  StatusCode sc = retrieveObject( from, objPath.substr( 0, sep ), pO );
700  return sc.isSuccess() ? linkObject( pO->registry(), objPath.substr( sep ), to ) : sc;
701  }
702  // Now register the soft link
703  StatusCode status = from_entry->add( objPath.to_string(), to, true );
704  return status.isSuccess() ? Status::IDataProviderSvc_NO_ERROR : Status::DOUBL_OBJ_PATH;
705  }
706  } catch ( ... ) {}
707  return Status::INVALID_PARENT;
708 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
constexpr char SEPARATOR
StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *to) override
Add a link to another object.
Definition: TsDataSvc.cpp:687
bool isSuccess() const
Definition: StatusCode.h:267
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:614
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:80
StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:265
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:44
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:65
StatusCode TsDataSvc::linkObject ( boost::string_ref  fullPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 711 of file TsDataSvc.cpp.

711  {
712  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
713  if ( fullPath.front() == SEPARATOR ) {
714  auto sep = fullPath.rfind( SEPARATOR );
715  return linkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ), to );
716  }
718  return linkObject( m_root.get(), fullPath, to );
719 }
constexpr char SEPARATOR
StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *to) override
Add a link to another object.
Definition: TsDataSvc.cpp:687
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:80
T get(T...args)
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:44
StatusCode TsDataSvc::loadObject ( IRegistry pNode)
protectedvirtual

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

Definition at line 459 of file TsDataSvc.cpp.

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

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

Reimplemented in DetDataSvc.

Definition at line 467 of file TsDataSvc.cpp.

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

208  {
209  if ( !pObject ) return Status::INVALID_OBJECT;
210  return objectLeaves( pObject->registry(), leaves );
211 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
Definition: TsDataSvc.cpp:208
StatusCode TsDataSvc::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 216 of file TsDataSvc.cpp.

216  {
217  if ( !pRegistry ) return Status::INVALID_OBJECT;
218  const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
219  if ( !node_entry ) return Status::INVALID_OBJECT;
221  leaves.insert( leaves.end(), node_entry->leaves().begin(), node_entry->leaves().end() );
222  // leaves = node_entry->leaves();
223  return StatusCode::SUCCESS;
224 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T end(T...args)
const Store & leaves() const
Access the leaves of the object.
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
T begin(T...args)
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:44
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:65
StatusCode TsDataSvc::objectParent ( const DataObject pObject,
IRegistry *&  refpParent 
)
override

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

Definition at line 193 of file TsDataSvc.cpp.

193  {
194  if ( !pObject ) return Status::INVALID_OBJECT;
195  return objectParent( pObject->registry(), refpParent );
196 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object&#39;s parent.
Definition: TsDataSvc.cpp:193
StatusCode TsDataSvc::objectParent ( const IRegistry pRegistry,
IRegistry *&  refpParent 
)
override

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

Definition at line 198 of file TsDataSvc.cpp.

198  {
200  if ( !checkRoot() ) return Status::INVALID_ROOT;
201  const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
202  if ( !node_entry ) return Status::INVALID_OBJECT;
203  refpParent = node_entry->parent();
204  return StatusCode::SUCCESS;
205 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
IRegistry * parent() const
Pointer to parent directory entry.
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:265
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:44
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:65
TsDataSvc& TsDataSvc::operator= ( const TsDataSvc )
delete

no assignment operator

StatusCode TsDataSvc::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 776 of file TsDataSvc.cpp.

776  {
777  // unused: StatusCode sc = StatusCode::FAILURE;
778  if ( pObject && depth++ < load_depth ) {
779  RegEntry* dir = CAST_REGENTRY( RegEntry*, pObject->registry() );
780  if ( dir ) {
781  for ( const auto& i : *dir ) {
782  DataObject* pObj = nullptr;
783  StatusCode status = retrieveObject( pObject, i->name(), pObj );
784  if ( status.isSuccess() && depth < load_depth ) { preLoad( depth, load_depth, pObj ).ignore(); }
785  }
786  }
787  }
788  return StatusCode::SUCCESS;
789 }
bool isSuccess() const
Definition: StatusCode.h:267
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:614
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
StatusCode preLoad() override
load all preload items of the list
Definition: TsDataSvc.cpp:792
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
Definition: DataObject.cpp:62
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:65
StatusCode TsDataSvc::preLoad ( )
override

load all preload items of the list

Definition at line 792 of file TsDataSvc.cpp.

792  {
793  DataObject* pObj = nullptr;
794  for ( const auto& i : m_preLoads ) {
795  StatusCode sc = retrieveObject( i.path(), pObj );
796  int load_depth = i.depth();
797  if ( sc.isSuccess() && load_depth > 1 ) { preLoad( 1, load_depth, pObj ).ignore(); }
798  }
799  return StatusCode::SUCCESS;
800 }
bool isSuccess() const
Definition: StatusCode.h:267
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:614
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode preLoad() override
load all preload items of the list
Definition: TsDataSvc.cpp:792
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:78
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode TsDataSvc::registerAddress ( boost::string_ref  fullPath,
IOpaqueAddress pAddress 
)
override

IDataManagerSvc: Register object address with the data store.

Definition at line 227 of file TsDataSvc.cpp.

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

IDataManagerSvc: Register object address with the data store.

Definition at line 233 of file TsDataSvc.cpp.

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

Register object with the data store.

Definition at line 303 of file TsDataSvc.cpp.

303  {
304  DataObject* pO = nullptr;
305  StatusCode status = retrieveObject( parentPath, pO );
306  if ( !status.isSuccess() && m_forceLeaves ) {
307  pO = createDefaultObject();
308  status = registerObject( parentPath, pO );
309  if ( !status.isSuccess() ) pO->release();
310  }
311  return status.isSuccess() ? registerObject( pO, objPath, pObject ) : status;
312 }
bool isSuccess() const
Definition: StatusCode.h:267
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:614
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:46
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: TsDataSvc.cpp:859
Gaudi::Property< bool > m_forceLeaves
Definition: TsDataSvc.h:66
StatusCode registerObject(boost::string_ref parentPath, boost::string_ref objPath, DataObject *pObject) override
Register object with the data store.
Definition: TsDataSvc.cpp:303
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode TsDataSvc::registerObject ( DataObject parentObj,
boost::string_ref  objPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 315 of file TsDataSvc.cpp.

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

Service initialization.

Service reinitialization.

Definition at line 813 of file TsDataSvc.cpp.

813  {
814  StatusCode sc;
815  // the finalize part is copied here
816  setDataLoader( nullptr ).ignore();
817  resetPreLoad().ignore();
818  clearStore().ignore();
819  if ( m_incidentSvc ) {
821  m_incidentSvc = nullptr;
822  }
823  // re-initialize the base class
824  sc = Service::reinitialize();
825  if ( UNLIKELY( !sc.isSuccess() ) ) {
826  error() << "Unable to reinitialize base class" << endmsg;
827  return sc;
828  }
829  // the initialize part is copied here
830  sc = service( "IncidentSvc", m_incidentSvc, true );
831  if ( UNLIKELY( !sc.isSuccess() ) ) {
832  error() << "Failed to access incident service." << endmsg;
833  return sc;
834  }
835  // return
836  return StatusCode::SUCCESS;
837 }
#define UNLIKELY(x)
Definition: Kernel.h:89
bool isSuccess() const
Definition: StatusCode.h:267
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data pro...
Definition: TsDataSvc.cpp:184
StatusCode resetPreLoad() override
Clear the preload list.
Definition: TsDataSvc.cpp:770
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
IIncidentSvc * m_incidentSvc
Pointer to incident service.
Definition: TsDataSvc.h:62
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode reinitialize() override
Definition: Service.cpp:237
virtual unsigned long release()=0
Release Interface instance.
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: Service.h:83
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:104
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
StatusCode TsDataSvc::removePreLoadItem ( const DataStoreItem item)
override

Remove an item from the preload list.

Definition at line 763 of file TsDataSvc.cpp.

763  {
764  auto i = std::remove( m_preLoads.begin(), m_preLoads.end(), item );
765  m_preLoads.erase( i, m_preLoads.end() );
766  return StatusCode::SUCCESS;
767 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T end(T...args)
T remove(T...args)
T erase(T...args)
T begin(T...args)
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:78
StatusCode TsDataSvc::resetPreLoad ( )
override

Clear the preload list.

Definition at line 770 of file TsDataSvc.cpp.

770  {
771  m_preLoads.clear();
772  return StatusCode::SUCCESS;
773 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T clear(T...args)
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:78
StatusCode TsDataSvc::retrieveEntry ( DataSvcHelpers::RegistryEntry pNode,
boost::string_ref  path,
DataSvcHelpers::RegistryEntry *&  pEntry 
)
protected

Retrieve registry entry from store.

Definition at line 535 of file TsDataSvc.cpp.

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

614  {
615  pObject = nullptr;
616  RegEntry * result = nullptr, *parent = CAST_REGENTRY( RegEntry*, pRegistry );
617  StatusCode status = retrieveEntry( parent, path, result );
618  if ( status.isSuccess() ) pObject = result->object();
619  return status;
620 }
DataObject * object() const override
Retrive object behind the link.
bool isSuccess() const
Definition: StatusCode.h:267
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode retrieveEntry(DataSvcHelpers::RegistryEntry *pNode, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Retrieve registry entry from store.
Definition: TsDataSvc.cpp:535
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:65
CLID TsDataSvc::rootCLID ( ) const
override

IDataManagerSvc: Accessor for root event CLID.

CLID for root Event.

Definition at line 853 of file TsDataSvc.cpp.

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

IDataManagerSvc: Accessor for root event name.

Name for root Event.

Definition at line 856 of file TsDataSvc.cpp.

856 { return ( m_rootName ); }
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:65
StatusCode TsDataSvc::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 184 of file TsDataSvc.cpp.

184  {
185  if ( pDataLoader ) pDataLoader->addRef();
187  if ( pDataLoader ) { pDataLoader->setDataProvider( dpsvc == nullptr ? this : dpsvc ).ignore(); }
188  m_dataLoader = pDataLoader;
189  return StatusCode::SUCCESS;
190 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
IConversionSvc * m_dataLoader
Pointer to data loader service.
Definition: TsDataSvc.h:60
virtual unsigned long release()=0
Release Interface instance.
StatusCode TsDataSvc::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 139 of file TsDataSvc.cpp.

139  {
140  clearStore().ignore();
141  return i_setRoot( std::move( root_path ), pRootObj );
142 }
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: TsDataSvc.cpp:149
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:104
StatusCode TsDataSvc::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 163 of file TsDataSvc.cpp.

163  {
164  clearStore().ignore();
165  return i_setRoot( std::move( root_path ), pRootAddr );
166 }
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: TsDataSvc.cpp:149
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:104
StatusCode TsDataSvc::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 113 of file TsDataSvc.cpp.

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

120  {
122  if ( !checkRoot() ) return Status::INVALID_ROOT;
123  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
124  if ( !entry ) return Status::INVALID_OBJECT;
125  return entry->traverseTree( pAgent );
126 }
StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:265
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:44
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:65
StatusCode TsDataSvc::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 129 of file TsDataSvc.cpp.

129  {
131  if ( !checkRoot() ) return Status::INVALID_ROOT;
132  return m_root->traverseTree( pAgent );
133 }
StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:80
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:265
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:44
StatusCode TsDataSvc::unlinkObject ( IRegistry from,
boost::string_ref  objPath 
)
override

Remove a link to another object.

Definition at line 722 of file TsDataSvc.cpp.

722  {
724  if ( !checkRoot() ) return Status::INVALID_ROOT;
725  try {
726  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
727  if ( from_entry ) {
728  auto sep = objPath.rfind( SEPARATOR );
729  if ( sep > 0 && sep != boost::string_ref::npos ) { // in case the objPath is a sub-directory itself
730  DataObject* pO = nullptr;
731  StatusCode sc = findObject( from, objPath.substr( 0, sep ), pO );
732  return sc.isSuccess() ? unlinkObject( pO->registry(), objPath.substr( sep ) ) : sc;
733  }
734  StatusCode status = from_entry->remove( objPath );
735  return status.isSuccess() ? status : Status::INVALID_OBJ_PATH;
736  }
737  } catch ( ... ) {}
738  return Status::INVALID_PARENT;
739 }
constexpr char SEPARATOR
bool isSuccess() const
Definition: StatusCode.h:267
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: TsDataSvc.cpp:637
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: TsDataSvc.cpp:722
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:265
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
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:44
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:65
StatusCode TsDataSvc::unlinkObject ( DataObject fromObj,
boost::string_ref  objPath 
)
override

Remove a link to another object.

Definition at line 750 of file TsDataSvc.cpp.

750  {
751  if ( !checkRoot() ) return Status::INVALID_ROOT;
752  return unlinkObject( m_root->findLeaf( from ), objPath );
753 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: TsDataSvc.cpp:722
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:80
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:265
StatusCode TsDataSvc::unlinkObject ( boost::string_ref  fullPath)
override

Remove a link to another object.

Definition at line 742 of file TsDataSvc.cpp.

742  {
743  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
744  if ( fullPath.front() != SEPARATOR ) { return unlinkObject( m_root.get(), fullPath ); }
745  auto sep = fullPath.rfind( SEPARATOR );
746  return unlinkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ) );
747 }
constexpr char SEPARATOR
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: TsDataSvc.cpp:722
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:80
T get(T...args)
StatusCode TsDataSvc::unregisterAddress ( boost::string_ref  fullPath)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 268 of file TsDataSvc.cpp.

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

IDataManagerSvc: Unregister object address from the data store.

Definition at line 274 of file TsDataSvc.cpp.

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

Unregister object from the data store.

Definition at line 383 of file TsDataSvc.cpp.

383  {
384  DataObject* pObject = nullptr;
385  StatusCode status = findObject( fullPath, pObject );
386  if ( status.isFailure() ) return status;
387  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pObject->registry() );
388  if ( !pEntry ) return Status::INVALID_ROOT;
389  if ( !pEntry->isEmpty() ) return Status::DIR_NOT_EMPTY;
390  RegEntry* pParent = pEntry->parentEntry();
391  if ( !pParent ) return Status::INVALID_PARENT;
392  if ( pObject ) pObject->addRef();
393  pParent->remove( pEntry );
394  return StatusCode::SUCCESS;
395 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
bool isFailure() const
Definition: StatusCode.h:130
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:53
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: TsDataSvc.cpp:637
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:91
StatusCode remove(boost::string_ref name)
Remove an entry from the store.
bool isEmpty() const
Simple check if the Container is empty.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:65
StatusCode TsDataSvc::unregisterObject ( DataObject pObject)
override

Unregister object from the data store.

Definition at line 398 of file TsDataSvc.cpp.

398  {
399  if ( !checkRoot() ) return Status::INVALID_ROOT;
400  RegEntry* entry = m_root->findLeaf( pObject );
401  if ( !entry ) return Status::INVALID_OBJECT;
402  RegEntry* parent = entry->parentEntry();
403  if ( !parent ) return Status::INVALID_PARENT;
404  if ( !entry->isEmpty() ) return Status::DIR_NOT_EMPTY;
405  if ( entry->object() ) entry->object()->addRef();
406  if ( parent ) parent->remove( entry );
407  return StatusCode::SUCCESS;
408 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
DataObject * object() const override
Retrive object behind the link.
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:53
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:80
RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:91
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:265
StatusCode remove(boost::string_ref name)
Remove an entry from the store.
bool isEmpty() const
Simple check if the Container is empty.
StatusCode TsDataSvc::unregisterObject ( DataObject pObject,
boost::string_ref  objectPath 
)
override

Unregister object from the data store.

Definition at line 411 of file TsDataSvc.cpp.

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

Update object identified by its directory entry.

Update object.

Definition at line 649 of file TsDataSvc.cpp.

649  {
650  if ( !pRegistry ) return Status::INVALID_OBJ_ADDR; // Precondition: Addres must be valid
651  DataObject* toUpdate = pRegistry->object();
652  return toUpdate ? updateObject( toUpdate ) : loadObject( pRegistry );
653 }
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: TsDataSvc.cpp:649
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: TsDataSvc.cpp:459
StatusCode TsDataSvc::updateObject ( DataObject toUpdate)
override

Update object.

Definition at line 656 of file TsDataSvc.cpp.

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

Member Data Documentation

tsDataSvcMutex TsDataSvc::m_accessMutex
protected

Mutex to protect access to the store.

Definition at line 297 of file TsDataSvc.h.

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

Definition at line 75 of file TsDataSvc.h.

IConversionSvc* TsDataSvc::m_dataLoader = nullptr
private

Pointer to data loader service.

Definition at line 60 of file TsDataSvc.h.

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

Definition at line 73 of file TsDataSvc.h.

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

Definition at line 69 of file TsDataSvc.h.

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

Definition at line 71 of file TsDataSvc.h.

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

Definition at line 66 of file TsDataSvc.h.

IIncidentSvc* TsDataSvc::m_incidentSvc = nullptr
private

Pointer to incident service.

Definition at line 62 of file TsDataSvc.h.

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

Map with object paths to be inhibited from loading.

Definition at line 82 of file TsDataSvc.h.

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

Definition at line 67 of file TsDataSvc.h.

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

Items to be pre-loaded.

Definition at line 78 of file TsDataSvc.h.

std::unique_ptr<DataSvcHelpers::RegistryEntry> TsDataSvc::m_root
private

Pointer to root entry.

Definition at line 80 of file TsDataSvc.h.

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

Definition at line 64 of file TsDataSvc.h.

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

Definition at line 65 of file TsDataSvc.h.


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