The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
TsDataSvc Class Reference

Data service base class. More...

#include <GaudiKernel/TsDataSvc.h>

Inheritance diagram for TsDataSvc:
Collaboration diagram for TsDataSvc:

Public Member Functions

CLID rootCLID () const override
 IDataManagerSvc: Accessor for root event CLID.
 
const std::string & rootName () const override
 IDataManagerSvc: Accessor for root event name.
 
StatusCode registerAddress (std::string_view fullPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store.
 
StatusCode registerAddress (IRegistry *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress) override
 IDataManagerSvc: Register object address with the data store.
 
StatusCode unregisterAddress (std::string_view fullPath) override
 IDataManagerSvc: Unregister object address from the data store.
 
StatusCode unregisterAddress (IRegistry *pParent, std::string_view objPath) override
 IDataManagerSvc: Unregister object address from the data store.
 
StatusCode objectLeaves (const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
 
StatusCode objectLeaves (const IRegistry *pRegistry, std::vector< IRegistry * > &refLeaves) override
 IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
 
StatusCode objectParent (const DataObject *pObject, IRegistry *&refpParent) override
 IDataManagerSvc: Explore the object store: retrieve the object's parent.
 
StatusCode objectParent (const IRegistry *pRegistry, IRegistry *&refpParent) override
 IDataManagerSvc: Explore the object store: retrieve the object's parent.
 
StatusCode clearSubTree (std::string_view sub_tree_path) override
 IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name.
 
StatusCode clearSubTree (DataObject *pObject) override
 IDataManagerSvc: Remove all data objects below the sub tree identified by the object.
 
StatusCode clearStore () override
 IDataManagerSvc: Remove all data objects in the data store.
 
StatusCode traverseSubTree (std::string_view sub_tree_path, IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full path name.
 
StatusCode traverseSubTree (DataObject *pObject, IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects below the sub tree.
 
StatusCode traverseTree (IDataStoreAgent *pAgent) override
 IDataManagerSvc: Analyze by traversing all data objects in the data store.
 
StatusCode setRoot (std::string root_name, DataObject *pRootObj) override
 Initialize data store for new event by giving new event path and root object.
 
virtual StatusCode i_setRoot (std::string root_name, DataObject *pRootObj)
 Initialize data store for new event by giving new event path and root object.
 
StatusCode i_setRoot (DataObject *pRootObj)
 
StatusCode setRoot (std::string root_path, IOpaqueAddress *pRootAddr) override
 Initialize data store for new event by giving new event path and address of root object.
 
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.
 
StatusCode i_setRoot (IOpaqueAddress *pRootAddr)
 
StatusCode setDataLoader (IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
 IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data provider.
 
StatusCode addPreLoadItem (const DataStoreItem &item) override
 Add an item to the preload list.
 
StatusCode removePreLoadItem (const DataStoreItem &item) override
 Remove an item from the preload list.
 
StatusCode resetPreLoad () override
 Clear the preload list.
 
virtual StatusCode preLoad (int depth, int load_depth, DataObject *pObject)
 Execute one level of preloading and recursively load until the final level is reached.
 
StatusCode preLoad () override
 load all preload items of the list
 
StatusCode registerObject (std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
 Register object with the data store.
 
StatusCode registerObject (DataObject *parentObj, std::string_view objPath, DataObject *pObject) override
 Register object with the data store.
 
StatusCode unregisterObject (std::string_view fullPath) override
 Unregister object from the data store.
 
StatusCode unregisterObject (DataObject *pObject) override
 Unregister object from the data store.
 
StatusCode unregisterObject (DataObject *pObject, std::string_view objectPath) override
 Unregister object from the data store.
 
StatusCode retrieveObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
 Retrieve object from data store.
 
StatusCode findObject (std::string_view fullPath, DataObject *&pObject) override
 Find object identified by its full path in the data store.
 
StatusCode findObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
 Find object identified by its full path in the data store.
 
StatusCode linkObject (IRegistry *from, std::string_view objPath, DataObject *to) override
 Add a link to another object.
 
StatusCode linkObject (std::string_view fullPath, DataObject *to) override
 Add a link to another object.
 
StatusCode unlinkObject (IRegistry *from, std::string_view objPath) override
 Remove a link to another object.
 
StatusCode unlinkObject (DataObject *fromObj, std::string_view objPath) override
 Remove a link to another object.
 
StatusCode unlinkObject (std::string_view fullPath) override
 Remove a link to another object.
 
StatusCode updateObject (IRegistry *pDirectory) override
 Update object identified by its directory entry.
 
StatusCode updateObject (DataObject *toUpdate) override
 Update object.
 
StatusCode initialize () override
 Service initialization.
 
StatusCode reinitialize () override
 Service initialization.
 
StatusCode finalize () override
 Service initialization.
 
 TsDataSvc (const std::string &name, ISvcLocator *svc)
 constructor
 
 TsDataSvc (const TsDataSvc &)=delete
 no copy constructor
 
TsDataSvcoperator= (const TsDataSvc &)=delete
 no assignment operator
 
StatusCode registerAddress (DataObject *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress)
 Register object address with the data store.
 
StatusCode unregisterAddress (DataObject *pParent, std::string_view objPath)
 Unregister object address from the data store.
 
StatusCode registerObject (std::string_view fullPath, DataObject *pObject)
 Register object with the data store.
 
StatusCode registerObject (std::string_view parentPath, int item, DataObject *pObject)
 Register object with the data store.
 
StatusCode registerObject (DataObject *parentObj, int item, DataObject *pObject)
 Register object with the data store.
 
StatusCode retrieveObject (std::string_view fullPath, DataObject *&pObject)
 Retrieve object identified by its full path from the data store.
 
StatusCode retrieveObject (std::string_view parentPath, std::string_view objectPath, DataObject *&pObject)
 Retrieve object from data store.
 
StatusCode retrieveObject (std::string_view parentPath, int item, DataObject *&pObject)
 Retrieve object from data store.
 
StatusCode retrieveObject (DataObject *parentObj, std::string_view objectPath, DataObject *&pObject)
 Retrieve object from data store.
 
StatusCode retrieveObject (DataObject *parentObj, int item, DataObject *&pObject)
 Retrieve object from data store.
 
StatusCode findObject (std::string_view parentPath, std::string_view objectPath, DataObject *&pObject)
 Find object identified by its parent object and the path to the object relative to the parent.
 
StatusCode findObject (std::string_view parentPath, int item, DataObject *&pObject)
 Find object identified by its parent object and an integer identifier in the data store.
 
StatusCode findObject (DataObject *parentObj, std::string_view objectPath, DataObject *&pObject)
 Find object identified by its parent object and the path to the object relative to the parent.
 
StatusCode findObject (DataObject *parentObj, int item, DataObject *&pObject)
 Find object identified by its parent object and an integer identifier in the data store.
 
StatusCode linkObject (std::string_view fromPath, std::string_view objPath, DataObject *toObj)
 Add a link to another object.
 
StatusCode linkObject (DataObject *fromObj, std::string_view objPath, DataObject *toObj)
 Add a link to another object.
 
StatusCode unlinkObject (std::string_view fromPath, std::string_view objPath)
 Remove a link to another object.
 
- Public Member Functions inherited from extends< Service, IDataProviderSvc, IDataManagerSvc >
void const * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast.
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface.
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames.
 
- Public Member Functions inherited from Service
const std::string & name () const override
 Retrieve name of the service.
 
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.
 
StatusCode sysStart () override
 Initialize Service.
 
StatusCode sysStop () override
 Initialize Service.
 
StatusCode sysFinalize () override
 Finalize Service.
 
StatusCode sysReinitialize () override
 Re-initialize the Service.
 
StatusCode sysRestart () override
 Re-initialize the Service.
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor.
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator.
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
 
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, const std::string &toolTypeAndName, bool createIf=true)
 Declare used tool.
 
template<class T>
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
template<class T>
void addToolsArray (ToolHandleArray< T > &hndlArr)
 
const std::vector< IAlgTool * > & tools () const
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property.
 
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.
 
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.
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property.
 
StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p) override
 set the property from another property with a different name
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property
 
const Gaudi::Details::PropertyBasegetProperty (std::string_view name) const override
 get the property by name
 
StatusCode getProperty (std::string_view n, std::string &v) const override
 convert the property to the string
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties
 
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name.
 
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected
 
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream)
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor.
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream.
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS)
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL)
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING)
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO)
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG)
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO)
 

