19 #define DATASVC_DATASVC_CPP
45 inline std::string itemToPath(
int item) {
46 std::ostringstream
path;
57 #define CAST_REGENTRY(x,y) dynamic_cast<x>(y)
61 #define ON_DEBUG if (UNLIKELY(outputLevel() <= MSG::DEBUG))
62 #define ON_VERBOSE if (UNLIKELY(outputLevel() <= MSG::VERBOSE))
64 #define DEBMSG ON_DEBUG debug()
65 #define VERMSG ON_VERBOSE verbose()
75 if ( 0 != node_entry ) {
78 parent->
remove(node_entry);
168 if ( 0 != pRootObj ) {
194 if ( 0 != pRootAddr ) {
205 if ( 0 != pDataLoader ) pDataLoader->
addRef();
207 if ( 0 != pDataLoader ) {
228 refpParent = node_entry->
parent();
238 std::vector<IRegistry*>& leaves) {
249 std::vector<IRegistry*>& leaves) {
253 leaves = node_entry->
leaves();
264 if ( fullPath.length() > 0 ) {
276 const std::string& objectPath,
284 const std::string& objPath,
287 if ( objPath.length() > 0 ) {
288 if ( 0 == parentObj ) {
292 std::string::size_type sep = objPath.find(
SEPARATOR,1);
293 if ( sep != std::string::npos ) {
294 std::string p_path (objPath, 0, sep);
296 std::string o_path (objPath, sep, objPath.length());
309 if ( 0 != par_entry ) {
310 std::string::size_type sep = objPath.rfind(
SEPARATOR);
311 if ( sep > 0 && sep != std::string::npos ) {
312 std::string p_path (objPath, 0, sep);
313 std::string o_path (objPath, sep, objPath.length());
325 p_entry = par_entry->
findLeaf(p_path);
327 if ( 0 != p_entry ) {
347 if ( fullPath.length() > 0 ) {
359 const std::string& objPath) {
366 const std::string& objPath) {
368 if ( objPath.length() > 0 ) {
369 if ( 0 == pParent ) {
373 std::string::size_type sep = objPath.find(
SEPARATOR,1);
374 if ( sep != std::string::npos ) {
375 std::string p_path (objPath, 0, sep);
377 std::string o_path (objPath, sep, objPath.length());
390 if ( 0 != node_entry ) {
392 if ( 0 != leaf_entry ) {
393 std::string::size_type sep = objPath.rfind(
SEPARATOR);
394 if ( sep > 0 && sep != std::string::npos ) {
395 std::string
path = objPath.substr(sep);
420 const std::string& objPath,
453 const std::string& objPath,
456 if ( 0 == parentObj ) {
457 if ( objPath.length() > 0 ) {
459 std::string::size_type sep = objPath.find(
SEPARATOR,1);
460 if ( sep != std::string::npos ) {
461 std::string p_path (objPath, 0, sep);
462 std::string o_path (objPath, sep, objPath.length());
473 if ( 0 != node_entry ) {
475 std::string::size_type sep = objPath.find(
SEPARATOR,1);
476 if ( sep != std::string::npos ) {
477 std::string p_path (objPath, 0, sep);
478 std::string o_path (objPath, sep, objPath.length());
488 par_entry = node_entry->
findLeaf(p_path);
490 else if ( 0 != par_entry && par_entry->object() == 0 ) {
498 par_entry = node_entry->
findLeaf(p_path);
501 node_entry = par_entry;
502 if ( 0 != node_entry ) {
512 status = node_entry->
add( objPath, pObject );
518 error() <<
"registerObject: trying to register null DataObject" <<
endmsg;
549 if ( 0 != pParent ) {
550 if ( 0 != pObject ) {
567 const std::string& objPath) {
589 if ( 0 != entry->
object() ) {
608 const std::string& objectPath) {
616 if ( 0 != entry->
object() ) {
645 if ( pReg && path.length() == 0 ) {
687 if ( 0 == pLoader ) {
691 if ( 0 == pRegistry ) {
704 const std::string& ident = pRegistry->
identifier();
705 std::vector<std::string>::iterator inhibit =
712 if ( 0 == pAddress ) {
716 status = pLoader->
createObj(pAddress, pObject);
735 catch(
const std::exception& x) {
763 const std::string&
path,
765 std::string::size_type sep = path.find(
SEPARATOR,1);
770 if ( 0 == parentObj ) {
771 if ( path.length() == 0 || path ==
m_rootName ) {
777 else if ( sep != std::string::npos ) {
785 std::string o_path (path, sep, path.length());
790 if ( sep != std::string::npos ) {
791 std::string p_path (path,0,sep);
792 std::string o_path (path,sep,path.length());
793 if (!parentObj->
object()) {
804 root_entry = parentObj->
findLeaf(p_path);
815 if ( root_entry->
isSoft() ) {
822 else if ( path.length() == 0 ) {
826 if (!parentObj->
object()) {
837 pEntry = (0==path.length()) ? parentObj : parentObj->
findLeaf(path);
844 else if ( 0 == pEntry->
object() ) {
865 const std::string&
path,
871 pObject = result->
object();
885 const std::string& objectPath,
904 const std::string&
path,
919 const std::string&
path,
924 if ( 0 != root_entry ) {
925 if ( path.length() > 0 ) {
926 pReg = root_entry->
find(path);
941 if ( path.length() == 0 || path ==
m_rootName ) {
955 const std::string& objectPath,
960 status =
findObject (parent, objectPath, pObject);
968 return findObject(parentPath, itemToPath(item), pObject);
975 return findObject(parentObj, itemToPath(item), pObject);
980 const std::string&
path,
998 if ( 0 == pRegistry ) {
1002 if ( 0 == toUpdate ) {
1011 if ( 0 == toUpdate ) {
1015 if ( 0 == pRegistry ) {
1019 if ( 0 == pAddress ) {
1023 if ( 0 == pLoader ) {
1027 const std::string& ident = pRegistry->
identifier();
1028 std::vector<std::string>::iterator inhibit =
1035 status = pLoader->
updateObj(pAddress, toUpdate);
1046 catch(
const std::exception& x) {
1048 pRegistry->
name() +
": " +
1063 const std::string& updatePath) {
1074 const std::string& updatePath) {
1085 const std::string& objPath,
DataObject* to) {
1089 if ( 0 != from_entry ) {
1092 if ( 0 == to_entry ) {
1096 std::string::size_type sep = objPath.rfind(
SEPARATOR);
1097 if ( sep > 0 && sep != std::string::npos ) {
1099 std::string fromPath(objPath, 0, sep);
1102 std::string toPath(objPath, sep, objPath.length());
1124 if ( fullPath.length() > 0 ) {
1128 std::string::size_type sep = fullPath.rfind(
SEPARATOR);
1129 std::string objPath(fullPath, sep, fullPath.length());
1130 std::string fromPath(fullPath, 0, sep);
1138 const std::string& objPath,
1150 const std::string& objPath,
1154 if ( 0 != from_entry ) {
1163 const std::string& objPath) {
1167 if ( 0 != from_entry ) {
1168 std::string::size_type sep = objPath.rfind(
SEPARATOR);
1169 if ( sep > 0 && sep != std::string::npos ) {
1171 std::string fromPath(objPath, 0, sep);
1174 std::string toPath(objPath, sep, objPath.length());
1195 if ( fullPath.length() > 0 ) {
1199 std::string::size_type sep = fullPath.rfind(
SEPARATOR);
1200 std::string objPath(fullPath, sep, fullPath.length());
1201 std::string fromPath(fullPath, 0, sep);
1209 const std::string& objPath) {
1220 const std::string& objPath) {
1244 LoadItems::iterator
i =
1266 if ( 0 != pObject && depth++ < load_depth ) {
1272 if ( status.
isSuccess() && depth < load_depth ) {
1286 int load_depth = (*i).depth();
1287 if ( sc.
isSuccess() && load_depth > 1 ) {
1303 error() <<
"Failed to access incident service." <<
endmsg;
1322 error() <<
"Unable to reinitialize base class" <<
endmsg;
1328 error() <<
"Failed to access incident service." <<
endmsg;
1373 m_rootName(
"/Event"), m_root(0)
RegistryEntry * findLeaf(const std::string &path) const
Find identified leaf in this registry node.
virtual StatusCode setDataLoader(IConversionSvc *svc)
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service.
virtual StatusCode reinitialize()
Service initialization.
The path for this objects is already in use.
bool m_enableAccessHdlr
Flag to enable interrupts on data access requests.
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
virtual StatusCode findObject(const std::string &fullPath, DataObject *&pObject)
Find object identified by its full path in the data store.
virtual StatusCode removePreLoadItem(const DataStoreItem &item)
Remove an item from the preload list.
virtual StatusCode registerObject(const std::string &fullPath, DataObject *pObject)
Register object with the data store.
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
virtual StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves)
IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
bool m_enableFaultHdlr
Flag to enable interrupts on data creation requests.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Invalid root path object cannot be retrieved or stored.
Normal successful completion.
bool isSuccess() const
Test for a status code of SUCCESS.
No data loader available.
Sorry, the requested object is not loaded.
virtual long add(const std::string &name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
std::string m_rootName
Name of root event.
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)
IDataManagerSvc: Analyze by traversing all data objects in the data store.
virtual StatusCode updateObject(IRegistry *pDirectory)
Update object identified by its directory entry.
virtual StatusCode resetPreLoad()
Clear the preload list.
virtual long traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Access to the requested leaf is inhibited.
LoadItems m_preLoads
Items to be pre-loaded.
std::string m_accessName
Name of the data access incident.
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
virtual const name_type & name() const =0
Name of the directory (or key)
virtual StatusCode i_setRoot(const std::string &root_name, DataObject *pRootObj)
Initialize data store for new event by giving new event path and root object.
DataSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
bool checkRoot()
Check if root path is valid.
virtual long remove(const std::string &name)
Remove an entry from the store.
const Store & leaves() const
Access the leaves of the object.
virtual StatusCode preLoad()
load all preload items of the list
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
virtual StatusCode registerAddress(const std::string &fullPath, IOpaqueAddress *pAddress)
IDataManagerSvc: Register object address with the data store.
virtual unsigned long release()
IInterface implementation: Reference the object.
Description of the DataStoreItem class.
IRegistry * registry() const
Get pointer to Registry.
IIncidentSvc * m_incidentSvc
Pointer to incident service.
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
IConversionSvc * m_dataLoader
Pointer to data loader service.
virtual StatusCode setRoot(const std::string &root_name, DataObject *pRootObj)
Initialize data store for new event by giving new event path and root object.
Directory entry is NOT empty.
virtual bool isSoft() const
Is the link soft or hard.
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.
virtual Iterator begin() const
Return starting point for container iteration.
DataSvcHelpers::InhibitMap * m_inhibitMap
Map with object paths to be inhibited from loading.
This class is used for returning status codes from appropriate routines.
StatusCode retrieveEntry(DataSvcHelpers::RegistryEntry *pNode, const std::string &path, DataSvcHelpers::RegistryEntry *&pEntry)
Retrieve registry entry from store.
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
virtual StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent)
IDataManagerSvc: Explore the object store: retrieve the object's parent.
virtual bool isEmpty() const
Simple check if the Container is empty.
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)
Retrieve object from data store.
unsigned int CLID
Class ID definition.
Store::const_iterator Iterator
Iterator definition.
bool m_forceLeaves
Allow forced creation of default leaves on registerObject.
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
void setAddress(IOpaqueAddress *pAddress)
Set/Update Opaque address.
virtual DataObject * object() const =0
Retrieve object behind the link.
#define CAST_REGENTRY(x, y)
virtual const std::string & name() const
Retrieve name of the service.
virtual StatusCode initialize()
Service initialization.
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
virtual StatusCode linkObject(IRegistry *from, const std::string &objPath, DataObject *to)
Add a link to another object.
Definition of an entry in the transient data store.
virtual StatusCode reinitialize()
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
virtual unsigned long release()
release reference to object
std::string m_faultName
Name of the data fault incident.
virtual const std::string & identifier() const
Full identifier (or key)
DataObject * handleDataFault(IRegistry *pReg, const std::string &path="")
Invoke data fault handling if enabled.
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
Pointer to parent object is not valid.
virtual unsigned long release()=0
Release Interface instance.
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
virtual IRegistry * parent() const
Pointer to parent directory entry.
Generic data agent interface.
virtual StatusCode clearStore()
IDataManagerSvc: Remove all data objects in the data store.
virtual StatusCode unregisterObject(const std::string &fullPath)
Unregister object from the data store.
Object pointer is invalid.
virtual StatusCode unlinkObject(IRegistry *from, const std::string &objPath)
Remove a link to another object.
Templated class to add the standard messaging functionalities.
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
virtual StatusCode clearSubTree(const std::string &sub_tree_path)
IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name...
std::vector< std::string > m_inhibitPathes
Property for the inhibited leaves.
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
virtual ~DataSvc()
Standard Destructor.
CLID m_rootCLID
Integer Property corresponding to CLID of root entry.
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.
virtual StatusCode unregisterAddress(const std::string &fullPath)
IDataManagerSvc: Unregister object address from the data store.
virtual StatusCode traverseSubTree(const std::string &sub_tree_path, IDataStoreAgent *pAgent)
IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full pat...
virtual const id_type & identifier() const =0
Full identifier (or key)
Invalid path from root to object request failed.
Data service incident class.
virtual DataObject * object() const
Retrive object behind the link.
Opaque address interface definition.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
A DataObject is the base class of any identifiable object on any data store.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
virtual StatusCode finalize()
Service initialization.
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
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.
virtual std::string rootName() const
IDataManagerSvc: Accessor for root event name.
DataSvcHelpers::RegistryEntry RegEntry
virtual StatusCode addPreLoadItem(const DataStoreItem &item)
Add an item to the preload list.
virtual CLID rootCLID() const
IDataManagerSvc: Accessor for root event CLID.
void makeHard(DataObject *pObject)
Initialize link as hard link.