The Gaudi Framework  v30r0 (c919700c)
TsDataSvc Class Reference

Data service base class. More...

#include <GaudiKernel/TsDataSvc.h>

Inheritance diagram for TsDataSvc:
Collaboration diagram for TsDataSvc:

Public Types

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

Public Member Functions

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

Protected Member Functions

bool checkRoot ()
 Check if root path is valid. More...
 
virtual IConversionSvcgetDataLoader (IRegistry *pReg)
 Retrieve customizable data loader according to registry entry to be retrieved. More...
 
virtual DataObjectcreateDefaultObject () const
 Create default objects in case forced creation of leaves is requested. More...
 
virtual StatusCode loadObject (IRegistry *pNode)
 Invoke Persistency service to create transient object from its persistent representation. More...
 
virtual StatusCode loadObject (IConversionSvc *pLoader, IRegistry *pNode)
 Invoke Persistency service to create transient object from its persistent representation. More...
 
StatusCode retrieveEntry (DataSvcHelpers::RegistryEntry *pNode, 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 ()
 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

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

 TsDataSvc (const TsDataSvc &)=delete
 Fake copy constructor (never implemented). More...
 
TsDataSvcoperator= (const TsDataSvc &)=delete
 Fake assignment operator (never implemented). 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 58 of file TsDataSvc.h.

Member Typedef Documentation

Define set of load items.

Definition at line 62 of file TsDataSvc.h.

Constructor & Destructor Documentation

TsDataSvc::~TsDataSvc ( )
override

Standard Destructor.

Definition at line 1155 of file TsDataSvc.cpp.

1156 {
1157  setDataLoader( nullptr ).ignore();
1158  resetPreLoad().ignore();
1159  clearStore().ignore();
1160 }
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:207
StatusCode resetPreLoad() override
Clear the preload list.
Definition: TsDataSvc.cpp:1046
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:117
void ignore() const
Definition: StatusCode.h:84
TsDataSvc::TsDataSvc ( const TsDataSvc )
privatedelete

Fake copy constructor (never implemented).

Member Function Documentation

StatusCode TsDataSvc::addPreLoadItem ( const DataStoreItem item)
override

Add an item to the preload list.

Definition at line 1018 of file TsDataSvc.cpp.

1019 {
1020  auto i = std::find( m_preLoads.begin(), m_preLoads.end(), item );
1021  if ( i == m_preLoads.end() ) m_preLoads.push_back( item );
1022  return StatusCode::SUCCESS;
1023 }
T end(T...args)
T push_back(T...args)
LoadItems m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:84
T find(T...args)
T begin(T...args)
StatusCode TsDataSvc::addPreLoadItem ( std::string  itemPath)
override

Add an item to the preload list.

Definition at line 1026 of file TsDataSvc.cpp.

1027 {
1028  return addPreLoadItem( DataStoreItem( std::move( itemPath ), 1 ) );
1029 }
StatusCode addPreLoadItem(const DataStoreItem &item) override
Add an item to the preload list.
Definition: TsDataSvc.cpp:1018
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
T move(T...args)
bool TsDataSvc::checkRoot ( )
inlineprotected

Check if root path is valid.

Definition at line 335 of file TsDataSvc.h.

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

IDataManagerSvc: Remove all data objects in the data store.

Definition at line 117 of file TsDataSvc.cpp.

118 {
119  if ( !checkRoot() ) return INVALID_ROOT;
120  m_root->release();
121  m_root = nullptr;
122  return SUCCESS;
123 }
unsigned long release() override
IInterface implementation: Reference the object.
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: TsDataSvc.h:86
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
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 89 of file TsDataSvc.cpp.

90 {
91  DataObject* pObject = nullptr;
92  StatusCode status = findObject( sub_tree_path, pObject );
93  if ( !status.isSuccess() ) return status;
94  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
95  if ( !node_entry ) return INVALID_OBJECT;
96  RegEntry* parent = node_entry->parentEntry();
97  if ( !parent ) return INVALID_PARENT;
98  parent->remove( node_entry );
99  return StatusCode::SUCCESS;
100 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:92
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: TsDataSvc.cpp:793
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
virtual 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:76
StatusCode TsDataSvc::clearSubTree ( DataObject pObject)
override

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

Definition at line 105 of file TsDataSvc.cpp.

106 {
107  if ( !checkRoot() ) return INVALID_ROOT;
108  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
109  if ( !entry ) return INVALID_OBJECT;
110  RegEntry* parent = entry->parentEntry();
111  if ( !parent ) return INVALID_PARENT;
112  parent->remove( entry );
113  return SUCCESS;
114 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:92
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
virtual StatusCode remove(boost::string_ref name)
Remove an entry from the store.
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:76
DataObject * TsDataSvc::createDefaultObject ( ) const
protectedvirtual

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

Definition at line 1147 of file TsDataSvc.cpp.

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

Service initialization.

Service initialisation.

Definition at line 1127 of file TsDataSvc.cpp.

1128 {
1129  // Nothing to do: just call base class initialisation
1130  setDataLoader( nullptr ).ignore();
1131  resetPreLoad().ignore();
1132  clearStore().ignore();
1133  if ( m_incidentSvc ) {
1135  m_incidentSvc = nullptr;
1136  }
1137  return Service::finalize();
1138 }
StatusCode finalize() override
Definition: Service.cpp:174
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data pro...
Definition: TsDataSvc.cpp:207
StatusCode resetPreLoad() override
Clear the preload list.
Definition: TsDataSvc.cpp:1046
IIncidentSvc * m_incidentSvc
Pointer to incident service.
Definition: TsDataSvc.h:68
virtual unsigned long release()=0
Release Interface instance.
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:117
void ignore() const
Definition: StatusCode.h:84
StatusCode TsDataSvc::findObject ( boost::string_ref  fullPath,
DataObject *&  pObject 
)
override

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

Definition at line 793 of file TsDataSvc.cpp.

794 {
796  pObject = nullptr;
797  if ( !checkRoot() ) return INVALID_ROOT;
798  if ( path.empty() || path == m_rootName ) {
799  pObject = m_root->object();
800  return !pObject ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
801  }
802  if ( path.front() != SEPARATOR ) {
803  return findObject( m_rootName.value(), path, pObject );
804  }
805  return findObject( static_cast<IRegistry*>( nullptr ), path, pObject );
806 }
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:793
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: TsDataSvc.h:86
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:46
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:71
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 778 of file TsDataSvc.cpp.

779 {
781  pObject = nullptr;
782  IRegistry* pReg = ( pRegistry ? pRegistry : m_root );
783  RegEntry* root_entry = CAST_REGENTRY( RegEntry*, pReg );
784  if ( root_entry ) {
785  if ( !path.empty() ) pReg = root_entry->find( path );
786  if ( !pReg ) return INVALID_OBJ_PATH;
787  pObject = pReg->object();
788  }
789  return pObject ? IDataProviderSvc_NO_ERROR : OBJ_NOT_LOADED;
790 }
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: TsDataSvc.h:86
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
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:46
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:76
virtual IRegistry * find(const IRegistry *obj) const
Try to find an object identified by its pointer.
StatusCode TsDataSvc::findObject ( boost::string_ref  parentPath,
boost::string_ref  objPath,
DataObject *&  pObject 
)
override

Find object in the data store.

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

Definition at line 809 of file TsDataSvc.cpp.

810 {
811  DataObject* parent = nullptr;
812  StatusCode status = findObject( parentPath, parent );
813  return status.isSuccess() ? findObject( parent, objectPath, pObject ) : status;
814 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: TsDataSvc.cpp:793
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode TsDataSvc::findObject ( boost::string_ref  parentPath,
int  item,
DataObject *&  pObject 
)
override

Find object in the data store.

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

Definition at line 817 of file TsDataSvc.cpp.

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

Find object in the data store.

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

Definition at line 829 of file TsDataSvc.cpp.

830 {
831  return findObject( parentObj ? parentObj->registry() : nullptr, path, pObject );
832 }
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:793
StatusCode TsDataSvc::findObject ( DataObject parentObj,
int  item,
DataObject *&  pObject 
)
override

Find object in the data store.

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

Definition at line 823 of file TsDataSvc.cpp.

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

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

Definition at line 1152 of file TsDataSvc.cpp.

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

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

170 {
171  if ( pRootObj ) {
172  m_root = new RegEntry( std::move( root_path ) );
173  m_root->makeHard( pRootObj );
174  m_root->setDataSvc( this );
175  // No done with GaudiHive. preLoad().ignore();
176  }
177  return SUCCESS;
178 }
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: TsDataSvc.h:86
DataSvcHelpers::RegistryEntry RegEntry
Definition: TsDataSvc.cpp:78
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:90
T move(T...args)
void makeHard(DataObject *pObject)
Initialize link as hard link.
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 195 of file TsDataSvc.cpp.

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

Service initialization.

Definition at line 1086 of file TsDataSvc.cpp.

1087 {
1088  // Nothing to do: just call base class initialisation
1090  if ( !sc.isSuccess() ) return sc;
1091  sc = service( "IncidentSvc", m_incidentSvc, true );
1092  if ( UNLIKELY( !sc.isSuccess() ) ) {
1093  error() << "Failed to access incident service." << endmsg;
1094  }
1095  return sc;
1096 }
#define UNLIKELY(x)
Definition: Kernel.h:128
StatusCode initialize() override
Definition: Service.cpp:64
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
IIncidentSvc * m_incidentSvc
Pointer to incident service.
Definition: TsDataSvc.h:68
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: Service.h:85
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode TsDataSvc::linkObject ( IRegistry from,
boost::string_ref  objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 914 of file TsDataSvc.cpp.

915 {
917  if ( !checkRoot() ) return INVALID_ROOT;
918  try {
919  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
920  if ( from_entry ) {
921  // First check if both objects are already registered to the store
922  RegEntry* to_entry = m_root->findLeaf( to );
923  if ( !to_entry ) return INVALID_OBJECT;
924  auto sep = objPath.rfind( SEPARATOR );
925  if ( sep > 0 && sep != boost::string_ref::npos ) { // in case the objPath is a sub-directory itself
926  DataObject* pO = nullptr;
927  StatusCode sc = retrieveObject( from, objPath.substr( 0, sep ), pO );
928  return sc.isSuccess() ? linkObject( pO->registry(), objPath.substr( sep ), to ) : sc;
929  }
930  // Now register the soft link
931  StatusCode status = from_entry->add( to_string( objPath ), to, true );
932  return status.isSuccess() ? IDataProviderSvc_NO_ERROR : DOUBL_OBJ_PATH;
933  }
934  } catch ( ... ) {
935  }
936  return INVALID_PARENT;
937 }
string to_string(const T &value)
Definition: mergesort.cpp:37
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
constexpr char SEPARATOR
StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *to) override
Add a link to another object.
Definition: TsDataSvc.cpp:914
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:733
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: TsDataSvc.h:86
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
virtual 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:335
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:46
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:76
StatusCode TsDataSvc::linkObject ( boost::string_ref  fromPath,
boost::string_ref  objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 950 of file TsDataSvc.cpp.

951 {
953  DataObject* pO = nullptr;
954  StatusCode status = retrieveObject( from, pO );
955  return status.isSuccess() ? linkObject( pO->registry(), objPath, to ) : status;
956 }
StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *to) override
Add a link to another object.
Definition: TsDataSvc.cpp:914
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:733
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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:46
StatusCode TsDataSvc::linkObject ( DataObject from,
boost::string_ref  objPath,
DataObject to 
)
override

Add a link to another object.

Definition at line 959 of file TsDataSvc.cpp.

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

Add a link to another object.

Definition at line 940 of file TsDataSvc.cpp.

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

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

Definition at line 572 of file TsDataSvc.cpp.

573 {
574  IConversionSvc* pLoader = getDataLoader( pRegistry );
575  return loadObject( pLoader, pRegistry );
576 }
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
Definition: TsDataSvc.cpp:1152
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: TsDataSvc.cpp:572
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 581 of file TsDataSvc.cpp.

582 {
584  StatusCode status = INVALID_OBJ_ADDR;
585  DataObject* pObject = nullptr;
586  if ( !pLoader ) { // Precondition: Data loader must be present
587  if ( handleDataFault( pRegistry ) )
588  return SUCCESS;
589  else
590  return NO_DATA_LOADER;
591  }
592  if ( !pRegistry ) { // Precondition: Directory must be valid
593  if ( handleDataFault( pRegistry ) )
594  return SUCCESS;
595  else
596  return INVALID_OBJ_ADDR;
597  }
598 
599  VERMSG << "Requested object " << pRegistry->identifier() << endmsg;
600 
601  if ( m_enableAccessHdlr ) {
602  // Fire data access incident
603  DataIncident incident( name(), m_accessName, pRegistry->identifier() );
604  m_incidentSvc->fireIncident( incident );
605  }
606  if ( !m_inhibitPathes.empty() ) {
607  const auto& ident = pRegistry->identifier();
608  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), ident );
609  if ( inhibit != m_inhibitPathes.end() ) return NO_ACCESS;
610  }
611  IOpaqueAddress* pAddress = pRegistry->address();
612  if ( !pAddress ) { // Precondition:
613  return INVALID_OBJ_ADDR; // Address must be valid
614  }
615  try {
616  status = pLoader->createObj( pAddress, pObject ); // Call data loader
617  if ( status.isSuccess() ) {
618 
619  VERMSG << "Object " << pRegistry->identifier() << " created" << endmsg;
620 
621  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pRegistry );
622  pEntry->setObject( pObject );
623 
624  VERMSG << "Filling object " << pRegistry->identifier() << endmsg;
625  status = pLoader->fillObjRefs( pAddress, pObject );
626  }
627  } catch ( const GaudiException& exc ) {
628  if ( handleDataFault( pRegistry ) ) return SUCCESS;
629  throw GaudiException( "GaudiException in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE,
630  exc );
631  } catch ( const std::exception& x ) {
632  if ( handleDataFault( pRegistry ) ) return SUCCESS;
633  throw GaudiException( "std::exception in loadObject() " + pRegistry->identifier() + ": " +
634  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
636  } catch ( ... ) {
637  if ( handleDataFault( pRegistry ) ) return SUCCESS;
638  throw GaudiException( "UNKN exception in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE );
639  }
640  if ( !status.isSuccess() ) {
641  if ( handleDataFault( pRegistry ) ) return StatusCode::SUCCESS;
642  }
643  ON_VERBOSE if ( status.isSuccess() )
644  {
645  verbose() << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
646  }
647  return status;
648 }
Define general base for Gaudi exception.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:336
Gaudi::Property< std::string > m_accessName
Definition: TsDataSvc.h:81
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
#define VERMSG
Definition: TsDataSvc.cpp:84
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:68
#define ON_VERBOSE
Definition: TsDataSvc.cpp:81
T what(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::Property< bool > m_enableAccessHdlr
Definition: TsDataSvc.h:79
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.
Data service incident class.
Opaque address interface definition.
Gaudi::Property< std::vector< std::string > > m_inhibitPathes
Definition: TsDataSvc.h:73
DataObject * handleDataFault(IRegistry *pReg, boost::string_ref path={})
Invoke data fault handling if enabled.
Definition: TsDataSvc.cpp:541
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:46
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:76
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 237 of file TsDataSvc.cpp.

238 {
240  if ( !pObject ) return INVALID_OBJECT;
241  return objectLeaves( pObject->registry(), leaves );
242 }
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:237
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:46
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 247 of file TsDataSvc.cpp.

248 {
250  if ( !checkRoot() ) return INVALID_ROOT;
251  const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
252  if ( !node_entry ) return INVALID_OBJECT;
253  leaves.insert( leaves.end(), node_entry->leaves().begin(), node_entry->leaves().end() );
254  // leaves = node_entry->leaves();
255  return StatusCode::SUCCESS;
256 }
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)
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:46
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:76
StatusCode TsDataSvc::objectParent ( const DataObject pObject,
IRegistry *&  refpParent 
)
override

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

Definition at line 219 of file TsDataSvc.cpp.

220 {
222  if ( !pObject ) return INVALID_OBJECT;
223  return objectParent( pObject->registry(), refpParent );
224 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:46
StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object&#39;s parent.
Definition: TsDataSvc.cpp:219
StatusCode TsDataSvc::objectParent ( const IRegistry pRegistry,
IRegistry *&  refpParent 
)
override

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

Definition at line 226 of file TsDataSvc.cpp.

227 {
229  if ( !checkRoot() ) return INVALID_ROOT;
230  const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
231  if ( !node_entry ) return INVALID_OBJECT;
232  refpParent = node_entry->parent();
233  return StatusCode::SUCCESS;
234 }
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
virtual IRegistry * parent() const
Pointer to parent directory entry.
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:46
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:76
TsDataSvc& TsDataSvc::operator= ( const TsDataSvc )
privatedelete

Fake assignment operator (never implemented).

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 1053 of file TsDataSvc.cpp.

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

load all preload items of the list

Definition at line 1072 of file TsDataSvc.cpp.

1073 {
1074  DataObject* pObj = nullptr;
1075  for ( const auto& i : m_preLoads ) {
1076  StatusCode sc = retrieveObject( i.path(), pObj );
1077  int load_depth = i.depth();
1078  if ( sc.isSuccess() && load_depth > 1 ) {
1079  preLoad( 1, load_depth, pObj ).ignore();
1080  }
1081  }
1082  return StatusCode::SUCCESS;
1083 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:733
StatusCode preLoad() override
load all preload items of the list
Definition: TsDataSvc.cpp:1072
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
LoadItems m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:84
void ignore() const
Definition: StatusCode.h:84
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 259 of file TsDataSvc.cpp.

260 {
261  if ( fullPath.empty() ) return INVALID_OBJ_PATH;
262  if ( fullPath.front() != SEPARATOR ) {
263  return registerAddress( m_root, fullPath, pAddress );
264  }
265  IRegistry* pRegistry = nullptr;
266  return registerAddress( pRegistry, fullPath, pAddress );
267 }
constexpr char SEPARATOR
StatusCode registerAddress(boost::string_ref fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: TsDataSvc.cpp:259
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: TsDataSvc.h:86
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode TsDataSvc::registerAddress ( DataObject parentObj,
boost::string_ref  objectPath,
IOpaqueAddress pAddress 
)
override

IDataManagerSvc: Register object address with the data store.

Definition at line 270 of file TsDataSvc.cpp.

271 {
272  IRegistry* pRegistry = ( parentObj ? parentObj->registry() : nullptr );
273  return registerAddress( pRegistry, objectPath, pAddress );
274 }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
StatusCode registerAddress(boost::string_ref fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: TsDataSvc.cpp:259
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode TsDataSvc::registerAddress ( IRegistry parentObj,
boost::string_ref  objectPath,
IOpaqueAddress pAddress 
)
override

IDataManagerSvc: Register object address with the data store.

Definition at line 277 of file TsDataSvc.cpp.

278 {
279  if ( !checkRoot() ) return INVALID_ROOT;
280  if ( objPath.empty() ) return INVALID_OBJ_PATH;
281  if ( !parentObj ) {
282  if ( objPath.front() != SEPARATOR ) {
283  return registerAddress( m_root, objPath, pAddress );
284  }
285  auto sep = find( objPath, SEPARATOR, 1 );
286  if ( sep == boost::string_ref::npos || objPath.substr( 0, sep ) != m_rootName.value() ) {
287  return INVALID_PARENT;
288  }
289  return registerAddress( m_root, objPath.substr( sep ), pAddress );
290  }
291  if ( objPath.front() != SEPARATOR ) {
292  return registerAddress( parentObj, SEPARATOR + objPath, pAddress );
293  }
294  RegEntry* par_entry = CAST_REGENTRY( RegEntry*, parentObj );
295  if ( !par_entry ) return INVALID_PARENT;
296  auto sep = objPath.rfind( SEPARATOR );
297  if ( sep > 0 && sep != boost::string_ref::npos ) {
298  auto p_path = objPath.substr( 0, sep );
299  auto o_path = objPath.substr( sep );
300  RegEntry* p_entry = par_entry->findLeaf( p_path );
301  // Create default object leafs if the
302  // intermediate nodes are not present
303  if ( !p_entry && m_forceLeaves ) {
304  DataObject* pLeaf = createDefaultObject();
305  StatusCode sc = registerObject( par_entry->identifier(), p_path, pLeaf );
306  if ( !sc.isSuccess() ) delete pLeaf;
307  p_entry = par_entry->findLeaf( p_path );
308  }
309  if ( !p_entry ) return INVALID_PARENT;
310  return registerAddress( p_entry, o_path, pAddress );
311  }
312  StatusCode status = par_entry->add( to_string( objPath ), pAddress );
313  return status.isSuccess() ? status : DOUBL_OBJ_PATH;
314 }
string to_string(const T &value)
Definition: mergesort.cpp:37
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
StatusCode registerAddress(boost::string_ref fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: TsDataSvc.cpp:259
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: TsDataSvc.h:86
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
T find(T...args)
virtual 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:1147
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
Gaudi::Property< bool > m_forceLeaves
Definition: TsDataSvc.h:72
const std::string & identifier() const override
Full identifier (or key)
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:76
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
Definition: TsDataSvc.cpp:369
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:71
StatusCode TsDataSvc::registerObject ( boost::string_ref  fullPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 369 of file TsDataSvc.cpp.

370 {
371  return registerObject( nullptr, fullPath, pObject );
372 }
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
Definition: TsDataSvc.cpp:369
StatusCode TsDataSvc::registerObject ( boost::string_ref  parentPath,
boost::string_ref  objPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 375 of file TsDataSvc.cpp.

376 {
377  DataObject* pO = nullptr;
378  StatusCode status = retrieveObject( parentPath, pO );
379  if ( !status.isSuccess() && m_forceLeaves ) {
380  pO = createDefaultObject();
381  status = registerObject( parentPath, pO );
382  if ( !status.isSuccess() ) pO->release();
383  }
384  return status.isSuccess() ? registerObject( pO, objPath, pObject ) : status;
385 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:733
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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:1147
Gaudi::Property< bool > m_forceLeaves
Definition: TsDataSvc.h:72
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
Definition: TsDataSvc.cpp:369
StatusCode TsDataSvc::registerObject ( boost::string_ref  parentPath,
int  item,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 388 of file TsDataSvc.cpp.

389 {
390  return registerObject( parentPath, itemToPath( item ), pObject );
391 }
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
Definition: TsDataSvc.cpp:369
StatusCode TsDataSvc::registerObject ( DataObject parentObj,
boost::string_ref  objPath,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 400 of file TsDataSvc.cpp.

401 {
402  if ( !checkRoot() ) return INVALID_ROOT;
403  if ( !parentObj ) {
404  if ( !objPath.empty() ) {
405  if ( objPath.front() != SEPARATOR ) {
406  return registerObject( m_rootName.value(), objPath, pObject );
407  }
408  auto sep = find( objPath, SEPARATOR, 1 );
409  if ( sep != boost::string_ref::npos ) {
410  return registerObject( objPath.substr( 0, sep ), objPath.substr( sep ), pObject );
411  }
412  }
413  return INVALID_OBJ_PATH;
414  }
415  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, parentObj->registry() );
416  if ( node_entry ) {
417  StatusCode status = INVALID_PARENT;
418  auto sep = find( objPath, SEPARATOR, 1 );
419  if ( sep != boost::string_ref::npos ) {
420  auto p_path = objPath.substr( 0, sep );
421  auto o_path = objPath.substr( sep );
422  RegEntry* par_entry = node_entry->findLeaf( p_path );
423  // Create default object leafs if the
424  // intermediate nodes are not present
425  if ( !par_entry && m_forceLeaves ) {
426  DataObject* pLeaf = createDefaultObject();
427  StatusCode sc = registerObject( parentObj, p_path, pLeaf );
428  if ( !sc.isSuccess() ) delete pLeaf;
429  par_entry = node_entry->findLeaf( p_path );
430  } else if ( par_entry && !par_entry->object() ) {
431  status = retrieveEntry( node_entry, p_path, par_entry );
432  if ( !status.isSuccess() && !par_entry->address() && m_forceLeaves ) {
433  DataObject* pLeaf = createDefaultObject();
434  StatusCode sc = registerObject( parentObj, p_path, pLeaf );
435  if ( !sc.isSuccess() ) delete pLeaf;
436  par_entry = node_entry->findLeaf( p_path );
437  }
438  }
439  node_entry = par_entry;
440  if ( node_entry ) {
441  DataObject* obj = node_entry->object();
442  if ( obj ) status = registerObject( obj, o_path, pObject );
443  }
444  } else {
445  RegEntry* leaf = node_entry->findLeaf( objPath );
446  if ( !leaf ) {
447  status = node_entry->add( to_string( objPath ), pObject );
448  } else {
449  DataObject* obj = leaf->object();
450  if ( !obj ) {
451  if ( !pObject ) {
452  error() << "registerObject: trying to register null DataObject" << endmsg;
453  return StatusCode::FAILURE;
454  } else {
455  pObject->setRegistry( leaf );
456  }
457  leaf->setAddress( nullptr );
458  leaf->setObject( pObject );
459  status = StatusCode::SUCCESS;
460  } else {
461  status = DOUBL_OBJ_PATH;
462  }
463  }
464  }
465  return status;
466  }
467  return INVALID_PARENT;
468 }
string to_string(const T &value)
Definition: mergesort.cpp:37
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
DataObject * object() const override
Retrive object behind the link.
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
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:26
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:651
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
T find(T...args)
virtual 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:1147
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
Gaudi::Property< bool > m_forceLeaves
Definition: TsDataSvc.h:72
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:76
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
Definition: TsDataSvc.cpp:369
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:71
StatusCode TsDataSvc::registerObject ( DataObject parentObj,
int  item,
DataObject pObject 
)
override

Register object with the data store.

Definition at line 394 of file TsDataSvc.cpp.

395 {
396  return registerObject( parentObj, itemToPath( item ), pObject );
397 }
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
Definition: TsDataSvc.cpp:369
StatusCode TsDataSvc::reinitialize ( )
override

Service initialization.

Service reinitialization.

Definition at line 1099 of file TsDataSvc.cpp.

1100 {
1101  StatusCode sc;
1102  // the finalize part is copied here
1103  setDataLoader( nullptr ).ignore();
1104  resetPreLoad().ignore();
1105  clearStore().ignore();
1106  if ( m_incidentSvc ) {
1108  m_incidentSvc = nullptr;
1109  }
1110  // re-initialize the base class
1111  sc = Service::reinitialize();
1112  if ( UNLIKELY( !sc.isSuccess() ) ) {
1113  error() << "Unable to reinitialize base class" << endmsg;
1114  return sc;
1115  }
1116  // the initialize part is copied here
1117  sc = service( "IncidentSvc", m_incidentSvc, true );
1118  if ( UNLIKELY( !sc.isSuccess() ) ) {
1119  error() << "Failed to access incident service." << endmsg;
1120  return sc;
1121  }
1122  // return
1123  return StatusCode::SUCCESS;
1124 }
#define UNLIKELY(x)
Definition: Kernel.h:128
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
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:207
StatusCode resetPreLoad() override
Clear the preload list.
Definition: TsDataSvc.cpp:1046
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
IIncidentSvc * m_incidentSvc
Pointer to incident service.
Definition: TsDataSvc.h:68
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode reinitialize() override
Definition: Service.cpp:250
virtual unsigned long release()=0
Release Interface instance.
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: Service.h:85
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:117
void ignore() const
Definition: StatusCode.h:84
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 1032 of file TsDataSvc.cpp.

1033 {
1034  auto i = std::remove( m_preLoads.begin(), m_preLoads.end(), item );
1035  m_preLoads.erase( i, m_preLoads.end() );
1036  return StatusCode::SUCCESS;
1037 }
T end(T...args)
T remove(T...args)
LoadItems m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:84
T erase(T...args)
T begin(T...args)
StatusCode TsDataSvc::removePreLoadItem ( std::string  itemPath)
override

Add an item to the preload list.

Definition at line 1040 of file TsDataSvc.cpp.

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

Clear the preload list.

Definition at line 1046 of file TsDataSvc.cpp.

1047 {
1048  m_preLoads.clear();
1049  return StatusCode::SUCCESS;
1050 }
LoadItems m_preLoads
Items to be pre-loaded.
Definition: TsDataSvc.h:84
T clear(T...args)
StatusCode TsDataSvc::retrieveEntry ( DataSvcHelpers::RegistryEntry pNode,
boost::string_ref  path,
DataSvcHelpers::RegistryEntry *&  pEntry 
)
protected

Retrieve registry entry from store.

Definition at line 651 of file TsDataSvc.cpp.

652 {
654  auto sep = find( path, SEPARATOR, 1 );
655  StatusCode status = StatusCode( INVALID_ROOT, true );
656  pEntry = nullptr;
657  // A.Valassi 16.08.2001 avoid core dump if store is empty
658  if ( checkRoot() ) {
659  if ( !parentObj ) {
660  if ( path.empty() || path == m_rootName ) return retrieveEntry( m_root, "", pEntry );
661  if ( path.front() != SEPARATOR ) return retrieveEntry( m_root, path, pEntry );
662  if ( sep == boost::string_ref::npos ) return INVALID_OBJ_PATH;
663  if ( !m_root->object() ) {
664  RegEntry* r = nullptr;
665  status = retrieveEntry( m_root, "", r );
666  if ( !status.isSuccess() ) return status;
667  }
668  return retrieveEntry( m_root, path.substr( sep ), pEntry );
669  }
670  if ( sep != boost::string_ref::npos ) { // the string contains a separator (after pos 0)
671  auto p_path = path.substr( 0, sep );
672  auto o_path = path.substr( sep );
673  if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
674  status = loadObject( parentObj );
675  if ( !status.isSuccess() ) return status;
676  }
677  RegEntry* root_entry = parentObj->findLeaf( p_path );
678  if ( !root_entry && m_enableFaultHdlr ) {
679  // If not even the parent is there, an incident
680  // to load the parent must be fired...
681  handleDataFault( parentObj, p_path );
682  root_entry = parentObj->findLeaf( p_path );
683  }
684  if ( root_entry ) {
685  DataObject* pO = root_entry->object();
686  if ( !pO ) {
687  // Object is not loaded: load the object if at all possible
688  status = loadObject( root_entry );
689  if ( !status.isSuccess() ) return status;
690  }
691  if ( root_entry->isSoft() ) {
692  root_entry = CAST_REGENTRY( RegEntry*, pO->registry() );
693  }
694  return retrieveEntry( root_entry, o_path, pEntry );
695  }
696  return status;
697  } else if ( path.empty() ) {
698  pEntry = parentObj;
699  } else {
700  if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
701  status = loadObject( parentObj );
702  if ( !status.isSuccess() ) return status;
703  }
704  // last leave in search: find leaf and load
705  pEntry = parentObj->findLeaf( path );
706  // If no registry entry was found, trigger incident for action-on-demand
707  if ( !pEntry && m_enableFaultHdlr ) {
708  handleDataFault( parentObj, path );
709  pEntry = ( path.empty() ? parentObj : parentObj->findLeaf( path ) );
710  }
711  }
712  // Check results and return
713  if ( !pEntry ) {
714  status = INVALID_OBJ_PATH;
715  } else if ( !pEntry->object() ) {
716  status = loadObject( pEntry );
717  } else if ( m_enableAccessHdlr ) {
718  // Fire data access incident
719  // I do not know if this is a good idea....
720  // This fires too often!
721  //
722  // DataIncident incident(name(), m_accessName, pEntry->identifier());
723  // m_incidentSvc->fireIncident(incident);
724  status = SUCCESS;
725  } else {
726  status = SUCCESS;
727  }
728  }
729  return status;
730 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
DataObject * object() const override
Retrive object behind the link.
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
virtual bool isSoft() const
Is the link soft or hard.
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: TsDataSvc.h:86
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::Property< bool > m_enableAccessHdlr
Definition: TsDataSvc.h:79
StatusCode retrieveEntry(DataSvcHelpers::RegistryEntry *pNode, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Retrieve registry entry from store.
Definition: TsDataSvc.cpp:651
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
T find(T...args)
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
DataObject * handleDataFault(IRegistry *pReg, boost::string_ref path={})
Invoke data fault handling if enabled.
Definition: TsDataSvc.cpp:541
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:46
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:76
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: TsDataSvc.cpp:572
Gaudi::Property< bool > m_enableFaultHdlr
Definition: TsDataSvc.h:75
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:71
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 733 of file TsDataSvc.cpp.

734 {
736  pObject = nullptr;
737  RegEntry *result = nullptr, *parent = CAST_REGENTRY( RegEntry *, pRegistry );
738  StatusCode status = retrieveEntry( parent, path, result );
739  if ( status.isSuccess() ) pObject = result->object();
740  return status;
741 }
DataObject * object() const override
Retrive object behind the link.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode retrieveEntry(DataSvcHelpers::RegistryEntry *pNode, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Retrieve registry entry from store.
Definition: TsDataSvc.cpp:651
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:46
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:76
StatusCode TsDataSvc::retrieveObject ( boost::string_ref  fullPath,
DataObject *&  pObject 
)
override

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

Definition at line 744 of file TsDataSvc.cpp.

745 {
746  IRegistry* nullDir = nullptr;
747  return retrieveObject( nullDir, fullPath, pObject );
748 }
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:733
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode TsDataSvc::retrieveObject ( boost::string_ref  parentPath,
boost::string_ref  objPath,
DataObject *&  pObject 
)
override

Retrieve object from data store.

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

Definition at line 751 of file TsDataSvc.cpp.

752 {
753  DataObject* parent = nullptr;
754  StatusCode status = retrieveObject( parentPath, parent );
755  return status.isSuccess() ? retrieveObject( parent, objectPath, pObject ) : status;
756 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:733
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode TsDataSvc::retrieveObject ( boost::string_ref  parentPath,
int  item,
DataObject *&  pObject 
)
override

Retrieve object from data store.

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

Definition at line 759 of file TsDataSvc.cpp.

760 {
761  return retrieveObject( parentPath, itemToPath( item ), pObject );
762 }
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:733
StatusCode TsDataSvc::retrieveObject ( DataObject parentObj,
boost::string_ref  objPath,
DataObject *&  pObject 
)
override

Retrieve object from data store.

Definition at line 765 of file TsDataSvc.cpp.

766 {
767  IRegistry* pRegistry = ( parentObj ? parentObj->registry() : nullptr );
768  return retrieveObject( pRegistry, path, pObject );
769 }
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:733
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode TsDataSvc::retrieveObject ( DataObject parentObj,
int  item,
DataObject *&  pObject 
)
override

Retrieve object from data store.

Retrieve registry entry from store.

Definition at line 772 of file TsDataSvc.cpp.

773 {
774  return retrieveObject( parentObj, itemToPath( item ), pObject );
775 }
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: TsDataSvc.cpp:733
CLID TsDataSvc::rootCLID ( ) const
override

IDataManagerSvc: Accessor for root event CLID.

CLID for root Event.

Definition at line 1141 of file TsDataSvc.cpp.

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

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

208 {
209  if ( pDataLoader ) pDataLoader->addRef();
211  if ( pDataLoader ) {
212  pDataLoader->setDataProvider( dpsvc == nullptr ? this : dpsvc ).ignore();
213  }
214  m_dataLoader = pDataLoader;
215  return SUCCESS;
216 }
IConversionSvc * m_dataLoader
Pointer to data loader service.
Definition: TsDataSvc.h:66
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 158 of file TsDataSvc.cpp.

159 {
160  clearStore().ignore();
161  return i_setRoot( std::move( root_path ), pRootObj );
162 }
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:169
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:117
void ignore() const
Definition: StatusCode.h:84
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 184 of file TsDataSvc.cpp.

185 {
186  clearStore().ignore();
187  return i_setRoot( std::move( root_path ), pRootAddr );
188 }
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:169
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: TsDataSvc.cpp:117
void ignore() const
Definition: StatusCode.h:84
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 128 of file TsDataSvc.cpp.

129 {
131  DataObject* pO = nullptr;
132  StatusCode status = findObject( sub_tree_path, pO );
133  return status.isSuccess() ? traverseSubTree( pO, pAgent ) : status;
134 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: TsDataSvc.cpp:793
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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:128
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:46
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 137 of file TsDataSvc.cpp.

138 {
140  if ( !checkRoot() ) return INVALID_ROOT;
141  RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
142  if ( !entry ) return INVALID_OBJECT;
143  return entry->traverseTree( pAgent );
144 }
virtual 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:36
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:46
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:76
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 147 of file TsDataSvc.cpp.

148 {
150  if ( !checkRoot() ) return INVALID_ROOT;
151  return m_root->traverseTree( pAgent );
152 }
virtual StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: TsDataSvc.h:86
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:46
StatusCode TsDataSvc::unlinkObject ( IRegistry from,
boost::string_ref  objPath 
)
override

Remove a link to another object.

Definition at line 970 of file TsDataSvc.cpp.

971 {
973  if ( !checkRoot() ) return INVALID_ROOT;
974  try {
975  RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
976  if ( from_entry ) {
977  auto sep = objPath.rfind( SEPARATOR );
978  if ( sep > 0 && sep != boost::string_ref::npos ) { // in case the objPath is a sub-directory itself
979  DataObject* pO = nullptr;
980  StatusCode sc = findObject( from, objPath.substr( 0, sep ), pO );
981  return sc.isSuccess() ? unlinkObject( pO->registry(), objPath.substr( sep ) ) : sc;
982  }
983  StatusCode status = from_entry->remove( objPath );
984  return status.isSuccess() ? status : INVALID_OBJ_PATH;
985  }
986  } catch ( ... ) {
987  }
988  return INVALID_PARENT;
989 }
constexpr char SEPARATOR
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
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:793
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: TsDataSvc.cpp:970
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
virtual 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:46
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:76
StatusCode TsDataSvc::unlinkObject ( boost::string_ref  fromPath,
boost::string_ref  objPath 
)
override

Remove a link to another object.

Definition at line 1003 of file TsDataSvc.cpp.

1004 {
1005  DataObject* pObject = nullptr;
1006  StatusCode status = findObject( from, pObject );
1007  return status.isSuccess() ? unlinkObject( pObject->registry(), objPath ) : status;
1008 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
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:793
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: TsDataSvc.cpp:970
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode TsDataSvc::unlinkObject ( DataObject fromObj,
boost::string_ref  objPath 
)
override

Remove a link to another object.

Definition at line 1011 of file TsDataSvc.cpp.

1012 {
1013  if ( !checkRoot() ) return INVALID_ROOT;
1014  return unlinkObject( m_root->findLeaf( from ), objPath );
1015 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: TsDataSvc.h:86
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: TsDataSvc.cpp:970
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
StatusCode TsDataSvc::unlinkObject ( boost::string_ref  fullPath)
override

Remove a link to another object.

Definition at line 992 of file TsDataSvc.cpp.

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

IDataManagerSvc: Unregister object address from the data store.

Definition at line 317 of file TsDataSvc.cpp.

318 {
319  if ( fullPath.empty() ) return INVALID_OBJ_PATH;
320  IRegistry* pRegistry = nullptr;
321  if ( fullPath.front() != SEPARATOR ) {
322  return unregisterAddress( m_root, fullPath );
323  }
324  return unregisterAddress( pRegistry, fullPath );
325 }
constexpr char SEPARATOR
StatusCode unregisterAddress(boost::string_ref fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: TsDataSvc.cpp:317
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: TsDataSvc.h:86
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode TsDataSvc::unregisterAddress ( DataObject pParent,
boost::string_ref  objPath 
)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 328 of file TsDataSvc.cpp.

329 {
330  IRegistry* pRegistry = ( pParent ? pParent->registry() : nullptr );
331  return unregisterAddress( pRegistry, objPath );
332 }
StatusCode unregisterAddress(boost::string_ref fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: TsDataSvc.cpp:317
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
StatusCode TsDataSvc::unregisterAddress ( IRegistry pParent,
boost::string_ref  objPath 
)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 335 of file TsDataSvc.cpp.

336 {
337  if ( !checkRoot() ) return INVALID_ROOT;
338 
339  if ( objPath.empty() ) return INVALID_OBJ_PATH;
340  if ( !pParent ) {
341  if ( objPath.front() != SEPARATOR ) {
342  return unregisterAddress( m_root, objPath );
343  }
344  auto sep = find( objPath, SEPARATOR, 1 );
345  if ( sep == boost::string_ref::npos || objPath.substr( 0, sep ) != m_rootName.value() ) {
346  return INVALID_PARENT;
347  }
348  return unregisterAddress( m_root, objPath.substr( sep ) );
349  }
350  if ( objPath.front() != SEPARATOR ) {
351  return unregisterAddress( pParent, SEPARATOR + objPath );
352  }
353  RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pParent );
354  if ( node_entry ) {
355  RegEntry* leaf_entry = node_entry->findLeaf( objPath );
356  if ( leaf_entry ) {
357  auto sep = objPath.rfind( SEPARATOR );
358  if ( sep > 0 && sep != boost::string_ref::npos ) {
359  return unregisterAddress( leaf_entry->parent(), objPath.substr( sep ) );
360  }
361  StatusCode status = node_entry->remove( objPath );
362  if ( status.isSuccess() ) return status;
363  }
364  }
365  return INVALID_PARENT;
366 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
constexpr char SEPARATOR
StatusCode unregisterAddress(boost::string_ref fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: TsDataSvc.cpp:317
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: TsDataSvc.h:86
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
T find(T...args)
virtual IRegistry * parent() const
Pointer to parent directory entry.
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
virtual StatusCode remove(boost::string_ref name)
Remove an entry from the store.
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:76
Gaudi::Property< std::string > m_rootName
Definition: TsDataSvc.h:71
StatusCode TsDataSvc::unregisterObject ( boost::string_ref  fullPath)
override

Unregister object from the data store.

Definition at line 471 of file TsDataSvc.cpp.

472 {
473  DataObject* pObject = nullptr;
474  StatusCode status = findObject( fullPath, pObject );
475  if ( status.isFailure() ) return status;
476  RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pObject->registry() );
477  if ( !pEntry ) return INVALID_ROOT;
478  if ( !pEntry->isEmpty() ) return DIR_NOT_EMPTY;
479  RegEntry* pParent = pEntry->parentEntry();
480  if ( !pParent ) return INVALID_PARENT;
481  if ( pObject ) pObject->addRef();
482  pParent->remove( pEntry );
483  return StatusCode::SUCCESS;
484 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:92
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:793
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual bool isEmpty() const
Simple check if the Container is empty.
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
virtual 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:76
StatusCode TsDataSvc::unregisterObject ( boost::string_ref  parentPath,
boost::string_ref  objectPath 
)
override

Unregister object from the data store.

Definition at line 487 of file TsDataSvc.cpp.

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

Unregister object from the data store.

Definition at line 495 of file TsDataSvc.cpp.

496 {
497  return unregisterObject( parentPath, itemToPath( item ) );
498 }
StatusCode unregisterObject(boost::string_ref fullPath) override
Unregister object from the data store.
Definition: TsDataSvc.cpp:471
StatusCode TsDataSvc::unregisterObject ( DataObject pObject)
override

Unregister object from the data store.

Definition at line 501 of file TsDataSvc.cpp.

502 {
503  if ( !checkRoot() ) return INVALID_ROOT;
504  RegEntry* entry = m_root->findLeaf( pObject );
505  if ( !entry ) return INVALID_OBJECT;
506  RegEntry* parent = entry->parentEntry();
507  if ( !parent ) return INVALID_PARENT;
508  if ( !entry->isEmpty() ) return DIR_NOT_EMPTY;
509  if ( entry->object() ) entry->object()->addRef();
510  if ( parent ) parent->remove( entry );
511  return SUCCESS;
512 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
DataObject * object() const override
Retrive object behind the link.
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:92
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:59
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: TsDataSvc.h:86
virtual bool isEmpty() const
Simple check if the Container is empty.
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
virtual StatusCode remove(boost::string_ref name)
Remove an entry from the store.
StatusCode TsDataSvc::unregisterObject ( DataObject pObject,
boost::string_ref  objectPath 
)
override

Unregister object from the data store.

Definition at line 515 of file TsDataSvc.cpp.

516 {
517  if ( !checkRoot() ) return INVALID_ROOT;
518  try {
519  RegEntry* parent = CAST_REGENTRY( RegEntry*, pParentObj->registry() );
520  if ( parent ) {
521  RegEntry* entry = parent->findLeaf( objectPath );
522  if ( !entry ) return INVALID_OBJECT;
523  if ( !entry->isEmpty() ) return DIR_NOT_EMPTY;
524  if ( entry->object() ) entry->object()->addRef();
525  parent->remove( entry );
526  return SUCCESS;
527  }
528  } catch ( ... ) {
529  }
530  return INVALID_PARENT;
531 }
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
DataObject * object() const override
Retrive object behind the link.
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:59
virtual bool isEmpty() const
Simple check if the Container is empty.
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
bool checkRoot()
Check if root path is valid.
Definition: TsDataSvc.h:335
virtual StatusCode remove(boost::string_ref name)
Remove an entry from the store.
#define CAST_REGENTRY(x, y)
Definition: TsDataSvc.cpp:76
StatusCode TsDataSvc::unregisterObject ( DataObject pObject,
int  item 
)
override

Unregister object from the data store.

Definition at line 534 of file TsDataSvc.cpp.

535 {
536  return unregisterObject( pParentObj, itemToPath( item ) );
537 }
StatusCode unregisterObject(boost::string_ref fullPath) override
Unregister object from the data store.
Definition: TsDataSvc.cpp:471
StatusCode TsDataSvc::updateObject ( IRegistry pDirectory)
override

Update object identified by its directory entry.

Update object.

Definition at line 843 of file TsDataSvc.cpp.

844 {
845  if ( !pRegistry ) { // Precondition:
846  return INVALID_OBJ_ADDR; // Addres must be valid
847  }
848  DataObject* toUpdate = pRegistry->object();
849  if ( !toUpdate ) { // Try first to load
850  return loadObject( pRegistry );
851  }
852  return updateObject( toUpdate );
853 }
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: TsDataSvc.cpp:843
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:572
StatusCode TsDataSvc::updateObject ( boost::string_ref  updatePath)
override

Update object.

Definition at line 835 of file TsDataSvc.cpp.

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

Update object.

Definition at line 856 of file TsDataSvc.cpp.

857 {
859  StatusCode status = INVALID_OBJ_ADDR;
860  if ( !toUpdate ) { // Precondition:
861  return INVALID_OBJECT; // Address must be valid
862  }
863  IRegistry* pRegistry = toUpdate->registry(); // Precondition:
864  if ( !pRegistry ) { // Need valid registry
865  return INVALID_OBJECT;
866  }
867  IOpaqueAddress* pAddress = pRegistry->address(); // Precondition:
868  if ( !pAddress ) { // Need valid address
869  return INVALID_OBJ_ADDR;
870  }
871  IConversionSvc* pLoader = getDataLoader( pRegistry );
872  if ( !pLoader ) { // Precondition:
873  return NO_DATA_LOADER; // Data loader must be present
874  }
875  if ( !m_inhibitPathes.empty() ) {
876  auto& ident = pRegistry->identifier();
877  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), ident );
878  if ( inhibit != m_inhibitPathes.end() ) return NO_ACCESS;
879  }
880  try {
881  status = pLoader->updateObj( pAddress, toUpdate ); // Call data loader
882  if ( status.isSuccess() ) {
883  status = pLoader->updateObjRefs( pAddress, toUpdate );
884  }
885  } catch ( const GaudiException& exc ) {
886  throw GaudiException( "GaudiException in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE, exc );
887  } catch ( const std::exception& x ) {
888  throw GaudiException( "std::exception in updateObject() " + pRegistry->name() + ": " +
889  System::typeinfoName( typeid( x ) ) + ", " + x.what(),
891  } catch ( ... ) {
892  throw GaudiException( "UNKN exception in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE );
893  }
894  return status;
895 }
Define general base for Gaudi exception.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:336
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:1152
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
virtual const id_type & identifier() const =0
Full identifier (or key)
T what(T...args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
STL class.
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:73
#define STD_LOCK_GUARD_MACRO
Definition: TsDataSvc.cpp:46
StatusCode TsDataSvc::updateObject ( boost::string_ref  parentPath,
boost::string_ref  updatePath 
)
override

Update object.

Definition at line 898 of file TsDataSvc.cpp.

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

Update object.

Definition at line 906 of file TsDataSvc.cpp.

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

Member Data Documentation

tsDataSvcMutex TsDataSvc::m_accessMutex
protected

Mutex to protect access to the store.

Definition at line 367 of file TsDataSvc.h.

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

Definition at line 81 of file TsDataSvc.h.

IConversionSvc* TsDataSvc::m_dataLoader = nullptr
protected

Pointer to data loader service.

Definition at line 66 of file TsDataSvc.h.

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

Definition at line 79 of file TsDataSvc.h.

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

Definition at line 75 of file TsDataSvc.h.

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

Definition at line 77 of file TsDataSvc.h.

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

Definition at line 72 of file TsDataSvc.h.

IIncidentSvc* TsDataSvc::m_incidentSvc = nullptr
protected

Pointer to incident service.

Definition at line 68 of file TsDataSvc.h.

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

Map with object paths to be inhibited from loading.

Definition at line 88 of file TsDataSvc.h.

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

Definition at line 73 of file TsDataSvc.h.

LoadItems TsDataSvc::m_preLoads
protected

Items to be pre-loaded.

Definition at line 84 of file TsDataSvc.h.

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

Pointer to root entry.

Definition at line 86 of file TsDataSvc.h.

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

Definition at line 70 of file TsDataSvc.h.

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

Definition at line 71 of file TsDataSvc.h.


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