Protected Member Functions

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

Protected Attributes

tsDataSvcMutex m_accessMutex
 Mutex to protect access to the store.
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state.
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state.
 
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools
 
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()" }
 
Gaudi::Property< bool > m_autoRetrieveTools
 
Gaudi::Property< bool > m_checkToolDeps
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service.
 

Private Attributes

IConversionSvcm_dataLoader = nullptr
 Pointer to data loader service.
 
ServiceHandle< IIncidentSvcm_incidentSvc
 Handle to incident service.
 
Gaudi::Property< CLIDm_rootCLID { this, "RootCLID", 110 , "CLID of root entry" }
 
Gaudi::Property< std::string > m_rootName { this, "RootName", "/Event", "name of root entry" }
 
Gaudi::Property< bool > m_forceLeaves
 
Gaudi::Property< std::vector< std::string > > m_inhibitPathes { this, "InhibitPaths", {}, "inhibited leaves" }
 
Gaudi::Property< bool > m_enableFaultHdlr
 
Gaudi::Property< std::string > m_faultName { this, "DataFaultName", "DataFault", "Name of the data fault incident" }
 
Gaudi::Property< bool > m_enableAccessHdlr
 
Gaudi::Property< std::string > m_accessName { this, "DataAccessName", "DataAccess", "Name of the data access incident" }
 
std::vector< DataStoreItemm_preLoads
 Items to be pre-loaded.
 
std::unique_ptr< DataSvcHelpers::RegistryEntrym_root
 Pointer to root entry.
 

Additional Inherited Members

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

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 53 of file TsDataSvc.h.

Constructor & Destructor Documentation

◆ TsDataSvc() [1/2]

TsDataSvc::TsDataSvc ( const std::string & name,
ISvcLocator * svc )

constructor

Definition at line 57 of file TsDataSvc.cpp.

58 : base_class( name, svc ), m_incidentSvc( "IncidentSvc", name ) {}
const std::string & name() const override
Retrieve name of the service.
Definition Service.cpp:333
ServiceHandle< IIncidentSvc > m_incidentSvc
Handle to incident service.
Definition TsDataSvc.h:58

◆ TsDataSvc() [2/2]

TsDataSvc::TsDataSvc ( const TsDataSvc & )
delete

no copy constructor

Member Function Documentation

◆ addPreLoadItem()

StatusCode TsDataSvc::addPreLoadItem ( const DataStoreItem & item)
override

Add an item to the preload list.

Definition at line 741 of file TsDataSvc.cpp.

741 {
742 auto i = std::find( m_preLoads.begin(), m_preLoads.end(), item );
743 if ( i == m_preLoads.end() ) m_preLoads.push_back( item );
744 return StatusCode::SUCCESS;
745}
constexpr static const auto SUCCESS
Definition StatusCode.h:99
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
Definition TsDataSvc.h:75

◆ checkRoot()

bool TsDataSvc::checkRoot ( )
inlineprotected

Check if root path is valid.

Definition at line 260 of file TsDataSvc.h.

260{ return 0 != m_root; }
std::unique_ptr< DataSvcHelpers::RegistryEntry > m_root
Pointer to root entry.
Definition TsDataSvc.h:77

◆ clearStore()

StatusCode TsDataSvc::clearStore ( )
override

IDataManagerSvc: Remove all data objects in the data store.

Definition at line 89 of file TsDataSvc.cpp.

89 {
90 if ( !checkRoot() ) return Status::INVALID_ROOT;
91 m_root.reset();
93}
bool checkRoot()
Check if root path is valid.
Definition TsDataSvc.h:260

◆ clearSubTree() [1/2]

StatusCode TsDataSvc::clearSubTree ( DataObject * pObject)
override

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

Definition at line 78 of file TsDataSvc.cpp.

78 {
79 if ( !checkRoot() ) return Status::INVALID_ROOT;
80 RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
81 if ( !entry ) return Status::INVALID_OBJECT;
82 RegEntry* parent = entry->parentEntry();
83 if ( !parent ) return Status::INVALID_PARENT;
84 parent->remove( entry );
86}
DataSvcHelpers::RegistryEntry RegEntry
Definition DataSvc.cpp:48
#define CAST_REGENTRY(x, y)
Definition DataSvc.cpp:46
IRegistry * registry() const
Get pointer to Registry.
Definition DataObject.h:79
RegistryEntry * parentEntry()
Pointer to parent registry entry.
StatusCode remove(std::string_view name)
Remove an entry from the store.

◆ clearSubTree() [2/2]

StatusCode TsDataSvc::clearSubTree ( std::string_view sub_tree_path)
override

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

Definition at line 63 of file TsDataSvc.cpp.

