20 #define TSDATASVC_DATASVC_CPP 46 #define STD_LOCK_GUARD_MACRO std::lock_guard<tsDataSvcMutex> lock( m_accessMutex ); 65 #define CAST_REGENTRY( x, y ) dynamic_cast<x>( y ) 69 #define ON_DEBUG if ( msgLevel( MSG::DEBUG ) ) 70 #define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) ) 72 #define DEBMSG ON_DEBUG debug() 73 #define VERMSG ON_VERBOSE verbose() 84 if ( 0 != node_entry ) {
87 parent->
remove( node_entry );
90 return INVALID_PARENT;
92 return INVALID_OBJECT;
110 return INVALID_PARENT;
112 return INVALID_OBJECT;
151 return INVALID_OBJECT;
183 if ( 0 != pRootObj ) {
209 if ( 0 != pRootAddr ) {
221 if ( 0 != pDataLoader ) pDataLoader->
addRef();
223 if ( 0 != pDataLoader ) {
237 return INVALID_OBJECT;
246 refpParent = node_entry->
parent();
249 return INVALID_OBJECT;
261 return INVALID_OBJECT;
277 return INVALID_OBJECT;
285 if ( fullPath.
length() > 0 ) {
292 return INVALID_OBJ_PATH;
306 if ( objPath.
length() > 0 ) {
307 if ( 0 == parentObj ) {
312 if ( sep != std::string::npos ) {
319 return INVALID_PARENT;
328 if ( 0 != par_entry ) {
330 if ( sep > 0 && sep != std::string::npos ) {
342 p_entry = par_entry->
findLeaf( p_path );
344 if ( 0 != p_entry ) {
347 return INVALID_PARENT;
353 return DOUBL_OBJ_PATH;
355 return INVALID_PARENT;
357 return INVALID_OBJ_PATH;
365 if ( fullPath.
length() > 0 ) {
372 return INVALID_OBJ_PATH;
386 if ( objPath.
length() > 0 ) {
387 if ( 0 == pParent ) {
392 if ( sep != std::string::npos ) {
399 return INVALID_PARENT;
408 if ( 0 != node_entry ) {
410 if ( 0 != leaf_entry ) {
412 if ( sep > 0 && sep != std::string::npos ) {
417 if ( status.isSuccess() ) {
422 return INVALID_PARENT;
424 return INVALID_OBJ_PATH;
469 if ( 0 == parentObj ) {
470 if ( objPath.
length() > 0 ) {
473 if ( sep != std::string::npos ) {
482 return INVALID_OBJ_PATH;
485 if ( 0 != node_entry ) {
488 if ( sep != std::string::npos ) {
500 par_entry = node_entry->
findLeaf( p_path );
501 }
else if ( 0 != par_entry && par_entry->object() == 0 ) {
509 par_entry = node_entry->
findLeaf( p_path );
512 node_entry = par_entry;
513 if ( 0 != node_entry ) {
522 status = node_entry->
add( objPath, pObject );
526 if ( 0 == pObject ) {
527 error() <<
"registerObject: trying to register null DataObject" <<
endmsg;
536 status = DOUBL_OBJ_PATH;
542 return INVALID_PARENT;
557 if ( 0 != pParent ) {
558 if ( 0 != pObject ) {
561 pParent->
remove( pEntry );
564 return INVALID_PARENT;
566 return DIR_NOT_EMPTY;
599 if ( 0 != entry->
object() ) {
607 return INVALID_PARENT;
609 return DIR_NOT_EMPTY;
611 return INVALID_OBJECT;
626 if ( 0 != entry->
object() ) {
632 return DIR_NOT_EMPTY;
634 return INVALID_OBJECT;
638 return INVALID_PARENT;
655 if ( pReg && path.
length() == 0 ) {
698 if ( 0 == pLoader ) {
702 return NO_DATA_LOADER;
704 if ( 0 == pRegistry ) {
708 return INVALID_OBJ_ADDR;
726 if ( 0 == pAddress ) {
727 return INVALID_OBJ_ADDR;
730 status = pLoader->
createObj( pAddress, pObject );
731 if ( status.isSuccess() ) {
739 status = pLoader->
fillObjRefs( pAddress, pObject );
760 if ( !status.isSuccess() ) {
781 if ( 0 == parentObj ) {
786 }
else if ( sep != std::string::npos ) {
797 return INVALID_OBJ_PATH;
799 if ( sep != std::string::npos ) {
802 if ( !parentObj->
object() ) {
813 root_entry = parentObj->
findLeaf( p_path );
824 if ( root_entry->
isSoft() ) {
830 }
else if ( path.
length() == 0 ) {
833 if ( !parentObj->
object() ) {
840 pEntry = parentObj->
findLeaf( path );
844 pEntry = ( 0 == path.
length() ) ? parentObj : parentObj->
findLeaf( path );
849 status = INVALID_OBJ_PATH;
850 }
else if ( 0 == pEntry->
object() ) {
875 pObject = result->
object();
925 if ( 0 != root_entry ) {
926 if ( path.
length() > 0 ) {
927 pReg = root_entry->
find( path );
930 return INVALID_OBJ_PATH;
934 return ( 0 == pObject ) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
945 return ( 0 == pObject ) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
960 status =
findObject( parent, objectPath, pObject );
968 return findObject( parentPath, itemToPath( item ), pObject );
974 return findObject( parentObj, itemToPath( item ), pObject );
998 if ( 0 == pRegistry ) {
999 return INVALID_OBJ_ADDR;
1002 if ( 0 == toUpdate ) {
1013 if ( 0 == toUpdate ) {
1014 return INVALID_OBJECT;
1017 if ( 0 == pRegistry ) {
1018 return INVALID_OBJECT;
1021 if ( 0 == pAddress ) {
1022 return INVALID_OBJ_ADDR;
1025 if ( 0 == pLoader ) {
1026 return NO_DATA_LOADER;
1036 status = pLoader->
updateObj( pAddress, toUpdate );
1037 if ( status.isSuccess() ) {
1043 throw GaudiException(
"std::exception in updateObject() " + pRegistry->
name() +
": " +
1081 if ( 0 != from_entry ) {
1084 if ( 0 == to_entry ) {
1085 return INVALID_OBJECT;
1088 if ( sep > 0 && sep != std::string::npos ) {
1100 return status.
isSuccess() ? IDataProviderSvc_NO_ERROR : DOUBL_OBJ_PATH;
1105 return INVALID_PARENT;
1107 return INVALID_ROOT;
1114 if ( fullPath.
length() > 0 ) {
1123 return INVALID_OBJ_PATH;
1133 return linkObject( pO->registry(), objPath, to );
1144 if ( 0 != from_entry ) {
1145 return linkObject( from_entry, objPath, to );
1148 return INVALID_PARENT;
1158 if ( 0 != from_entry ) {
1160 if ( sep > 0 && sep != std::string::npos ) {
1174 return INVALID_OBJ_PATH;
1178 return INVALID_PARENT;
1180 return INVALID_ROOT;
1186 if ( fullPath.
length() > 0 ) {
1195 return INVALID_OBJ_PATH;
1216 return INVALID_ROOT;
1262 if ( 0 != pObject && depth++ < load_depth ) {
1268 if ( status.
isSuccess() && depth < load_depth ) {
1283 int load_depth = ( *i ).depth();
1284 if ( sc.
isSuccess() && load_depth > 1 ) {
1301 error() <<
"Failed to access incident service." <<
endmsg;
1321 error() <<
"Unable to reinitialize base class" <<
endmsg;
1327 error() <<
"Failed to access incident service." <<
endmsg;
StatusCode unregisterAddress(const std::string &fullPath) override
IDataManagerSvc: Unregister object address from the data store.
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
StatusCode initialize() override
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Define general base for Gaudi exception.
StatusCode unlinkObject(IRegistry *from, const std::string &objPath) override
Remove a link to another object.
DataObject * object() const override
Retrive object behind the link.
const std::string & name() const override
Retrieve name of the service.
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
StatusCode setRoot(std::string root_name, DataObject *pRootObj) override
Initialize data store for new event by giving new event path and root object.
StatusCode finalize() override
StatusCode addPreLoadItem(const DataStoreItem &item) override
Add an item to the preload list.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
StatusCode traverseTree(IDataStoreAgent *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects in the data store.
bool isSuccess() const
Test for a status code of SUCCESS.
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Gaudi::Property< std::string > m_accessName
virtual long add(const std::string &name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
Gaudi::Property< CLID > m_rootCLID
virtual long traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
~TsDataSvc() override
Standard Destructor.
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
unsigned long release() override
IInterface implementation: Reference the object.
virtual const name_type & name() const =0
Name of the directory (or key)
StatusCode initialize() override
Service initialization.
StatusCode removePreLoadItem(const DataStoreItem &item) override
Remove an item from the preload list.
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
virtual long remove(const std::string &name)
Remove an entry from the store.
const Store & leaves() const
Access the leaves of the object.
IConversionSvc * m_dataLoader
Pointer to data loader service.
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data pro...
Data provider interface definition.
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
Description of the DataStoreItem class.
IRegistry * registry() const
Get pointer to Registry.
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
StatusCode resetPreLoad() override
Clear the preload list.
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
virtual bool isSoft() const
Is the link soft or hard.
StatusCode linkObject(IRegistry *from, const std::string &objPath, DataObject *to) override
Add a link to another object.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
virtual unsigned long addRef()
Add reference to object.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
void setObject(DataObject *obj)
Set/Update object address.
StatusCode preLoad() override
load all preload items of the list
StatusCode traverseSubTree(const std::string &sub_tree_path, IDataStoreAgent *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full pat...
IIncidentSvc * m_incidentSvc
Pointer to incident service.
virtual const id_type & identifier() const =0
Full identifier (or key)
virtual Iterator begin() const
Return starting point for container iteration.
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
This class is used for returning status codes from appropriate routines.
LoadItems m_preLoads
Items to be pre-loaded.
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
DataSvcHelpers::RegistryEntry RegEntry
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
const std::string & rootName() const override
IDataManagerSvc: Accessor for root event name.
Gaudi::Property< bool > m_enableAccessHdlr
StatusCode reinitialize() override
Service initialization.
StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
virtual bool isEmpty() const
Simple check if the Container is empty.
StatusCode reinitialize() override
unsigned int CLID
Class ID definition.
Store::const_iterator Iterator
Iterator definition.
DataObject * handleDataFault(IRegistry *pReg, const std::string &path="")
Invoke data fault handling if enabled.
virtual DataObject * object() const =0
Retrieve object behind the link.
Definition of an entry in the transient data store.
virtual unsigned long release()
release reference to object
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
StatusCode registerObject(const std::string &fullPath, DataObject *pObject) override
Register object with the data store.
StatusCode clearSubTree(const std::string &sub_tree_path) override
IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name...
virtual unsigned long release()=0
Release Interface instance.
StatusCode finalize() override
Service initialization.
virtual IRegistry * parent() const
Pointer to parent directory entry.
Generic data agent interface.
StatusCode registerAddress(const std::string &fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
virtual StatusCode i_setRoot(std::string root_name, DataObject *pRootObj)
Initialize data store for new event by giving new event path and root object.
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
bool checkRoot()
Check if root path is valid.
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
Gaudi::Property< bool > m_forceLeaves
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.
const std::string & identifier() const override
Full identifier (or key)
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Data service incident class.
StatusCode unregisterObject(const std::string &fullPath) override
Unregister object from the data store.
Opaque address interface definition.
CLID rootCLID() const override
IDataManagerSvc: Accessor for root event CLID.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
Gaudi::Property< std::vector< std::string > > m_inhibitPathes
A DataObject is the base class of any identifiable object on any data store.
#define STD_LOCK_GUARD_MACRO
#define CAST_REGENTRY(x, y)
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
virtual IRegistry * find(const IRegistry *obj) const
Try to find an object identified by its pointer.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
virtual Iterator end() const
Return end elemtn if the container.
StatusCode retrieveEntry(DataSvcHelpers::RegistryEntry *pNode, const std::string &path, DataSvcHelpers::RegistryEntry *&pEntry)
Retrieve registry entry from store.
Gaudi::Property< bool > m_enableFaultHdlr
Gaudi::Property< std::string > m_faultName
Gaudi::Property< std::string > m_rootName
void makeHard(DataObject *pObject)
Initialize link as hard link.