The Gaudi Framework  v30r4 (9b837755)
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 59 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 819 of file TsDataSvc.cpp.

820 {
821  auto i = std::find( m_preLoads.begin(), m_preLoads.end(), item );
822  if ( i == m_preLoads.end() ) m_preLoads.push_back( item );
823  return StatusCode::SUCCESS;
824 }
T end(T...args)
T push_back(T...args)
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
T find(T...args)
T begin(T...args)
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:81
bool TsDataSvc::checkRoot ( )
inlineprotected

Check if root path is valid.

Definition at line 268 of file TsDataSvc.h.

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

IDataManagerSvc: Remove all data objects in the data store.

Definition at line 109 of file TsDataSvc.cpp.

110 {
111  if ( !checkRoot() ) return Status::INVALID_ROOT;
112  m_root.reset();
113  return StatusCode::SUCCESS;
114 }
T reset(T...args)
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:268
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 81 of file TsDataSvc.cpp.

82 {
83  DataObject* pObject = nullptr;
84  StatusCode status = findObject( sub_tree_path, pObject );
85  if ( !status.isSuccess() ) return status;
86  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
87  if ( !node_entry ) return Status::INVALID_OBJECT;
88  RegEntry* parent = node_entry->parentEntry();
89  if ( !parent ) return Status::INVALID_PARENT;
90  parent->remove( node_entry );
91  return StatusCode::SUCCESS;
92 }
bool isSuccess() const
Definition: StatusCode.h:287
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: TsDataSvc.cpp:686
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
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
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:68
StatusCode TsDataSvc::clearSubTree ( DataObject pObject)
override

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

Definition at line 97 of file TsDataSvc.cpp.