63 {
64 DataObject* pObject = nullptr;
65 StatusCode status = findObject( sub_tree_path, pObject );
66 if ( !status.isSuccess() ) return status;
67 RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
68 if ( !node_entry ) return Status::INVALID_OBJECT;
69 RegEntry* parent = node_entry->parentEntry();
70 if ( !parent ) return Status::INVALID_PARENT;
71 parent->remove( node_entry );
73}
bool isSuccess() const
Definition StatusCode.h:314
StatusCode findObject(std::string_view fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.

◆ createDefaultObject()

DataObject * TsDataSvc::createDefaultObject ( ) const
protectedvirtual

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

Definition at line 836 of file TsDataSvc.cpp.

836{ return new DataObject(); }

◆ finalize()

StatusCode TsDataSvc::finalize ( )
override

Service initialization.

Service initialisation.

Definition at line 821 of file TsDataSvc.cpp.

821 {
822 // Nothing to do: just call base class initialisation
823 setDataLoader( nullptr ).ignore();
825 clearStore().ignore();
826 return Service::finalize();
827}
StatusCode finalize() override
Definition Service.cpp:223
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition StatusCode.h:139
StatusCode resetPreLoad() override
Clear the preload list.
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition TsDataSvc.cpp:89
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data pro...

◆ findObject() [1/6]

StatusCode IDataProviderSvc::findObject ( DataObject * parentObj,
int item,
DataObject *& pObject )
inline

Find object identified by its parent object and an integer identifier in the data store.

In case the object is not present the pointer will be set to NULL.

Parameters
parentObjPointer to parent node of the object.
itemItem identifier.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 368 of file IDataProviderSvc.h.

368 {
369 return findObject( parentObj, itemToPath( item ), pObject );
370 }

◆ findObject() [2/6]

StatusCode IDataProviderSvc::findObject ( DataObject * parentObj,
std::string_view objectPath,
DataObject *& pObject )
inline

Find object identified by its parent object and the path to the object relative to the parent.

The result will be returned in the second argument. In case the object is not present the pointer will be set to NULL.

Parameters
parentObjPointer to parent node of the object.
objectPathRelative path name of the object.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 356 of file IDataProviderSvc.h.

356 {
357 return findObject( parentObj ? parentObj->registry() : nullptr, objectPath, pObject );
358 }

◆ findObject() [3/6]

StatusCode TsDataSvc::findObject ( IRegistry * pDirectory,
std::string_view 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 608 of file TsDataSvc.cpp.

608 {
610 pObject = nullptr;
611 IRegistry* pReg = ( pRegistry ? pRegistry : m_root.get() );
612 RegEntry* root_entry = CAST_REGENTRY( RegEntry*, pReg );
613 if ( root_entry ) {
614 if ( !path.empty() ) pReg = root_entry->find( path );
615 if ( !pReg ) return Status::INVALID_OBJ_PATH;
616 pObject = pReg->object();
617 }
618 return pObject ? Status::IDataProviderSvc_NO_ERROR : Status::OBJ_NOT_LOADED;
619}
#define STD_LOCK_GUARD_MACRO
Definition TsDataSvc.cpp:25
IRegistry * find(const IRegistry *obj) const
Try to find an object identified by its pointer.
virtual DataObject * object() const =0
Retrieve object behind the link.
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram

◆ findObject() [4/6]

StatusCode TsDataSvc::findObject ( std::string_view fullPath,
DataObject *& pObject )
override

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

Definition at line 622 of file TsDataSvc.cpp.

622 {
623 pObject = nullptr;
625 if ( !checkRoot() ) return Status::INVALID_ROOT;
626 if ( path.empty() || path == m_rootName ) {
627 pObject = m_root->object();
628 return !pObject ? Status::OBJ_NOT_LOADED : Status::IDataProviderSvc_NO_ERROR;
629 }
630 return findObject( path.front() != SEPARATOR ? m_root.get() : nullptr, path, pObject );
631}
Gaudi::Property< std::string > m_rootName
Definition TsDataSvc.h:61

◆ findObject() [5/6]

StatusCode IDataProviderSvc::findObject ( std::string_view parentPath,
int item,
DataObject *& pObject )
inline

Find object identified by its parent object and an integer identifier in the data store.

In case the object is not present the pointer will be set to NULL.

Parameters
parentPathPath to parent node of the object.
itemItem identifier.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 343 of file IDataProviderSvc.h.

343 {
344 return findObject( parentPath, itemToPath( item ), pObject );
345 }

◆ findObject() [6/6]

StatusCode IDataProviderSvc::findObject ( std::string_view parentPath,
std::string_view objectPath,
DataObject *& pObject )
inline

Find object identified by its parent object and the path to the object relative to the parent.

The result will be returned in the second argument. In case the object is not present the pointer will be set to NULL.

Parameters
parentPathPath to parent node of the object.
objectPathRelative path name of the object.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 329 of file IDataProviderSvc.h.

329 {
330 DataObject* parent = nullptr;
331 StatusCode status = findObject( parentPath, parent );
332 return status.isSuccess() ? findObject( parent, objectPath, pObject ) : status;
333 }

◆ getDataLoader()

IConversionSvc * TsDataSvc::getDataLoader ( IRegistry * pReg)
protectedvirtual

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

Definition at line 841 of file TsDataSvc.cpp.

841{ return m_dataLoader; }
IConversionSvc * m_dataLoader
Pointer to data loader service.
Definition TsDataSvc.h:56

◆ handleDataFault()

DataObject * TsDataSvc::handleDataFault ( IRegistry * pReg,
std::string_view 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 414 of file TsDataSvc.cpp.

414 {
415 if ( m_enableFaultHdlr ) {
416 IRegistry* pLeaf = nullptr;
417 if ( pReg && path.empty() ) {
418 DataIncident incident( name(), m_faultName, pReg->identifier() );
419 m_incidentSvc->fireIncident( incident );
420 return pReg->object();
421 } else if ( pReg ) {
422 std::string p = pReg->identifier();
423 if ( path.front() != SEPARATOR ) p += SEPARATOR;
424 p.append( path.data(), path.size() );
425 DataIncident incident( name(), m_faultName, p );
426 m_incidentSvc->fireIncident( incident );
427 pLeaf = m_root->findLeaf( p );
428 } else {
429 std::string p = m_root->identifier();
430 if ( path.front() != SEPARATOR ) p += SEPARATOR;
431 p.append( path.data(), path.size() );
432 DataIncident incident( name(), m_faultName, p );
433 m_incidentSvc->fireIncident( incident );
434 pLeaf = m_root->findLeaf( p );
435 }
436 if ( pLeaf ) return pLeaf->object();
437 }
438 return nullptr;
439}
ContextIncident< std::string > DataIncident
Specific incident type used by the data-on-demand-service.
constexpr char SEPARATOR
virtual const id_type & identifier() const =0
Full identifier (or key)
Gaudi::Property< bool > m_enableFaultHdlr
Definition TsDataSvc.h:66
Gaudi::Property< std::string > m_faultName
Definition TsDataSvc.h:68

◆ i_setRoot() [1/4]

StatusCode TsDataSvc::i_setRoot ( DataObject * pRootObj)
inline

Definition at line 147 of file TsDataSvc.h.

147{ return i_setRoot( m_rootName, pRootObj ); }
virtual StatusCode i_setRoot(std::string root_name, DataObject *pRootObj)
Initialize data store for new event by giving new event path and root object.

◆ i_setRoot() [2/4]

StatusCode TsDataSvc::i_setRoot ( IOpaqueAddress * pRootAddr)
inline

Definition at line 158 of file TsDataSvc.h.

158{ return i_setRoot( m_rootName, pRootAddr ); }

◆ i_setRoot() [3/4]

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

134 {
135 if ( pRootObj ) {
136 m_root = std::make_unique<RegEntry>( std::move( root_path ) );
137 m_root->makeHard( pRootObj );
138 m_root->setDataSvc( this );
139 // No done with GaudiHive. preLoad().ignore();
140 }
141 return StatusCode::SUCCESS;
142}

◆ i_setRoot() [4/4]

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

158 {
159 if ( pRootAddr ) {
160 m_root = std::make_unique<RegEntry>( std::move( root_path ) );
161 m_root->makeHard( pRootAddr );
162 m_root->setDataSvc( this );
163 // Not done with GaudiHive. preLoad().ignore();
164 }
165 return StatusCode::SUCCESS;
166}

◆ initialize()

StatusCode TsDataSvc::initialize ( )
override

Service initialization.

Definition at line 788 of file TsDataSvc.cpp.

788 {
789 // Nothing to do: just call base class initialisation
790 StatusCode sc = Service::initialize();
791 if ( !sc.isSuccess() ) return sc;
792 sc = m_incidentSvc.retrieve();
793 if ( !sc.isSuccess() ) { error() << "Failed to access incident service." << endmsg; }
794 return sc;
795}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode initialize() override
Definition Service.cpp:118

◆ linkObject() [1/4]

StatusCode IDataProviderSvc::linkObject ( DataObject * fromObj,
std::string_view objPath,
DataObject * toObj )
inline

Add a link to another object.

Both objects must already be registered with the data store. Once linked, the object can only be unregistered after unlinking.

Parameters
fromObjPointer to the object the link originates.
objPathPath of the entry to be linked relative to from.
toObjPointer to the object the link points to.
Returns
Status code indicating success or failure.

Definition at line 498 of file IDataProviderSvc.h.

585 {
586 if ( fromObj ) {
587 IRegistry* from_entry = fromObj->registry();
588 if ( from_entry ) return linkObject( from_entry, objPath, toObj );
589 }
590 return Status::INVALID_PARENT;
591}
StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *to) override
Add a link to another object.

◆ linkObject() [2/4]

StatusCode TsDataSvc::linkObject ( IRegistry * from,
std::string_view objPath,
DataObject * to )
override

Add a link to another object.

Definition at line 672 of file TsDataSvc.cpp.

672 {
674 if ( !checkRoot() ) return Status::INVALID_ROOT;
675 try {
676 RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
677 if ( from_entry ) {
678 // First check if both objects are already registered to the store
679 RegEntry* to_entry = m_root->findLeaf( to );
680 if ( !to_entry ) return Status::INVALID_OBJECT;
681 auto sep = objPath.rfind( SEPARATOR );
682 if ( sep > 0 && sep != std::string_view::npos ) { // in case the objPath is a sub-directory itself
683 DataObject* pO = nullptr;
684 StatusCode sc = retrieveObject( from, objPath.substr( 0, sep ), pO );
685 return sc.isSuccess() ? linkObject( pO->registry(), objPath.substr( sep ), to ) : sc;
686 }
687 // Now register the soft link
688 StatusCode status = from_entry->add( std::string{ objPath }, to, true );
689 return status.isSuccess() ? Status::IDataProviderSvc_NO_ERROR : Status::DOUBL_OBJ_PATH;
690 }
691 } catch ( ... ) {}
692 return Status::INVALID_PARENT;
693}
StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
Retrieve object from data store.

◆ linkObject() [3/4]

StatusCode IDataProviderSvc::linkObject ( std::string_view fromPath,
std::string_view objPath,
DataObject * toObj )
inline

Add a link to another object.

Both objects must already be registered with the data store. Once linked, the object can only be unregistered after unlinking.

Parameters
fromPathPath to the object the link originates.
objPathPath of the entry to be linked relative to from.
toObjPointer to the object the link points to.
Returns
Status code indicating success or failure.

Definition at line 484 of file IDataProviderSvc.h.

484 {
485 DataObject* pO = nullptr;
486 StatusCode status = retrieveObject( fromPath, pO );
487 return status.isSuccess() ? linkObject( pO->registry(), objPath, toObj ) : status;
488 }

◆ linkObject() [4/4]

StatusCode TsDataSvc::linkObject ( std::string_view fullPath,
DataObject * to )
override

Add a link to another object.

Definition at line 696 of file TsDataSvc.cpp.

696 {
697 if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
698 if ( fullPath.front() == SEPARATOR ) {
699 auto sep = fullPath.rfind( SEPARATOR );
700 return linkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ), to );
701 }
703 return linkObject( m_root.get(), fullPath, to );
704}

