20 #define TSDATASVC_DATASVC_CPP 46 #define STD_LOCK_GUARD_MACRO std::lock_guard<tsDataSvcMutex> lock(m_accessMutex); 64 #define CAST_REGENTRY(x,y) dynamic_cast<x>(y) 68 #define ON_DEBUG if (msgLevel(MSG::DEBUG)) 69 #define ON_VERBOSE if (msgLevel(MSG::VERBOSE)) 71 #define DEBMSG ON_DEBUG debug() 72 #define VERMSG ON_VERBOSE verbose() 82 if ( 0 != node_entry ) {
85 parent->
remove(node_entry);
88 return INVALID_PARENT;
90 return INVALID_OBJECT;
107 return INVALID_PARENT;
109 return INVALID_OBJECT;
147 return INVALID_OBJECT;
178 if ( 0 != pRootObj ) {
204 if ( 0 != pRootAddr ) {
215 if ( 0 != pDataLoader ) pDataLoader->
addRef();
217 if ( 0 != pDataLoader ) {
231 return INVALID_OBJECT;
240 refpParent = node_entry->
parent();
243 return INVALID_OBJECT;
255 return INVALID_OBJECT;
271 return INVALID_OBJECT;
279 if ( fullPath.
length() > 0 ) {
286 return INVALID_OBJ_PATH;
302 if ( objPath.
length() > 0 ) {
303 if ( 0 == parentObj ) {
308 if ( sep != std::string::npos ) {
315 return INVALID_PARENT;
324 if ( 0 != par_entry ) {
326 if ( sep > 0 && sep != std::string::npos ) {
340 p_entry = par_entry->
findLeaf(p_path);
342 if ( 0 != p_entry ) {
345 return INVALID_PARENT;
351 return DOUBL_OBJ_PATH;
353 return INVALID_PARENT;
355 return INVALID_OBJ_PATH;
362 if ( fullPath.
length() > 0 ) {
369 return INVALID_OBJ_PATH;
383 if ( objPath.
length() > 0 ) {
384 if ( 0 == pParent ) {
389 if ( sep != std::string::npos ) {
396 return INVALID_PARENT;
405 if ( 0 != node_entry ) {
407 if ( 0 != leaf_entry ) {
409 if ( sep > 0 && sep != std::string::npos ) {
414 if ( status.isSuccess() ) {
419 return INVALID_PARENT;
421 return INVALID_OBJ_PATH;
471 if ( 0 == parentObj ) {
472 if ( objPath.
length() > 0 ) {
475 if ( sep != std::string::npos ) {
485 return INVALID_OBJ_PATH;
488 if ( 0 != node_entry ) {
491 if ( sep != std::string::npos ) {
503 par_entry = node_entry->
findLeaf(p_path);
505 else if ( 0 != par_entry && par_entry->object() == 0 ) {
513 par_entry = node_entry->
findLeaf(p_path);
516 node_entry = par_entry;
517 if ( 0 != node_entry ) {
527 status = node_entry->
add( objPath, pObject );
533 error() <<
"registerObject: trying to register null DataObject" <<
endmsg;
544 status = DOUBL_OBJ_PATH;
550 return INVALID_PARENT;
564 if ( 0 != pParent ) {
565 if ( 0 != pObject ) {
571 return INVALID_PARENT;
573 return DIR_NOT_EMPTY;
604 if ( 0 != entry->
object() ) {
612 return INVALID_PARENT;
614 return DIR_NOT_EMPTY;
616 return INVALID_OBJECT;
631 if ( 0 != entry->
object() ) {
637 return DIR_NOT_EMPTY;
639 return INVALID_OBJECT;
644 return INVALID_PARENT;
660 if ( pReg && path.
length() == 0 ) {
703 if ( 0 == pLoader ) {
705 else return NO_DATA_LOADER;
707 if ( 0 == pRegistry ) {
709 else return INVALID_OBJ_ADDR;
728 if ( 0 == pAddress ) {
729 return INVALID_OBJ_ADDR;
732 status = pLoader->
createObj(pAddress, pObject);
733 if ( status.isSuccess() ) {
766 if ( !status.isSuccess() ) {
787 if ( 0 == parentObj ) {
794 else if ( sep != std::string::npos ) {
805 return INVALID_OBJ_PATH;
807 if ( sep != std::string::npos ) {
810 if (!parentObj->
object()) {
821 root_entry = parentObj->
findLeaf(p_path);
832 if ( root_entry->
isSoft() ) {
839 else if ( path.
length() == 0 ) {
843 if (!parentObj->
object()) {
854 pEntry = (0==path.
length()) ? parentObj : parentObj->
findLeaf(path);
859 status = INVALID_OBJ_PATH;
861 else if ( 0 == pEntry->
object() ) {
889 pObject = result->
object();
943 if ( 0 != root_entry ) {
944 if ( path.
length() > 0 ) {
945 pReg = root_entry->
find(path);
948 return INVALID_OBJ_PATH;
952 return (0 == pObject) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
963 return (0 == pObject) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
980 status =
findObject (parent, objectPath, pObject);
988 return findObject(parentPath, itemToPath(item), pObject);
995 return findObject(parentObj, itemToPath(item), pObject);
1018 if ( 0 == pRegistry ) {
1019 return INVALID_OBJ_ADDR;
1022 if ( 0 == toUpdate ) {
1032 if ( 0 == toUpdate ) {
1033 return INVALID_OBJECT;
1036 if ( 0 == pRegistry ) {
1037 return INVALID_OBJECT;
1040 if ( 0 == pAddress ) {
1041 return INVALID_OBJ_ADDR;
1044 if ( 0 == pLoader ) {
1045 return NO_DATA_LOADER;
1056 status = pLoader->
updateObj(pAddress, toUpdate);
1057 if ( status.isSuccess() ) {
1069 pRegistry->
name() +
": " +
1111 if ( 0 != from_entry ) {
1114 if ( 0 == to_entry ) {
1115 return INVALID_OBJECT;
1119 if ( sep > 0 && sep != std::string::npos ) {
1132 IDataProviderSvc_NO_ERROR : DOUBL_OBJ_PATH;
1138 return INVALID_PARENT;
1140 return INVALID_ROOT;
1147 if ( fullPath.
length() > 0 ) {
1156 return INVALID_OBJ_PATH;
1167 return linkObject(pO->registry(), objPath, to);
1179 if ( 0 != from_entry ) {
1183 return INVALID_PARENT;
1193 if ( 0 != from_entry ) {
1195 if ( sep > 0 && sep != std::string::npos ) {
1209 return INVALID_OBJ_PATH;
1214 return INVALID_PARENT;
1216 return INVALID_ROOT;
1221 if ( fullPath.
length() > 0 ) {
1230 return INVALID_OBJ_PATH;
1251 return INVALID_ROOT;
1270 LoadItems::iterator i =
1292 if ( 0 != pObject && depth++ < load_depth ) {
1298 if ( status.
isSuccess() && depth < load_depth ) {
1312 int load_depth = (*i).depth();
1313 if ( sc.
isSuccess() && load_depth > 1 ) {
1329 error() <<
"Failed to access incident service." <<
endmsg;
1348 error() <<
"Unable to reinitialize base class" <<
endmsg;
1354 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.