98 {
99  if ( !checkRoot() ) return Status::INVALID_ROOT;
100  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
101  if ( !entry ) return Status::INVALID_OBJECT;
102  RegEntry* parent = entry->parentEntry();
103  if ( !parent ) return Status::INVALID_PARENT;
104  parent->remove( entry );
105  return StatusCode::SUCCESS;
106 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
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
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:268
StatusCode remove(boost::string_ref name)
Remove an entry from the store.
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:68
DataObject * TsDataSvc::createDefaultObject ( ) const
protectedvirtual

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

Definition at line 936 of file TsDataSvc.cpp.

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

Service initialization.

Service initialisation.

Definition at line 916 of file TsDataSvc.cpp.

917 {
918  // Nothing to do: just call base class initialisation
919  setDataLoader( nullptr ).ignore();
920  resetPreLoad().ignore();
921  clearStore().ignore();
922  if ( m_incidentSvc ) {
924  m_incidentSvc = nullptr;
925  }
926  return Service::finalize();
927 }
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: TsDataSvc.cpp:197
StatusCode resetPreLoad() override
Clear the preload list.
Definition: TsDataSvc.cpp:835
IIncidentSvc * m_incidentSvc
Pointer to incident service.
Definition: TsDataSvc.h:65
virtual unsigned long release()=0
Release Interface instance.
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:109
StatusCode TsDataSvc::findObject ( boost::string_ref  fullPath,
DataObject *&  pObject 
)
override

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

Definition at line 686 of file TsDataSvc.cpp.

687 {
688  pObject = nullptr;
690  if ( !checkRoot() ) return Status::INVALID_ROOT;
691  if ( path.empty() || path == m_rootName ) {
692  pObject = m_root->object();
693  return !pObject ? Status::OBJ_NOT_LOADED : Status::IDataProviderSvc_NO_ERROR;
694  }
695  return findObject( path.front() != SEPARATOR ? m_root.get() : nullptr, path, pObject );
696 }
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:686
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
T get(T...args)
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:268
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:44
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:68
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 671 of file TsDataSvc.cpp.

672 {
674  pObject = nullptr;
675  IRegistry* pReg = ( pRegistry ? pRegistry : m_root.get() );
676  RegEntry* root_entry = CAST_REGENTRY( RegEntry*, pReg );
677  if ( root_entry ) {
678  if ( !path.empty() ) pReg = root_entry->find( path );
679  if ( !pReg ) return Status::INVALID_OBJ_PATH;
680  pObject = pReg->object();
681  }
682  return pObject ? Status::IDataProviderSvc_NO_ERROR : Status::OBJ_NOT_LOADED;
683 }
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:37
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
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:68
IConversionSvc * TsDataSvc::getDataLoader ( IRegistry pReg)
protectedvirtual

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

Definition at line 941 of file TsDataSvc.cpp.

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

470 {
471  if ( m_enableFaultHdlr ) {
472  IRegistry* pLeaf = nullptr;
473  if ( pReg && path.empty() ) {
474  DataIncident incident( name(), m_faultName, pReg->identifier() );
475  m_incidentSvc->fireIncident( incident );
476  return pReg->object();
477  } else if ( pReg ) {
478  std::string p = pReg->identifier();
479  if ( path.front() != SEPARATOR ) p += SEPARATOR;
480  p.append( path.data(), path.size() );
481  DataIncident incident( name(), m_faultName, p );
482  m_incidentSvc->fireIncident( incident );
483  pLeaf = m_root->findLeaf( p );
484  } else {
486  if ( path.front() != SEPARATOR ) p += SEPARATOR;
487  p.append( path.data(), path.size() );
488  DataIncident incident( name(), m_faultName, p );
489  m_incidentSvc->fireIncident( incident );
490  pLeaf = m_root->findLeaf( p );
491  }
492  if ( pLeaf ) return pLeaf->object();
493  }
494  return nullptr;
495 }
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
STL class.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
IIncidentSvc * m_incidentSvc
Pointer to incident service.
Definition: TsDataSvc.h:65
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:83
const std::string & identifier() const override
Full identifier (or key)
Data service incident class.
Gaudi::Property< bool > m_enableFaultHdlr
Definition: TsDataSvc.h:72
Gaudi::Property< std::string > m_faultName
Definition: TsDataSvc.h:74
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 159 of file TsDataSvc.cpp.

160 {
161  if ( pRootObj ) {
162  m_root = std::make_unique<RegEntry>( std::move( root_path ) );
163  m_root->makeHard( pRootObj );
164  m_root->setDataSvc( this );
165  // No done with GaudiHive. preLoad().ignore();
166  }
167  return StatusCode::SUCCESS;
168 }
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
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
void makeHard(DataObject *pObject)
Initialize link as hard link.
StatusCode TsDataSvc::i_setRoot ( DataObject pRootObj)
inline

Definition at line 155 of file TsDataSvc.h.

155 { 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:159
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:68
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 185 of file TsDataSvc.cpp.

186 {
187  if ( pRootAddr ) {
188  m_root = std::make_unique<RegEntry>( std::move( root_path ) );
189  m_root->makeHard( pRootAddr );
190  m_root->setDataSvc( this );
191  // Not done with GaudiHive. preLoad().ignore();
192  }
193  return StatusCode::SUCCESS;
194 }
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
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
void makeHard(DataObject *pObject)
Initialize link as hard link.
StatusCode TsDataSvc::i_setRoot ( IOpaqueAddress pRootAddr)
inline

Definition at line 166 of file TsDataSvc.h.

166 { 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:159
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:68
StatusCode TsDataSvc::initialize ( )
override

Service initialization.

Definition at line 875 of file TsDataSvc.cpp.

876 {
877  // Nothing to do: just call base class initialisation
879  if ( !sc.isSuccess() ) return sc;
880  sc = service( "IncidentSvc", m_incidentSvc, true );
881  if ( UNLIKELY( !sc.isSuccess() ) ) {
882  error() << "Failed to access incident service." << endmsg;
883  }
884  return sc;
885 }
#define UNLIKELY(x)
Definition: Kernel.h:89
StatusCode initialize() override
Definition: Service.cpp:63
bool isSuccess() const
Definition: StatusCode.h:287
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
IIncidentSvc * m_incidentSvc
Pointer to incident service.
Definition: TsDataSvc.h:65
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
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 TsDataSvc::linkObject ( IRegistry from,
boost::string_ref  objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 741 of file TsDataSvc.cpp.

742 {
744  if ( !checkRoot() ) return Status::INVALID_ROOT;
745  try {
746  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
747  if ( from_entry ) {
748  // First check if both objects are already registered to the store
749  RegEntry* to_entry = m_root->findLeaf( to );
750  if ( !to_entry ) return Status::INVALID_OBJECT;
751  auto sep = objPath.rfind( SEPARATOR );
752  if ( sep > 0 && sep != boost::string_ref::npos ) { // in case the objPath is a sub-directory itself
753  DataObject* pO = nullptr;
754  StatusCode sc = retrieveObject( from, objPath.substr( 0, sep ), pO );
755  return sc.isSuccess() ? linkObject( pO->registry(), objPath.substr( sep ), to ) : sc;
756  }
757  // Now register the soft link
758  StatusCode status = from_entry->add( objPath.to_string(), to, true );
759  return status.isSuccess() ? Status::IDataProviderSvc_NO_ERROR : Status::DOUBL_OBJ_PATH;
760  }
761  } catch ( ... ) {
762  }
763  return Status::INVALID_PARENT;
764 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
constexpr char SEPARATOR
StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *to) override
Add a link to another object.
Definition: TsDataSvc.cpp:741
bool isSuccess() const
Definition: StatusCode.h:287
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:661
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
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
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:268
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:68
StatusCode TsDataSvc::linkObject ( boost::string_ref  fullPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 767 of file TsDataSvc.cpp.

768 {
769  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
770  if ( fullPath.front() == SEPARATOR ) {
771  auto sep = fullPath.rfind( SEPARATOR );
772  return linkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ), to );
773  }
775  return linkObject( m_root.get(), fullPath, to );
776 }
constexpr char SEPARATOR
StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *to) override
Add a link to another object.
Definition: TsDataSvc.cpp:741
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
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 500 of file TsDataSvc.cpp.

501 {
502  IConversionSvc* pLoader = getDataLoader( pRegistry );
503  return loadObject( pLoader, pRegistry );
504 }
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
Definition: TsDataSvc.cpp:941
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: TsDataSvc.cpp:500
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 509 of file TsDataSvc.cpp.

510 {
511  StatusCode status = Status::INVALID_OBJ_ADDR;
512  DataObject* pObject = nullptr;
514  if ( !pLoader ) { // Precondition: Data loader must be present
515  if ( handleDataFault( pRegistry ) )
516  return StatusCode::SUCCESS;
517  else
518  return Status::NO_DATA_LOADER;
519  }
520  if ( !pRegistry ) { // Precondition: Directory must be valid
521  if ( handleDataFault( pRegistry ) )
522  return StatusCode::SUCCESS;
523  else
524  return Status::INVALID_OBJ_ADDR;
525  }
526 
527  VERMSG << "Requested object " << pRegistry->identifier() << endmsg;
528 
529  if ( m_enableAccessHdlr ) {
530  // Fire data access incident
531  DataIncident incident( name(), m_accessName, pRegistry->identifier() );
532  m_incidentSvc->fireIncident( incident );
533  }
534  if ( !m_inhibitPathes.empty() ) {
535  const auto& ident = pRegistry->identifier();
536  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), ident );
537  if ( inhibit != m_inhibitPathes.end() ) return Status::NO_ACCESS;
538  }
539  IOpaqueAddress* pAddress = pRegistry->address();
540  if ( !pAddress ) { // Precondition:
541  return Status::INVALID_OBJ_ADDR; // Address must be valid
542  }
543  try {
544  status = pLoader->createObj( pAddress, pObject ); // Call data loader
545  if ( status.isSuccess() ) {
546 
547  VERMSG << "Object " << pRegistry->identifier() << " created" << endmsg;
548 
549  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pRegistry );
550  pEntry->setObject( pObject );
551 
552  VERMSG << "Filling object " << pRegistry->identifier() << endmsg;
553  status = pLoader->fillObjRefs( pAddress, pObject );
554  }
555  } catch ( const GaudiException& exc ) {
556  if ( handleDataFault( pRegistry ) ) return StatusCode::SUCCESS;
557  throw GaudiException( "GaudiException in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE,
558  exc );
559  } catch ( const std::exception& x ) {
560  if ( handleDataFault( pRegistry ) ) return StatusCode::SUCCESS;
561  throw GaudiException( "std::exception in loadObject() " + pRegistry->identifier() + ": " +
562  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
564  } catch ( ... ) {
565  if ( handleDataFault( pRegistry ) ) return StatusCode::SUCCESS;
566  throw GaudiException( "UNKN exception in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE );
567  }
568  if ( !status.isSuccess() ) {
569  if ( handleDataFault( pRegistry ) ) return StatusCode::SUCCESS;
570  }
571  ON_VERBOSE if ( status.isSuccess() )
572  {
573  verbose() << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
574  }
575  return status;
576 }
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
bool isSuccess() const
Definition: StatusCode.h:287
Gaudi::Property< std::string > m_accessName
Definition: TsDataSvc.h:78
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
#define VERMSG
Definition: TsDataSvc.cpp:76
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:65
#define ON_VERBOSE
Definition: TsDataSvc.cpp:73
T what(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
Gaudi::Property< bool > m_enableAccessHdlr
Definition: TsDataSvc.h:76
STL class.
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)
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
Data service incident class.
Opaque address interface definition.
Gaudi::Property< std::vector< std::string > > m_inhibitPathes
Definition: TsDataSvc.h:70
DataObject * handleDataFault(IRegistry *pReg, boost::string_ref path={})
Invoke data fault handling if enabled.
Definition: TsDataSvc.cpp:469
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:68
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
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 226 of file TsDataSvc.cpp.

227 {
228  if ( !pObject ) return Status::INVALID_OBJECT;
229  return objectLeaves( pObject->registry(), leaves );
230 }
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: TsDataSvc.cpp:226
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 235 of file TsDataSvc.cpp.

236 {
237  if ( !pRegistry ) return Status::INVALID_OBJECT;
238  const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
239  if ( !node_entry ) return Status::INVALID_OBJECT;
241  leaves.insert( leaves.end(), node_entry->leaves().begin(), node_entry->leaves().end() );
242  // leaves = node_entry->leaves();
243  return StatusCode::SUCCESS;
244 }
T end(T...args)
const Store & leaves() const
Access the leaves of the object.
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
T begin(T...args)
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:44
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:68
StatusCode TsDataSvc::objectParent ( const DataObject pObject,
IRegistry *&  refpParent 
)
override

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

Definition at line 209 of file TsDataSvc.cpp.

210 {
211  if ( !pObject ) return Status::INVALID_OBJECT;
212  return objectParent( pObject->registry(), refpParent );
213 }
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: TsDataSvc.cpp:209
StatusCode TsDataSvc::objectParent ( const IRegistry pRegistry,
IRegistry *&  refpParent 
)
override

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

Definition at line 215 of file TsDataSvc.cpp.

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

843 {
844  // unused: StatusCode sc = StatusCode::FAILURE;
845  if ( pObject && depth++ < load_depth ) {
846  RegEntry* dir = CAST_REGENTRY( RegEntry*, pObject->registry() );
847  if ( dir ) {
848  for ( const auto& i : *dir ) {
849  DataObject* pObj = nullptr;
850  StatusCode status = retrieveObject( pObject, i->name(), pObj );
851  if ( status.isSuccess() && depth < load_depth ) {
852  preLoad( depth, load_depth, pObj ).ignore();
853  }
854  }
855  }
856  }
857  return StatusCode::SUCCESS;
858 }
bool isSuccess() const
Definition: StatusCode.h:287
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:661
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
StatusCode preLoad() override
load all preload items of the list
Definition: TsDataSvc.cpp:861
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
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
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:68
StatusCode TsDataSvc::preLoad ( )
override

load all preload items of the list

Definition at line 861 of file TsDataSvc.cpp.

862 {
863  DataObject* pObj = nullptr;
864  for ( const auto& i : m_preLoads ) {
865  StatusCode sc = retrieveObject( i.path(), pObj );
866  int load_depth = i.depth();
867  if ( sc.isSuccess() && load_depth > 1 ) {
868  preLoad( 1, load_depth, pObj ).ignore();
869  }
870  }
871  return StatusCode::SUCCESS;
872 }
bool isSuccess() const
Definition: StatusCode.h:287
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:661
StatusCode preLoad() override
load all preload items of the list
Definition: TsDataSvc.cpp:861
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:81
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
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 247 of file TsDataSvc.cpp.

248 {
249  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
250  return registerAddress( fullPath.front() != SEPARATOR ? m_root.get() : nullptr, fullPath, pAddress );
251 }
constexpr char SEPARATOR
StatusCode registerAddress(boost::string_ref fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: TsDataSvc.cpp:247
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
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 254 of file TsDataSvc.cpp.

255 {
256  if ( !checkRoot() ) return Status::INVALID_ROOT;
257  if ( objPath.empty() ) return Status::INVALID_OBJ_PATH;
258  if ( !parentObj ) {
259  if ( objPath.front() != SEPARATOR ) {
260  return registerAddress( m_root.get(), objPath, pAddress );
261  }
262  auto sep = find( objPath, SEPARATOR, 1 );
263  if ( sep == boost::string_ref::npos || objPath.substr( 0, sep ) != m_rootName.value() ) {
264  return Status::INVALID_PARENT;
265  }
266  return registerAddress( m_root.get(), objPath.substr( sep ), pAddress );
267  }
268  if ( objPath.front() != SEPARATOR ) {
269  return registerAddress( parentObj, SEPARATOR + objPath, pAddress );
270  }
271  RegEntry* par_entry = CAST_REGENTRY( RegEntry*, parentObj );
272  if ( !par_entry ) return Status::INVALID_PARENT;
273  auto sep = objPath.rfind( SEPARATOR );
274  if ( sep > 0 && sep != boost::string_ref::npos ) {
275  auto p_path = objPath.substr( 0, sep );
276  auto o_path = objPath.substr( sep );
277  RegEntry* p_entry = par_entry->findLeaf( p_path );
278  // Create default object leafs if the
279  // intermediate nodes are not present
280  if ( !p_entry && m_forceLeaves ) {
281  DataObject* pLeaf = createDefaultObject();
282  StatusCode sc = registerObject( par_entry->identifier(), p_path, pLeaf );
283  if ( !sc.isSuccess() ) delete pLeaf;
284  p_entry = par_entry->findLeaf( p_path );
285  }
286  if ( !p_entry ) return Status::INVALID_PARENT;
287  return registerAddress( p_entry, o_path, pAddress );
288  }
289  StatusCode status = par_entry->add( objPath.to_string(), pAddress );
290  return status.isSuccess() ? status : Status::DOUBL_OBJ_PATH;
291 }
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
StatusCode registerAddress(boost::string_ref fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: TsDataSvc.cpp:247
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
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:936
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:268
Gaudi::Property< bool > m_forceLeaves
Definition: TsDataSvc.h:69
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:335
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:68
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:68
StatusCode TsDataSvc::registerObject ( boost::string_ref  parentPath,
boost::string_ref  objPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 335 of file TsDataSvc.cpp.

336 {
337  DataObject* pO = nullptr;
338  StatusCode status = retrieveObject( parentPath, pO );
339  if ( !status.isSuccess() && m_forceLeaves ) {
340  pO = createDefaultObject();
341  status = registerObject( parentPath, pO );
342  if ( !status.isSuccess() ) pO->release();
343  }
344  return status.isSuccess() ? registerObject( pO, objPath, pObject ) : status;
345 }
bool isSuccess() const
Definition: StatusCode.h:287
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:661
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
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: TsDataSvc.cpp:936
Gaudi::Property< bool > m_forceLeaves
Definition: TsDataSvc.h:69
StatusCode registerObject(boost::string_ref parentPath, boost::string_ref objPath, DataObject *pObject) override
Register object with the data store.
Definition: TsDataSvc.cpp:335
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 348 of file TsDataSvc.cpp.

349 {
350  if ( !checkRoot() ) return Status::INVALID_ROOT;
351  if ( !parentObj ) {
352  if ( !objPath.empty() ) {
353  if ( objPath.front() != SEPARATOR ) {
354  return registerObject( m_rootName.value(), objPath, pObject );
355  }
356  auto sep = find( objPath, SEPARATOR, 1 );
357  if ( sep != boost::string_ref::npos ) {
358  return registerObject( objPath.substr( 0, sep ), objPath.substr( sep ), pObject );
359  }
360  }
361  return Status::INVALID_OBJ_PATH;
362  }
363  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, parentObj->registry() );
364  if ( node_entry ) {
365  StatusCode status = Status::INVALID_PARENT;
366  auto sep = find( objPath, SEPARATOR, 1 );
367  if ( sep != boost::string_ref::npos ) {
368  auto p_path = objPath.substr( 0, sep );
369  auto o_path = objPath.substr( sep );
370  RegEntry* par_entry = node_entry->findLeaf( p_path );
371  // Create default object leafs if the
372  // intermediate nodes are not present
373  if ( !par_entry && m_forceLeaves ) {
374  DataObject* pLeaf = createDefaultObject();
375  StatusCode sc = registerObject( parentObj, p_path, pLeaf );
376  if ( !sc.isSuccess() ) delete pLeaf;
377  par_entry = node_entry->findLeaf( p_path );
378  } else if ( par_entry && !par_entry->object() ) {
379  status = retrieveEntry( node_entry, p_path, par_entry );
380  if ( !status.isSuccess() && !par_entry->address() && m_forceLeaves ) {
381  DataObject* pLeaf = createDefaultObject();
382  StatusCode sc = registerObject( parentObj, p_path, pLeaf );
383  if ( !sc.isSuccess() ) delete pLeaf;
384  par_entry = node_entry->findLeaf( p_path );
385  }
386  }
387  node_entry = par_entry;
388  if ( node_entry ) {
389  DataObject* obj = node_entry->object();
390  if ( obj ) status = registerObject( obj, o_path, pObject );
391  }
392  } else {
393  RegEntry* leaf = node_entry->findLeaf( objPath );
394  if ( !leaf ) {
395  status = node_entry->add( objPath.to_string(), pObject );
396  } else {
397  DataObject* obj = leaf->object();
398  if ( !obj ) {
399  if ( !pObject ) {
400  error() << "registerObject: trying to register null DataObject" << endmsg;
401  return StatusCode::FAILURE;
402  } else {
403  pObject->setRegistry( leaf );
404  }
405  leaf->setAddress( nullptr );
406  leaf->setObject( pObject );
407  status = StatusCode::SUCCESS;
408  } else {
409  status = Status::DOUBL_OBJ_PATH;
410  }
411  }
412  }
413  return status;
414  }
415  return Status::INVALID_PARENT;
416 }
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
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition: DataObject.h:71
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.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
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:579
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)
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:936
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:268
Gaudi::Property< bool > m_forceLeaves
Definition: TsDataSvc.h:69
StatusCode registerObject(boost::string_ref parentPath, boost::string_ref objPath, DataObject *pObject) override
Register object with the data store.
Definition: TsDataSvc.cpp:335
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:68
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:68
StatusCode TsDataSvc::reinitialize ( )
override

Service initialization.

Service reinitialization.

Definition at line 888 of file TsDataSvc.cpp.

889 {
890  StatusCode sc;
891  // the finalize part is copied here
892  setDataLoader( nullptr ).ignore();
893  resetPreLoad().ignore();
894  clearStore().ignore();
895  if ( m_incidentSvc ) {
897  m_incidentSvc = nullptr;
898  }
899  // re-initialize the base class
900  sc = Service::reinitialize();
901  if ( UNLIKELY( !sc.isSuccess() ) ) {
902  error() << "Unable to reinitialize base class" << endmsg;
903  return sc;
904  }
905  // the initialize part is copied here
906  sc = service( "IncidentSvc", m_incidentSvc, true );
907  if ( UNLIKELY( !sc.isSuccess() ) ) {
908  error() << "Failed to access incident service." << endmsg;
909  return sc;
910  }
911  // return
912  return StatusCode::SUCCESS;
913 }
#define UNLIKELY(x)
Definition: Kernel.h:89
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: TsDataSvc.cpp:197
StatusCode resetPreLoad() override
Clear the preload list.
Definition: TsDataSvc.cpp:835
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
IIncidentSvc * m_incidentSvc
Pointer to incident service.
Definition: TsDataSvc.h:65
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode reinitialize() override
Definition: Service.cpp:249
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
virtual unsigned long release()=0
Release Interface instance.
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
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:109
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode TsDataSvc::removePreLoadItem ( const DataStoreItem item)
override

Remove an item from the preload list.

Definition at line 827 of file TsDataSvc.cpp.

828 {
829  auto i = std::remove( m_preLoads.begin(), m_preLoads.end(), item );
830  m_preLoads.erase( i, m_preLoads.end() );
831  return StatusCode::SUCCESS;
832 }
T end(T...args)
T remove(T...args)
T erase(T...args)
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
T begin(T...args)
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:81
StatusCode TsDataSvc::resetPreLoad ( )
override

Clear the preload list.

Definition at line 835 of file TsDataSvc.cpp.

836 {
837  m_preLoads.clear();
838  return StatusCode::SUCCESS;
839 }
T clear(T...args)
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:81
StatusCode TsDataSvc::retrieveEntry ( DataSvcHelpers::RegistryEntry pNode,
boost::string_ref  path,
DataSvcHelpers::RegistryEntry *&  pEntry 
)
protected

Retrieve registry entry from store.

Definition at line 579 of file TsDataSvc.cpp.

580 {
581  auto sep = find( path, SEPARATOR, 1 );
582  StatusCode status = StatusCode( Status::INVALID_ROOT, true );
583  pEntry = nullptr;
585  // A.Valassi 16.08.2001 avoid core dump if store is empty
586  if ( checkRoot() ) {
587  if ( !parentObj ) {
588  if ( path.empty() || path == m_rootName ) return retrieveEntry( m_root.get(), "", pEntry );
589  if ( path.front() != SEPARATOR ) return retrieveEntry( m_root.get(), path, pEntry );
590  if ( sep == boost::string_ref::npos ) return Status::INVALID_OBJ_PATH;
591  if ( !m_root->object() ) {
592  RegEntry* r = nullptr;
593  status = retrieveEntry( m_root.get(), "", r );
594  if ( !status.isSuccess() ) return status;
595  }
596  return retrieveEntry( m_root.get(), path.substr( sep ), pEntry );
597  }
598  if ( sep != boost::string_ref::npos ) { // the string contains a separator (after pos 0)
599  auto p_path = path.substr( 0, sep );
600  auto o_path = path.substr( sep );
601  if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
602  status = loadObject( parentObj );
603  if ( !status.isSuccess() ) return status;
604  }
605  RegEntry* root_entry = parentObj->findLeaf( p_path );
606  if ( !root_entry && m_enableFaultHdlr ) {
607  // If not even the parent is there, an incident
608  // to load the parent must be fired...
609  handleDataFault( parentObj, p_path );
610  root_entry = parentObj->findLeaf( p_path );
611  }
612  if ( root_entry ) {
613  DataObject* pO = root_entry->object();
614  if ( !pO ) {
615  // Object is not loaded: load the object if at all possible
616  status = loadObject( root_entry );
617  if ( !status.isSuccess() ) return status;
618  }
619  if ( root_entry->isSoft() ) {
620  root_entry = CAST_REGENTRY( RegEntry*, pO->registry() );
621  }
622  return retrieveEntry( root_entry, o_path, pEntry );
623  }
624  return status;
625  } else if ( path.empty() ) {
626  pEntry = parentObj;
627  } else {
628  if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
629  status = loadObject( parentObj );
630  if ( !status.isSuccess() ) return status;
631  }
632  // last leave in search: find leaf and load
633  pEntry = parentObj->findLeaf( path );
634  // If no registry entry was found, trigger incident for action-on-demand
635  if ( !pEntry && m_enableFaultHdlr ) {
636  handleDataFault( parentObj, path );
637  pEntry = ( path.empty() ? parentObj : parentObj->findLeaf( path ) );
638  }
639  }
640  // Check results and return
641  if ( !pEntry ) {
642  status = Status::INVALID_OBJ_PATH;
643  } else if ( !pEntry->object() ) {
644  status = loadObject( pEntry );
645  } else if ( m_enableAccessHdlr ) {
646  // Fire data access incident
647  // I do not know if this is a good idea....
648  // This fires too often!
649  //
650  // DataIncident incident(name(), m_accessName, pEntry->identifier());
651  // m_incidentSvc->fireIncident(incident);
652  status = StatusCode::SUCCESS;
653  } else {
654  status = StatusCode::SUCCESS;
655  }
656  }
657  return status;
658 }
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
bool isSoft() const
Is the link soft or hard.
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
Gaudi::Property< bool > m_enableAccessHdlr
Definition: TsDataSvc.h:76
StatusCode retrieveEntry(DataSvcHelpers::RegistryEntry *pNode, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Retrieve registry entry from store.
Definition: TsDataSvc.cpp:579
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
T get(T...args)
T find(T...args)
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:268
DataObject * handleDataFault(IRegistry *pReg, boost::string_ref path={})
Invoke data fault handling if enabled.
Definition: TsDataSvc.cpp:469
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:68
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: TsDataSvc.cpp:500
Gaudi::Property< bool > m_enableFaultHdlr
Definition: TsDataSvc.h:72
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:68
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 661 of file TsDataSvc.cpp.

662 {
663  pObject = nullptr;
664  RegEntry * result = nullptr, *parent = CAST_REGENTRY( RegEntry *, pRegistry );
665  StatusCode status = retrieveEntry( parent, path, result );
666  if ( status.isSuccess() ) pObject = result->object();
667  return status;
668 }
DataObject * object() const override
Retrive object behind the link.
bool isSuccess() const
Definition: StatusCode.h:287
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode retrieveEntry(DataSvcHelpers::RegistryEntry *pNode, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Retrieve registry entry from store.
Definition: TsDataSvc.cpp:579
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:68
CLID TsDataSvc::rootCLID ( ) const
override

IDataManagerSvc: Accessor for root event CLID.

CLID for root Event.

Definition at line 930 of file TsDataSvc.cpp.

930 { return ( (CLID)m_rootCLID ); }
Gaudi::Property< CLID > m_rootCLID
Definition: TsDataSvc.h:67
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 933 of file TsDataSvc.cpp.

933 { return ( m_rootName ); }
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:68
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 197 of file TsDataSvc.cpp.

198 {
199  if ( pDataLoader ) pDataLoader->addRef();
201  if ( pDataLoader ) {
202  pDataLoader->setDataProvider( dpsvc == nullptr ? this : dpsvc ).ignore();
203  }
204  m_dataLoader = pDataLoader;
205  return StatusCode::SUCCESS;
206 }
IConversionSvc * m_dataLoader
Pointer to data loader service.
Definition: TsDataSvc.h:63
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
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 148 of file TsDataSvc.cpp.

149 {
150  clearStore().ignore();
151  return i_setRoot( std::move( root_path ), pRootObj );
152 }
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:159
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:109
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 174 of file TsDataSvc.cpp.

175 {
176  clearStore().ignore();
177  return i_setRoot( std::move( root_path ), pRootAddr );
178 }
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:159
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:109
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 119 of file TsDataSvc.cpp.

120 {
121  DataObject* pO = nullptr;
122  StatusCode status = findObject( sub_tree_path, pO );
123  return status.isSuccess() ? traverseSubTree( pO, pAgent ) : status;
124 }
bool isSuccess() const
Definition: StatusCode.h:287
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: TsDataSvc.cpp:686
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: TsDataSvc.cpp:119
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 127 of file TsDataSvc.cpp.

128 {
130  if ( !checkRoot() ) return Status::INVALID_ROOT;
131  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
132  if ( !entry ) return Status::INVALID_OBJECT;
133  return entry->traverseTree( pAgent );
134 }
StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:268
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:44
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:68
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 137 of file TsDataSvc.cpp.

138 {
140  if ( !checkRoot() ) return Status::INVALID_ROOT;
141  return m_root->traverseTree( pAgent );
142 }
StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:268
#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 779 of file TsDataSvc.cpp.

780 {
782  if ( !checkRoot() ) return Status::INVALID_ROOT;
783  try {
784  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
785  if ( from_entry ) {
786  auto sep = objPath.rfind( SEPARATOR );
787  if ( sep > 0 && sep != boost::string_ref::npos ) { // in case the objPath is a sub-directory itself
788  DataObject* pO = nullptr;
789  StatusCode sc = findObject( from, objPath.substr( 0, sep ), pO );
790  return sc.isSuccess() ? unlinkObject( pO->registry(), objPath.substr( sep ) ) : sc;
791  }
792  StatusCode status = from_entry->remove( objPath );
793  return status.isSuccess() ? status : Status::INVALID_OBJ_PATH;
794  }
795  } catch ( ... ) {
796  }
797  return Status::INVALID_PARENT;
798 }
constexpr char SEPARATOR
bool isSuccess() const
Definition: StatusCode.h:287
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: TsDataSvc.cpp:686
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: TsDataSvc.cpp:779
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:268
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:68
StatusCode TsDataSvc::unlinkObject ( DataObject fromObj,
boost::string_ref  objPath 
)
override

Remove a link to another object.

Definition at line 812 of file TsDataSvc.cpp.

813 {
814  if ( !checkRoot() ) return Status::INVALID_ROOT;
815  return unlinkObject( m_root->findLeaf( from ), objPath );
816 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: TsDataSvc.cpp:779
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:268
StatusCode TsDataSvc::unlinkObject ( boost::string_ref  fullPath)
override

Remove a link to another object.

Definition at line 801 of file TsDataSvc.cpp.

802 {
803  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
804  if ( fullPath.front() != SEPARATOR ) {
805  return unlinkObject( m_root.get(), fullPath );
806  }
807  auto sep = fullPath.rfind( SEPARATOR );
808  return unlinkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ) );
809 }
constexpr char SEPARATOR
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: TsDataSvc.cpp:779
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
T get(T...args)
StatusCode TsDataSvc::unregisterAddress ( boost::string_ref  fullPath)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 294 of file TsDataSvc.cpp.

295 {
296  if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
297  return unregisterAddress( fullPath.front() != SEPARATOR ? m_root.get() : nullptr, fullPath );
298 }
constexpr char SEPARATOR
StatusCode unregisterAddress(boost::string_ref fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: TsDataSvc.cpp:294
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
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 301 of file TsDataSvc.cpp.

302 {
303  if ( !checkRoot() ) return Status::INVALID_ROOT;
304 
305  if ( objPath.empty() ) return Status::INVALID_OBJ_PATH;
306  if ( !pParent ) {
307  if ( objPath.front() != SEPARATOR ) {
308  return unregisterAddress( m_root.get(), objPath );
309  }
310  auto sep = find( objPath, SEPARATOR, 1 );
311  if ( sep == boost::string_ref::npos || objPath.substr( 0, sep ) != m_rootName.value() ) {
312  return Status::INVALID_PARENT;
313  }
314  return unregisterAddress( m_root.get(), objPath.substr( sep ) );
315  }
316  if ( objPath.front() != SEPARATOR ) {
317  return unregisterAddress( pParent, SEPARATOR + objPath );
318  }
319  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pParent );
320  if ( node_entry ) {
321  RegEntry* leaf_entry = node_entry->findLeaf( objPath );
322  if ( leaf_entry ) {
323  auto sep = objPath.rfind( SEPARATOR );
324  if ( sep > 0 && sep != boost::string_ref::npos ) {
325  return unregisterAddress( leaf_entry->parent(), objPath.substr( sep ) );
326  }
327  StatusCode status = node_entry->remove( objPath );
328  if ( status.isSuccess() ) return status;
329  }
330  }
331  return Status::INVALID_PARENT;
332 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
constexpr char SEPARATOR
StatusCode unregisterAddress(boost::string_ref fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: TsDataSvc.cpp:294
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
IRegistry * parent() const
Pointer to parent directory entry.
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:37
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
T get(T...args)
T find(T...args)
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:268
StatusCode remove(boost::string_ref name)
Remove an entry from the store.
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:68
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:68
StatusCode TsDataSvc::unregisterObject ( boost::string_ref  fullPath)
override

Unregister object from the data store.

Definition at line 419 of file TsDataSvc.cpp.

420 {
421  DataObject* pObject = nullptr;
422  StatusCode status = findObject( fullPath, pObject );
423  if ( status.isFailure() ) return status;
424  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pObject->registry() );
425  if ( !pEntry ) return Status::INVALID_ROOT;
426  if ( !pEntry->isEmpty() ) return Status::DIR_NOT_EMPTY;
427  RegEntry* pParent = pEntry->parentEntry();
428  if ( !pParent ) return Status::INVALID_PARENT;
429  if ( pObject ) pObject->addRef();
430  pParent->remove( pEntry );
431  return StatusCode::SUCCESS;
432 }
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
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: TsDataSvc.cpp:686
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
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
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:68
StatusCode TsDataSvc::unregisterObject ( DataObject pObject)
override

Unregister object from the data store.

Definition at line 435 of file TsDataSvc.cpp.

436 {
437  if ( !checkRoot() ) return Status::INVALID_ROOT;
438  RegEntry* entry = m_root->findLeaf( pObject );
439  if ( !entry ) return Status::INVALID_OBJECT;
440  RegEntry* parent = entry->parentEntry();
441  if ( !parent ) return Status::INVALID_PARENT;
442  if ( !entry->isEmpty() ) return Status::DIR_NOT_EMPTY;
443  if ( entry->object() ) entry->object()->addRef();
444  if ( parent ) parent->remove( entry );
445  return StatusCode::SUCCESS;
446 }
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.
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
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition: TsDataSvc.h:83
RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:93
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:268
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 449 of file TsDataSvc.cpp.

450 {
451  if ( !checkRoot() ) return Status::INVALID_ROOT;
452  try {
453  RegEntry* parent = CAST_REGENTRY( RegEntry*, pParentObj->registry() );
454  if ( parent ) {
455  RegEntry* entry = parent->findLeaf( objectPath );
456  if ( !entry ) return Status::INVALID_OBJECT;
457  if ( !entry->isEmpty() ) return Status::DIR_NOT_EMPTY;
458  if ( entry->object() ) entry->object()->addRef();
459  parent->remove( entry );
460  return StatusCode::SUCCESS;
461  }
462  } catch ( ... ) {
463  }
464  return Status::INVALID_PARENT;
465 }
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.
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
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:268
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:68
StatusCode TsDataSvc::updateObject ( IRegistry pDirectory)
override

Update object identified by its directory entry.

Update object.

Definition at line 699 of file TsDataSvc.cpp.

700 {
701  if ( !pRegistry ) return Status::INVALID_OBJ_ADDR; // Precondition: Addres must be valid
702  DataObject* toUpdate = pRegistry->object();
703  return toUpdate ? updateObject( toUpdate ) : loadObject( pRegistry );
704 }
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: TsDataSvc.cpp:699
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:500
StatusCode TsDataSvc::updateObject ( DataObject toUpdate)
override

Update object.

Definition at line 707 of file TsDataSvc.cpp.

708 {
709  StatusCode status = Status::INVALID_OBJ_ADDR;
710  if ( !toUpdate ) return Status::INVALID_OBJECT; // Precondition: Address must be valid
711  IRegistry* pRegistry = toUpdate->registry();
712  if ( !pRegistry ) return Status::INVALID_OBJECT; // Precondition: Need valid registry
713  IOpaqueAddress* pAddress = pRegistry->address();
714  if ( !pAddress ) return Status::INVALID_OBJ_ADDR; // Precondition: Need valid address
716  IConversionSvc* pLoader = getDataLoader( pRegistry );
717  if ( !pLoader ) return Status::NO_DATA_LOADER; // Precondition: Data loader must be present
718  if ( !m_inhibitPathes.empty() ) {
719  auto& ident = pRegistry->identifier();
720  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), ident );
721  if ( inhibit != m_inhibitPathes.end() ) return Status::NO_ACCESS;
722  }
723  try {
724  status = pLoader->updateObj( pAddress, toUpdate ); // Call data loader
725  if ( status.isSuccess() ) {
726  status = pLoader->updateObjRefs( pAddress, toUpdate );
727  }
728  } catch ( const GaudiException& exc ) {
729  throw GaudiException( "GaudiException in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE, exc );
730  } catch ( const std::exception& x ) {
731  throw GaudiException( "std::exception in updateObject() " + pRegistry->name() + ": " +
732  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
734  } catch ( ... ) {
735  throw GaudiException( "UNKN exception in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE );
736  }
737  return status;
738 }
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)
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
Definition: TsDataSvc.cpp:941
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
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
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)
Opaque address interface definition.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
Gaudi::Property< std::vector< std::string > > m_inhibitPathes
Definition: TsDataSvc.h:70
#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 300 of file TsDataSvc.h.

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

Definition at line 78 of file TsDataSvc.h.

IConversionSvc* TsDataSvc::m_dataLoader = nullptr
private

Pointer to data loader service.

Definition at line 63 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 76 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 72 of file TsDataSvc.h.

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

Definition at line 74 of file TsDataSvc.h.

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

Definition at line 69 of file TsDataSvc.h.

IIncidentSvc* TsDataSvc::m_incidentSvc = nullptr
private

Pointer to incident service.

Definition at line 65 of file TsDataSvc.h.

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

Map with object paths to be inhibited from loading.

Definition at line 85 of file TsDataSvc.h.

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

Definition at line 70 of file TsDataSvc.h.

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

Items to be pre-loaded.

Definition at line 81 of file TsDataSvc.h.

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

Pointer to root entry.

Definition at line 83 of file TsDataSvc.h.

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

Definition at line 67 of file TsDataSvc.h.

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

Definition at line 68 of file TsDataSvc.h.


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