◆ loadObject() [1/2]

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

452 {
453 StatusCode status = Status::INVALID_OBJ_ADDR;
454 DataObject* pObject = nullptr;
456 if ( !pLoader ) { // Precondition: Data loader must be present
457 if ( handleDataFault( pRegistry ) )
458 return StatusCode::SUCCESS;
459 else
460 return Status::NO_DATA_LOADER;
461 }
462 if ( !pRegistry ) { // Precondition: Directory must be valid
463 if ( handleDataFault( pRegistry ) )
464 return StatusCode::SUCCESS;
465 else
466 return Status::INVALID_OBJ_ADDR;
467 }
468
469 VERMSG << "Requested object " << pRegistry->identifier() << endmsg;
470
471 if ( m_enableAccessHdlr ) {
472 // Fire data access incident
473 DataIncident incident( name(), m_accessName, pRegistry->identifier() );
474 m_incidentSvc->fireIncident( incident );
475 }
476 if ( !m_inhibitPathes.empty() ) {
477 const auto& ident = pRegistry->identifier();
478 auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), ident );
479 if ( inhibit != m_inhibitPathes.end() ) return Status::NO_ACCESS;
480 }
481 IOpaqueAddress* pAddress = pRegistry->address();
482 if ( !pAddress ) { // Precondition:
483 return Status::INVALID_OBJ_ADDR; // Address must be valid
484 }
485 try {
486 status = pLoader->createObj( pAddress, pObject ); // Call data loader
487 if ( status.isSuccess() ) {
488
489 VERMSG << "Object " << pRegistry->identifier() << " created" << endmsg;
490
491 RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pRegistry );
492 pEntry->setObject( pObject );
493
494 VERMSG << "Filling object " << pRegistry->identifier() << endmsg;
495 status = pLoader->fillObjRefs( pAddress, pObject );
496 }
497 } catch ( const GaudiException& exc ) {
498 if ( handleDataFault( pRegistry ) ) return StatusCode::SUCCESS;
499 throw GaudiException( "GaudiException in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE,
500 exc );
501 } catch ( const std::exception& x ) {
502 if ( handleDataFault( pRegistry ) ) return StatusCode::SUCCESS;
503 throw GaudiException( "std::exception in loadObject() " + pRegistry->identifier() + ": " +
504 System::typeinfoName( typeid( x ) ) + ", " + x.what(),
506 } catch ( ... ) {
507 if ( handleDataFault( pRegistry ) ) return StatusCode::SUCCESS;
508 throw GaudiException( "UNKN exception in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE );
509 }
510 if ( !status.isSuccess() ) {
511 if ( handleDataFault( pRegistry ) ) return StatusCode::SUCCESS;
512 }
513 ON_VERBOSE if ( status.isSuccess() ) {
514 verbose() << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
515 }
516 return status;
517}
#define ON_VERBOSE
#define VERMSG
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
void setObject(DataObject *obj)
Set/Update object address.
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
constexpr static const auto FAILURE
Definition StatusCode.h:100
Gaudi::Property< std::string > m_accessName
Definition TsDataSvc.h:72
Gaudi::Property< std::vector< std::string > > m_inhibitPathes
Definition TsDataSvc.h:64
Gaudi::Property< bool > m_enableAccessHdlr
Definition TsDataSvc.h:70
DataObject * handleDataFault(IRegistry *pReg, std::string_view path={})
Invoke data fault handling if enabled.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition System.cpp:260

◆ loadObject() [2/2]

StatusCode TsDataSvc::loadObject ( IRegistry * pNode)
protectedvirtual

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

Reimplemented in DetDataSvc.

Definition at line 444 of file TsDataSvc.cpp.

444 {
445 IConversionSvc* pLoader = getDataLoader( pRegistry );
446 return loadObject( pLoader, pRegistry );
447}
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.

◆ objectLeaves() [1/2]

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

193 {
194 if ( !pObject ) return Status::INVALID_OBJECT;
195 return objectLeaves( pObject->registry(), leaves );
196}
StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.

◆ objectLeaves() [2/2]

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

201 {
202 if ( !pRegistry ) return Status::INVALID_OBJECT;
203 const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
204 if ( !node_entry ) return Status::INVALID_OBJECT;
206 leaves.insert( leaves.end(), node_entry->leaves().begin(), node_entry->leaves().end() );
207 // leaves = node_entry->leaves();
208 return StatusCode::SUCCESS;
209}
const Store & leaves() const
Access the leaves of the object.

◆ objectParent() [1/2]

StatusCode TsDataSvc::objectParent ( const DataObject * pObject,
IRegistry *& refpParent )
override

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

Definition at line 178 of file TsDataSvc.cpp.

178 {
179 if ( !pObject ) return Status::INVALID_OBJECT;
180 return objectParent( pObject->registry(), refpParent );
181}
StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.

◆ objectParent() [2/2]

StatusCode TsDataSvc::objectParent ( const IRegistry * pRegistry,
IRegistry *& refpParent )
override

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

Definition at line 183 of file TsDataSvc.cpp.

183 {
185 if ( !checkRoot() ) return Status::INVALID_ROOT;
186 const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
187 if ( !node_entry ) return Status::INVALID_OBJECT;
188 refpParent = node_entry->parent();
189 return StatusCode::SUCCESS;
190}
IRegistry * parent() const
Pointer to parent directory entry.

◆ operator=()

TsDataSvc & TsDataSvc::operator= ( const TsDataSvc & )
delete

no assignment operator

◆ preLoad() [1/2]

StatusCode TsDataSvc::preLoad ( )
override

load all preload items of the list

Definition at line 777 of file TsDataSvc.cpp.

777 {
778 DataObject* pObj = nullptr;
779 for ( const auto& i : m_preLoads ) {
780 StatusCode sc = retrieveObject( i.path(), pObj );
781 int load_depth = i.depth();
782 if ( sc.isSuccess() && load_depth > 1 ) { preLoad( 1, load_depth, pObj ).ignore(); }
783 }
784 return StatusCode::SUCCESS;
785}
StatusCode preLoad() override
load all preload items of the list

◆ preLoad() [2/2]

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

761 {
762 // unused: StatusCode sc = StatusCode::FAILURE;
763 if ( pObject && depth++ < load_depth ) {
764 RegEntry* dir = CAST_REGENTRY( RegEntry*, pObject->registry() );
765 if ( dir ) {
766 for ( const auto& i : *dir ) {
767 DataObject* pObj = nullptr;
768 StatusCode status = retrieveObject( pObject, i->name(), pObj );
769 if ( status.isSuccess() && depth < load_depth ) { preLoad( depth, load_depth, pObj ).ignore(); }
770 }
771 }
772 }
773 return StatusCode::SUCCESS;
774}

◆ registerAddress() [1/3]

StatusCode IDataManagerSvc::registerAddress ( DataObject * parentObj,
std::string_view objectPath,
IOpaqueAddress * pAddress )
inline

Register object address with the data store.

Connect the object identified by its pointer to the parent object and the relative path of the object with respect to the parent.

Parameters
parentObj[IN] Pointer to parent object.
objectPath[IN] Path of the object relative to the parent node
pAddress[IN] Pointer to the object to be connected.
Returns
Status code indicating success or failure.

Definition at line 210 of file IDataManagerSvc.h.

210 {
211 return registerAddress( parentObj ? parentObj->registry() : nullptr, objectPath, pAddress );
212 }
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.

◆ registerAddress() [2/3]

StatusCode TsDataSvc::registerAddress ( IRegistry * parentObj,
std::string_view objectPath,
IOpaqueAddress * pAddress )
override

IDataManagerSvc: Register object address with the data store.

Definition at line 218 of file TsDataSvc.cpp.

218 {
219 if ( !checkRoot() ) return Status::INVALID_ROOT;
220 if ( objPath.empty() ) return Status::INVALID_OBJ_PATH;
221 if ( !parentObj ) {
222 if ( objPath.front() != SEPARATOR ) { return registerAddress( m_root.get(), objPath, pAddress ); }
223 auto sep = find( objPath, SEPARATOR, 1 );
224 if ( sep == std::string_view::npos || objPath.substr( 0, sep ) != m_rootName.value() ) {
225 return Status::INVALID_PARENT;
226 }
227 return registerAddress( m_root.get(), objPath.substr( sep ), pAddress );
228 }
229 if ( objPath.front() != SEPARATOR ) { return registerAddress( parentObj, SEPARATOR + objPath, pAddress ); }
230 RegEntry* par_entry = CAST_REGENTRY( RegEntry*, parentObj );
231 if ( !par_entry ) return Status::INVALID_PARENT;
232 auto sep = objPath.rfind( SEPARATOR );
233 if ( sep > 0 && sep != std::string_view::npos ) {
234 auto p_path = objPath.substr( 0, sep );
235 auto o_path = objPath.substr( sep );
236 RegEntry* p_entry = par_entry->findLeaf( p_path );
237 // Create default object leafs if the
238 // intermediate nodes are not present
239 if ( !p_entry && m_forceLeaves ) {
241 StatusCode sc = registerObject( par_entry->identifier(), p_path, pLeaf );
242 if ( !sc.isSuccess() ) delete pLeaf;
243 p_entry = par_entry->findLeaf( p_path );
244 }
245 if ( !p_entry ) return Status::INVALID_PARENT;
246 return registerAddress( p_entry, o_path, pAddress );
247 }
248 StatusCode status = par_entry->add( std::string{ objPath }, pAddress );
249 return status.isSuccess() ? status : Status::DOUBL_OBJ_PATH;
250}
const std::string & identifier() const override
Full identifier (or key)
RegistryEntry * findLeaf(std::string_view path) const
Find identified leaf in this registry node.
Gaudi::Property< bool > m_forceLeaves
Definition TsDataSvc.h:62
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
StatusCode registerObject(std::string_view parentPath, std::string_view objPath, DataObject *pObject) override
Register object with the data store.

◆ registerAddress() [3/3]

StatusCode TsDataSvc::registerAddress ( std::string_view fullPath,
IOpaqueAddress * pAddress )
override

IDataManagerSvc: Register object address with the data store.

Definition at line 212 of file TsDataSvc.cpp.

212 {
213 if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
214 return registerAddress( fullPath.front() != SEPARATOR ? m_root.get() : nullptr, fullPath, pAddress );
215}

◆ registerObject() [1/5]

StatusCode IDataProviderSvc::registerObject ( DataObject * parentObj,
int item,
DataObject * pObject )
inline

Register object with the data store.

Connect the object identified by its pointer to the node object identified by its pointer.

Parameters
parentObjPointer to parent object.
itemitem number of the object linked to the parent
pObjectPointer to the object to be connected.
Returns
Status code indicating success or failure.

Definition at line 112 of file IDataProviderSvc.h.

112 {
113 return registerObject( parentObj, itemToPath( item ), pObject );
114 }

◆ registerObject() [2/5]

StatusCode TsDataSvc::registerObject ( DataObject * parentObj,
std::string_view objPath,
DataObject * pObject )
override

Register object with the data store.

Definition at line 300 of file TsDataSvc.cpp.

300 {
301 if ( !checkRoot() ) return Status::INVALID_ROOT;
302 if ( !parentObj ) {
303 if ( !objPath.empty() ) {
304 if ( objPath.front() != SEPARATOR ) { return registerObject( m_rootName.value(), objPath, pObject ); }
305 auto sep = find( objPath, SEPARATOR, 1 );
306 if ( sep != std::string_view::npos ) {
307 return registerObject( objPath.substr( 0, sep ), objPath.substr( sep ), pObject );
308 }
309 }
310 return Status::INVALID_OBJ_PATH;
311 }
312 RegEntry* node_entry = CAST_REGENTRY( RegEntry*, parentObj->registry() );
313 if ( node_entry ) {
314 StatusCode status = Status::INVALID_PARENT;
315 auto sep = find( objPath, SEPARATOR, 1 );
316 if ( sep != std::string_view::npos ) {
317 auto p_path = objPath.substr( 0, sep );
318 auto o_path = objPath.substr( sep );
319 RegEntry* par_entry = node_entry->findLeaf( p_path );
320 // Create default object leafs if the
321 // intermediate nodes are not present
322 if ( !par_entry && m_forceLeaves ) {
324 StatusCode sc = registerObject( parentObj, p_path, pLeaf );
325 if ( !sc.isSuccess() ) delete pLeaf;
326 par_entry = node_entry->findLeaf( p_path );
327 } else if ( par_entry && !par_entry->object() ) {
328 status = retrieveEntry( node_entry, p_path, par_entry );
329 if ( !status.isSuccess() && !par_entry->address() && m_forceLeaves ) {
331 StatusCode sc = registerObject( parentObj, p_path, pLeaf );
332 if ( !sc.isSuccess() ) delete pLeaf;
333 par_entry = node_entry->findLeaf( p_path );
334 }
335 }
336 node_entry = par_entry;
337 if ( node_entry ) {
338 DataObject* obj = node_entry->object();
339 if ( obj ) status = registerObject( obj, o_path, pObject );
340 }
341 } else {
342 RegEntry* leaf = node_entry->findLeaf( objPath );
343 if ( !leaf ) {
344 status = node_entry->add( std::string{ objPath }, pObject );
345 } else {
346 DataObject* obj = leaf->object();
347 if ( !obj ) {
348 if ( !pObject ) {
349 error() << "registerObject: trying to register null DataObject" << endmsg;
350 return StatusCode::FAILURE;
351 } else {
352 pObject->setRegistry( leaf );
353 }
354 leaf->setAddress( nullptr );
355 leaf->setObject( pObject );
356 status = StatusCode::SUCCESS;
357 } else {
358 status = Status::DOUBL_OBJ_PATH;
359 }
360 }
361 }
362 return status;
363 }
364 return Status::INVALID_PARENT;
365}
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition DataObject.h:77
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
DataObject * object() const override
Retrive object behind the link.
IOpaqueAddress * address() const override
Retrieve opaque storage address.
StatusCode retrieveEntry(DataSvcHelpers::RegistryEntry *pNode, std::string_view path, DataSvcHelpers::RegistryEntry *&pEntry)
Retrieve registry entry from store.

◆ registerObject() [3/5]

StatusCode IDataProviderSvc::registerObject ( std::string_view fullPath,
DataObject * pObject )
inline

Register object with the data store.

Connect the object identified by its pointer to the node object identified by its path.

Parameters
fullPathPath to parent node of the object.
pObjectPointer to the object to be registered.
Returns
Status code indicating success or failure.

Definition at line 67 of file IDataProviderSvc.h.

67 {
68 return registerObject( nullptr, fullPath, pObject );
69 }

◆ registerObject() [4/5]

StatusCode IDataProviderSvc::registerObject ( std::string_view parentPath,
int item,
DataObject * pObject )
inline

Register object with the data store.

Connect the object identified by its pointer to the parent object and an integer identifier.

Parameters
parentPathPath to parent node of the object.
itemitem number of the object linked to the parent
pObjectPointer to the object to be registered.
Returns
Status code indicating success or failure.

Definition at line 90 of file IDataProviderSvc.h.

90 {
91 return registerObject( parentPath, itemToPath( item ), pObject );
92 }

◆ registerObject() [5/5]

StatusCode TsDataSvc::registerObject ( std::string_view parentPath,
std::string_view objPath,
DataObject * pObject )
override

Register object with the data store.

Definition at line 288 of file TsDataSvc.cpp.

288 {
289 DataObject* pO = nullptr;
290 StatusCode status = retrieveObject( parentPath, pO );
291 if ( !status.isSuccess() && m_forceLeaves ) {
292 pO = createDefaultObject();
293 status = registerObject( parentPath, pO );
294 if ( !status.isSuccess() ) pO->release();
295 }
296 return status.isSuccess() ? registerObject( pO, objPath, pObject ) : status;
297}
virtual unsigned long release()
release reference to object

◆ reinitialize()

StatusCode TsDataSvc::reinitialize ( )
override

Service initialization.

Service reinitialization.

Definition at line 798 of file TsDataSvc.cpp.

798 {
799 StatusCode sc;
800 // the finalize part is copied here
801 setDataLoader( nullptr ).ignore();
803 clearStore().ignore();
804 // re-initialize the base class
806 if ( !sc.isSuccess() ) {
807 error() << "Unable to reinitialize base class" << endmsg;
808 return sc;
809 }
810 // the initialize part is copied here
811 sc = m_incidentSvc.retrieve();
812 if ( !sc.isSuccess() ) {
813 error() << "Failed to access incident service." << endmsg;
814 return sc;
815 }
816
817 return StatusCode::SUCCESS;
818}
StatusCode reinitialize() override
Definition Service.cpp:296

◆ removePreLoadItem()

StatusCode TsDataSvc::removePreLoadItem ( const DataStoreItem & item)
override

Remove an item from the preload list.

Definition at line 748 of file TsDataSvc.cpp.

748 {
749 auto i = std::remove( m_preLoads.begin(), m_preLoads.end(), item );
750 m_preLoads.erase( i, m_preLoads.end() );
751 return StatusCode::SUCCESS;
752}

◆ resetPreLoad()

StatusCode TsDataSvc::resetPreLoad ( )
override

Clear the preload list.

Definition at line 755 of file TsDataSvc.cpp.

755 {
756 m_preLoads.clear();
757 return StatusCode::SUCCESS;
758}

◆ retrieveEntry()

StatusCode TsDataSvc::retrieveEntry ( DataSvcHelpers::RegistryEntry * pNode,
std::string_view path,
DataSvcHelpers::RegistryEntry *& pEntry )
protected

Retrieve registry entry from store.

Definition at line 520 of file TsDataSvc.cpp.

520 {
521 auto sep = find( path, SEPARATOR, 1 );
522 StatusCode status = Status::INVALID_ROOT;
523 pEntry = nullptr;
525 // A.Valassi 16.08.2001 avoid core dump if store is empty
526 if ( checkRoot() ) {
527 if ( !parentObj ) {
528 if ( path.empty() || path == m_rootName ) return retrieveEntry( m_root.get(), "", pEntry );
529 if ( path.front() != SEPARATOR ) return retrieveEntry( m_root.get(), path, pEntry );
530 if ( sep == std::string_view::npos ) return Status::INVALID_OBJ_PATH;
531 if ( !m_root->object() ) {
532 RegEntry* r = nullptr;
533 status = retrieveEntry( m_root.get(), "", r );
534 if ( !status.isSuccess() ) return status;
535 }
536 return retrieveEntry( m_root.get(), path.substr( sep ), pEntry );
537 }
538 if ( sep != std::string_view::npos ) { // the string contains a separator (after pos 0)
539 auto p_path = path.substr( 0, sep );
540 auto o_path = path.substr( sep );
541 if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
542 status = loadObject( parentObj );
543 if ( !status.isSuccess() ) return status;
544 }
545 RegEntry* root_entry = parentObj->findLeaf( p_path );
546 if ( !root_entry && m_enableFaultHdlr ) {
547 // If not even the parent is there, an incident
548 // to load the parent must be fired...
549 handleDataFault( parentObj, p_path );
550 root_entry = parentObj->findLeaf( p_path );
551 }
552 if ( root_entry ) {
553 DataObject* pO = root_entry->object();
554 if ( !pO ) {
555 // Object is not loaded: load the object if at all possible
556 status = loadObject( root_entry );
557 if ( !status.isSuccess() ) return status;
558 }
559 if ( root_entry->isSoft() ) { root_entry = CAST_REGENTRY( RegEntry*, pO->registry() ); }
560 return retrieveEntry( root_entry, o_path, pEntry );
561 }
562 return Status::INVALID_OBJ_PATH;
563 } else if ( path.empty() ) {
564 pEntry = parentObj;
565 } else {
566 if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
567 status = loadObject( parentObj );
568 if ( !status.isSuccess() ) return status;
569 }
570 // last leave in search: find leaf and load
571 pEntry = parentObj->findLeaf( path );
572 // If no registry entry was found, trigger incident for action-on-demand
573 if ( !pEntry && m_enableFaultHdlr ) {
574 handleDataFault( parentObj, path );
575 pEntry = ( path.empty() ? parentObj : parentObj->findLeaf( path ) );
576 }
577 }
578 // Check results and return
579 if ( !pEntry ) {
580 status = Status::INVALID_OBJ_PATH;
581 } else if ( !pEntry->object() ) {
582 status = loadObject( pEntry );
583 } else if ( m_enableAccessHdlr ) {
584 // Fire data access incident
585 // I do not know if this is a good idea....
586 // This fires too often!
587 //
588 // DataIncident incident(name(), m_accessName, pEntry->identifier());
589 // m_incidentSvc->fireIncident(incident);
590 status = StatusCode::SUCCESS;
591 } else {
592 status = StatusCode::SUCCESS;
593 }
594 }
595 return status;
596}
bool isSoft() const
Is the link soft or hard.

◆ retrieveObject() [1/6]

StatusCode IDataProviderSvc::retrieveObject ( DataObject * parentObj,
int item,
DataObject *& pObject )
inline

Retrieve object from data store.

The object to be retrieved is identified by the pointer to the parent object and an integer identifier. In case the object is not present it will be loaded and converted if possible.

Parameters
parentObjPointer to parent node of the object.
itemItem identifier.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 296 of file IDataProviderSvc.h.

296 {
297 return retrieveObject( parentObj, itemToPath( item ), pObject );
298 }

◆ retrieveObject() [2/6]

StatusCode IDataProviderSvc::retrieveObject ( DataObject * parentObj,
std::string_view objectPath,
DataObject *& pObject )
inline

Retrieve object from data store.

The object to be retrieved is identified by the pointer to the parent object and the relative path with respect to the node. In case the object is not present it will be loaded and converted if possible.

Parameters
parentObjPointer to parent node of the object.
objectPathPath of the object relative to the parent.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 282 of file IDataProviderSvc.h.

282 {
283 return retrieveObject( parentObj ? parentObj->registry() : nullptr, objectPath, pObject );
284 }

◆ retrieveObject() [3/6]

StatusCode TsDataSvc::retrieveObject ( IRegistry * pDirectory,
std::string_view path,
DataObject *& pObject )
override

Retrieve object from data store.

Retrieve object identified by its directory from the data store.

Definition at line 599 of file TsDataSvc.cpp.

599 {
600 pObject = nullptr;
601 RegEntry * result = nullptr, *parent = CAST_REGENTRY( RegEntry*, pRegistry );
602 StatusCode status = retrieveEntry( parent, path, result );
603 if ( status.isSuccess() ) pObject = result->object();
604 return status;
605}

◆ retrieveObject() [4/6]

StatusCode IDataProviderSvc::retrieveObject ( std::string_view fullPath,
DataObject *& pObject )
inline

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

The result will be returned in the second argument. In case the object is not present it will be loaded and converted if possible.

Parameters
fullPathPath name of the object.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 238 of file IDataProviderSvc.h.

238 {
239 return retrieveObject( static_cast<IRegistry*>( nullptr ), fullPath, pObject );
240 }

◆ retrieveObject() [5/6]

StatusCode IDataProviderSvc::retrieveObject ( std::string_view parentPath,
int item,
DataObject *& pObject )
inline

Retrieve object from data store.

The object to be retrieved is identified by the path to the parent object and an integer identifier. In case the object is not present it will be loaded and converted if possible.

Parameters
parentPathPath to parent node of the object.
itemItem identifier.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 268 of file IDataProviderSvc.h.

268 {
269 return retrieveObject( parentPath, itemToPath( item ), pObject );
270 }

◆ retrieveObject() [6/6]

StatusCode IDataProviderSvc::retrieveObject ( std::string_view parentPath,
std::string_view objectPath,
DataObject *& pObject )
inline

Retrieve object from data store.

The object to be retrieved is identified by the path of the parent object and the relative path with respect to the node. In case the object is not present it will be loaded and converted if possible.

Parameters
parentPathPath to parent node of the object.
objectPathPath of the object relative to the parent.
pObjectReference to the pointer of the object to be returned.
Returns
Status code indicating success or failure.

Definition at line 252 of file IDataProviderSvc.h.

252 {
253 DataObject* parent = nullptr;
254 StatusCode status = retrieveObject( parentPath, parent );
255 return status.isSuccess() ? retrieveObject( parent, objectPath, pObject ) : status;
256 }

◆ rootCLID()

CLID TsDataSvc::rootCLID ( ) const
override

IDataManagerSvc: Accessor for root event CLID.

CLID for root Event.

Definition at line 830 of file TsDataSvc.cpp.

830{ return ( (CLID)m_rootCLID ); }
unsigned int CLID
Class ID definition.
Definition ClassID.h:16
Gaudi::Property< CLID > m_rootCLID
Definition TsDataSvc.h:60

◆ rootName()

const std::string & TsDataSvc::rootName ( ) const
override

IDataManagerSvc: Accessor for root event name.

Name for root Event.

Definition at line 833 of file TsDataSvc.cpp.

833{ return ( m_rootName ); }

◆ setDataLoader()

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

169 {
170 if ( pDataLoader ) pDataLoader->addRef();
171 if ( m_dataLoader ) m_dataLoader->release();
172 if ( pDataLoader ) { pDataLoader->setDataProvider( dpsvc == nullptr ? this : dpsvc ).ignore(); }
173 m_dataLoader = pDataLoader;
174 return StatusCode::SUCCESS;
175}

◆ setRoot() [1/2]

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

124 {
125 clearStore().ignore();
126 return i_setRoot( std::move( root_path ), pRootObj );
127}

◆ setRoot() [2/2]

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

148 {
149 clearStore().ignore();
150 return i_setRoot( std::move( root_path ), pRootAddr );
151}

◆ traverseSubTree() [1/2]

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

105 {
107 if ( !checkRoot() ) return Status::INVALID_ROOT;
108 RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
109 if ( !entry ) return Status::INVALID_OBJECT;
110 return entry->traverseTree( pAgent );
111}
StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree

◆ traverseSubTree() [2/2]

StatusCode TsDataSvc::traverseSubTree ( std::string_view 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 98 of file TsDataSvc.cpp.

98 {
99 DataObject* pO = nullptr;
100 StatusCode status = findObject( sub_tree_path, pO );
101 return status.isSuccess() ? traverseSubTree( pO, pAgent ) : status;
102}
StatusCode traverseSubTree(std::string_view 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:98

◆ traverseTree()

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

114 {
116 if ( !checkRoot() ) return Status::INVALID_ROOT;
117 return m_root->traverseTree( pAgent );
118}

◆ unlinkObject() [1/4]

StatusCode TsDataSvc::unlinkObject ( DataObject * fromObj,
std::string_view objPath )
override

Remove a link to another object.

Definition at line 735 of file TsDataSvc.cpp.

735 {
736 if ( !checkRoot() ) return Status::INVALID_ROOT;
737 return unlinkObject( m_root->findLeaf( from ), objPath );
738}
StatusCode unlinkObject(IRegistry *from, std::string_view objPath) override
Remove a link to another object.

◆ unlinkObject() [2/4]

StatusCode TsDataSvc::unlinkObject ( IRegistry * from,
std::string_view objPath )
override

Remove a link to another object.

Definition at line 707 of file TsDataSvc.cpp.

707 {
709 if ( !checkRoot() ) return Status::INVALID_ROOT;
710 try {
711 RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
712 if ( from_entry ) {
713 auto sep = objPath.rfind( SEPARATOR );
714 if ( sep > 0 && sep != std::string_view::npos ) { // in case the objPath is a sub-directory itself
715 DataObject* pO = nullptr;
716 StatusCode sc = findObject( from, objPath.substr( 0, sep ), pO );
717 return sc.isSuccess() ? unlinkObject( pO->registry(), objPath.substr( sep ) ) : sc;
718 }
719 StatusCode status = from_entry->remove( objPath );
720 return status.isSuccess() ? status : Status::INVALID_OBJ_PATH;
721 }
722 } catch ( ... ) {}
723 return Status::INVALID_PARENT;
724}

◆ unlinkObject() [3/4]

StatusCode IDataProviderSvc::unlinkObject ( std::string_view fromPath,
std::string_view objPath )
inline

Remove a link to another object.

Both objects must be registered with the data store. This entry point can be used to unlink objects e.g. in order to unregister them.

Parameters
fromPathPath to the object the link originates.
objPathPath of the entry to be linked relative to from.
Returns
Status code indicating success or failure.

Definition at line 527 of file IDataProviderSvc.h.

527 {
528 DataObject* pObject = nullptr;
529 StatusCode status = findObject( fromPath, pObject );
530 return status.isSuccess() ? unlinkObject( pObject->registry(), objPath ) : status;
531 }

◆ unlinkObject() [4/4]

StatusCode TsDataSvc::unlinkObject ( std::string_view fullPath)
override

Remove a link to another object.

Definition at line 727 of file TsDataSvc.cpp.

727 {
728 if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
729 if ( fullPath.front() != SEPARATOR ) { return unlinkObject( m_root.get(), fullPath ); }
730 auto sep = fullPath.rfind( SEPARATOR );
731 return unlinkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ) );
732}

◆ unregisterAddress() [1/3]

StatusCode IDataManagerSvc::unregisterAddress ( DataObject * pParent,
std::string_view objPath )
inline

Unregister object address from the data store.

The object is identified by parent object and the path of the object relative to the parent.

Parameters
pParent[IN] Pointer to parent object.
objPath[IN] Path name of the object relative to the parent.
Returns
Status code indicating success or failure.

Definition at line 238 of file IDataManagerSvc.h.

238 {
239 return unregisterAddress( pParent ? pParent->registry() : nullptr, objPath );
240 }
StatusCode unregisterAddress(std::string_view fullPath) override
IDataManagerSvc: Unregister object address from the data store.

◆ unregisterAddress() [2/3]

StatusCode TsDataSvc::unregisterAddress ( IRegistry * pParent,
std::string_view objPath )
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 259 of file TsDataSvc.cpp.

259 {
260 if ( !checkRoot() ) return Status::INVALID_ROOT;
261
262 if ( objPath.empty() ) return Status::INVALID_OBJ_PATH;
263 if ( !pParent ) {
264 if ( objPath.front() != SEPARATOR ) { return unregisterAddress( m_root.get(), objPath ); }
265 auto sep = find( objPath, SEPARATOR, 1 );
266 if ( sep == std::string_view::npos || objPath.substr( 0, sep ) != m_rootName.value() ) {
267 return Status::INVALID_PARENT;
268 }
269 return unregisterAddress( m_root.get(), objPath.substr( sep ) );
270 }
271 if ( objPath.front() != SEPARATOR ) { return unregisterAddress( pParent, SEPARATOR + objPath ); }
272 RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pParent );
273 if ( node_entry ) {
274 RegEntry* leaf_entry = node_entry->findLeaf( objPath );
275 if ( leaf_entry ) {
276 auto sep = objPath.rfind( SEPARATOR );
277 if ( sep > 0 && sep != std::string_view::npos ) {
278 return unregisterAddress( leaf_entry->parent(), objPath.substr( sep ) );
279 }
280 StatusCode status = node_entry->remove( objPath );
281 if ( status.isSuccess() ) return status;
282 }
283 }
284 return Status::INVALID_PARENT;
285}

◆ unregisterAddress() [3/3]

StatusCode TsDataSvc::unregisterAddress ( std::string_view fullPath)
override

IDataManagerSvc: Unregister object address from the data store.

Definition at line 253 of file TsDataSvc.cpp.

253 {
254 if ( fullPath.empty() ) return Status::INVALID_OBJ_PATH;
255 return unregisterAddress( fullPath.front() != SEPARATOR ? m_root.get() : nullptr, fullPath );
256}

◆ unregisterObject() [1/3]

StatusCode TsDataSvc::unregisterObject ( DataObject * pObject)
override

Unregister object from the data store.

Definition at line 383 of file TsDataSvc.cpp.

383 {
384 if ( !checkRoot() ) return Status::INVALID_ROOT;
385 RegEntry* entry = m_root->findLeaf( pObject );
386 if ( !entry ) return Status::INVALID_OBJECT;
387 RegEntry* parent = entry->parentEntry();
388 if ( !parent ) return Status::INVALID_PARENT;
389 if ( !entry->isEmpty() ) return Status::DIR_NOT_EMPTY;
390 if ( entry->object() ) entry->object()->addRef();
391 if ( parent ) parent->remove( entry );
392 return StatusCode::SUCCESS;
393}
virtual unsigned long addRef()
Add reference to object.
bool isEmpty() const
Simple check if the Container is empty.

◆ unregisterObject() [2/3]

StatusCode TsDataSvc::unregisterObject ( DataObject * pObject,
std::string_view objectPath )
override

Unregister object from the data store.

Definition at line 396 of file TsDataSvc.cpp.

396 {
397 if ( !checkRoot() ) return Status::INVALID_ROOT;
398 try {
399 RegEntry* parent = CAST_REGENTRY( RegEntry*, pParentObj->registry() );
400 if ( parent ) {
401 RegEntry* entry = parent->findLeaf( objectPath );
402 if ( !entry ) return Status::INVALID_OBJECT;
403 if ( !entry->isEmpty() ) return Status::DIR_NOT_EMPTY;
404 if ( entry->object() ) entry->object()->addRef();
405 parent->remove( entry );
406 return StatusCode::SUCCESS;
407 }
408 } catch ( ... ) {}
409 return Status::INVALID_PARENT;
410}

◆ unregisterObject() [3/3]

StatusCode TsDataSvc::unregisterObject ( std::string_view fullPath)
override

Unregister object from the data store.

Definition at line 368 of file TsDataSvc.cpp.

368 {
369 DataObject* pObject = nullptr;
370 StatusCode status = findObject( fullPath, pObject );
371 if ( status.isFailure() ) return status;
372 RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pObject->registry() );
373 if ( !pEntry ) return Status::INVALID_ROOT;
374 if ( !pEntry->isEmpty() ) return Status::DIR_NOT_EMPTY;
375 RegEntry* pParent = pEntry->parentEntry();
376 if ( !pParent ) return Status::INVALID_PARENT;
377 pObject->addRef();
378 pParent->remove( pEntry );
379 return StatusCode::SUCCESS;
380}
bool isFailure() const
Definition StatusCode.h:129

◆ updateObject() [1/2]

StatusCode TsDataSvc::updateObject ( DataObject * toUpdate)
override

Update object.

Definition at line 641 of file TsDataSvc.cpp.

641 {
642 StatusCode status = Status::INVALID_OBJ_ADDR;
643 if ( !toUpdate ) return Status::INVALID_OBJECT; // Precondition: Address must be valid
644 IRegistry* pRegistry = toUpdate->registry();
645 if ( !pRegistry ) return Status::INVALID_OBJECT; // Precondition: Need valid registry
646 IOpaqueAddress* pAddress = pRegistry->address();
647 if ( !pAddress ) return Status::INVALID_OBJ_ADDR; // Precondition: Need valid address
649 IConversionSvc* pLoader = getDataLoader( pRegistry );
650 if ( !pLoader ) return Status::NO_DATA_LOADER; // Precondition: Data loader must be present
651 if ( !m_inhibitPathes.empty() ) {
652 auto& ident = pRegistry->identifier();
653 auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), ident );
654 if ( inhibit != m_inhibitPathes.end() ) return Status::NO_ACCESS;
655 }
656 try {
657 status = pLoader->updateObj( pAddress, toUpdate ); // Call data loader
658 if ( status.isSuccess() ) { status = pLoader->updateObjRefs( pAddress, toUpdate ); }
659 } catch ( const GaudiException& exc ) {
660 throw GaudiException( "GaudiException in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE, exc );
661 } catch ( const std::exception& x ) {
662 throw GaudiException( "std::exception in updateObject() " + pRegistry->name() + ": " +
663 System::typeinfoName( typeid( x ) ) + ", " + x.what(),
665 } catch ( ... ) {
666 throw GaudiException( "UNKN exception in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE );
667 }
668 return status;
669}
virtual const name_type & name() const =0
Name of the directory (or key)
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.

◆ updateObject() [2/2]

StatusCode TsDataSvc::updateObject ( IRegistry * pDirectory)
override

Update object identified by its directory entry.

Update object.

Definition at line 634 of file TsDataSvc.cpp.

634 {
635 if ( !pRegistry ) return Status::INVALID_OBJ_ADDR; // Precondition: Addres must be valid
636 DataObject* toUpdate = pRegistry->object();
637 return toUpdate ? updateObject( toUpdate ) : loadObject( pRegistry );
638}
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.

Member Data Documentation

◆ m_accessMutex

tsDataSvcMutex TsDataSvc::m_accessMutex
protected

Mutex to protect access to the store.

Definition at line 292 of file TsDataSvc.h.

◆ m_accessName

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

Definition at line 72 of file TsDataSvc.h.

72{ this, "DataAccessName", "DataAccess", "Name of the data access incident" };

◆ m_dataLoader

IConversionSvc* TsDataSvc::m_dataLoader = nullptr
private

Pointer to data loader service.

Definition at line 56 of file TsDataSvc.h.

◆ m_enableAccessHdlr

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

Definition at line 70 of file TsDataSvc.h.

70 { this, "EnableAccessHandler", false,
71 "enable incidents on data access requests" };

◆ m_enableFaultHdlr

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

Definition at line 66 of file TsDataSvc.h.

66 { this, "EnableFaultHandler", false,
67 "enable incidents on data creation requests" };

◆ m_faultName

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

Definition at line 68 of file TsDataSvc.h.

68{ this, "DataFaultName", "DataFault", "Name of the data fault incident" };

◆ m_forceLeaves

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

Definition at line 62 of file TsDataSvc.h.

62 { this, "ForceLeaves", false,
63 "force creation of default leaves on registerObject" };

◆ m_incidentSvc

ServiceHandle<IIncidentSvc> TsDataSvc::m_incidentSvc
private

Handle to incident service.

Definition at line 58 of file TsDataSvc.h.

◆ m_inhibitPathes

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

Definition at line 64 of file TsDataSvc.h.

64{ this, "InhibitPaths", {}, "inhibited leaves" };

◆ m_preLoads

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

Items to be pre-loaded.

Definition at line 75 of file TsDataSvc.h.

◆ m_root

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

Pointer to root entry.

Definition at line 77 of file TsDataSvc.h.

◆ m_rootCLID

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

Definition at line 60 of file TsDataSvc.h.

60{ this, "RootCLID", 110 /*CLID_Event*/, "CLID of root entry" };

◆ m_rootName

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

Definition at line 61 of file TsDataSvc.h.

61{ this, "RootName", "/Event", "name of root entry" };

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