All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DataSvc.cpp
Go to the documentation of this file.
1 //====================================================================
2 // DataSvc.cpp
3 //--------------------------------------------------------------------
4 //
5 // Package : System ( The LHCb Offline System)
6 //
7 // Description: implementation of the Transient data service: DataSvc
8 //
9 // Author : M.Frank
10 // History :
11 // +---------+----------------------------------------------+---------
12 // | Date | Comment | Who
13 // +---------+----------------------------------------------+---------
14 // | 29/10/98| Initial version | M.Frank
15 // | 20/2/99 | Automatic data preloading introduced. | M.Frank
16 // +---------+----------------------------------------------+---------
17 //
18 //====================================================================
19 #define DATASVC_DATASVC_CPP
20 
21 // Framework include files
22 #include "GaudiKernel/IConverter.h"
25 
26 #include "GaudiKernel/xtoa.h"
27 #include "GaudiKernel/DataObject.h"
29 
31 #include "GaudiKernel/DataSvc.h"
34 
35 // Include files
36 #include <cassert>
37 #include <cstdlib>
38 #include <vector>
39 #include <algorithm>
40 #include <sstream>
41 
42 #include "boost/utility/string_ref.hpp"
43 
44 
45 namespace {
48  inline std::string itemToPath(int item) {
49  return std::string{'/'} + std::to_string(item);
50  }
51 
52  inline boost::string_ref::size_type find( boost::string_ref s, char c, size_t o ) {
53  if (!s.empty()) s.remove_prefix(o);
54  auto r = s.find(c);
55  return r==boost::string_ref::npos ? r : ( r + o ) ;
56  }
57 }
58 
59 // If you absolutely need optimization: switch off dynamic_cast.
60 // This improves access to the data store roughly by 10 %
61 // for balanced trees.
62 //
63 // M.Frank
64 #define CAST_REGENTRY(x,y) dynamic_cast<x>(y)
65 //#define CAST_REGENTRY(x,y) (x)(y)
67 
68 #define ON_DEBUG if (UNLIKELY(outputLevel() <= MSG::DEBUG))
69 #define ON_VERBOSE if (UNLIKELY(outputLevel() <= MSG::VERBOSE))
70 
71 #define DEBMSG ON_DEBUG debug()
72 #define VERMSG ON_VERBOSE verbose()
73 
77 StatusCode DataSvc::clearSubTree(const std::string& sub_tree_path) {
78  DataObject* pObject = nullptr;
79  StatusCode status = findObject(sub_tree_path, pObject);
80  if ( status.isSuccess() ) {
81  RegEntry* node_entry = CAST_REGENTRY(RegEntry*,pObject->registry());
82  if ( node_entry ) {
83  RegEntry* parent = node_entry->parentEntry();
84  if ( parent ) {
85  parent->remove(node_entry);
86  return StatusCode::SUCCESS;
87  }
88  return INVALID_PARENT;
89  }
90  return INVALID_OBJECT;
91  }
92  return status;
93 }
94 
99  if ( checkRoot() ) {
100  RegEntry* entry = CAST_REGENTRY(RegEntry*,pObject->registry());
101  if ( entry ) {
102  RegEntry* parent = entry->parentEntry();
103  if ( parent ) {
104  parent->remove(entry);
105  return SUCCESS;
106  }
107  return INVALID_PARENT;
108  }
109  return INVALID_OBJECT;
110  }
111  return INVALID_ROOT;
112 }
113 
116  if ( checkRoot() ) {
117  m_root->release();
118  m_root = nullptr;
119  return SUCCESS;
120  }
121  return INVALID_ROOT;
122 }
123 
127 StatusCode DataSvc::traverseSubTree (const std::string& sub_tree_path,
128  IDataStoreAgent* pAgent) {
129  DataObject* pO = nullptr;
130  StatusCode status = findObject(sub_tree_path, pO);
131  if ( status.isFailure() ) return status;
132  return traverseSubTree(pO, pAgent);
133 }
134 
137  IDataStoreAgent* pAgent ) {
138  if ( !checkRoot() ) return INVALID_ROOT;
139  RegEntry* entry = CAST_REGENTRY(RegEntry*,pObject->registry());
140  if ( !entry ) return INVALID_OBJECT;
141  return entry->traverseTree(pAgent);
142 }
143 
146  if ( !checkRoot() ) return INVALID_ROOT;
147  return m_root->traverseTree(pAgent);
148 }
149 
154 StatusCode DataSvc::setRoot(const std::string& root_path,
155  DataObject* pRootObj) {
156  clearStore().ignore();
157  return i_setRoot (root_path, pRootObj);
158 }
159 
165 StatusCode DataSvc::i_setRoot(const std::string& root_path,
166  DataObject* pRootObj) {
167  if ( pRootObj ) {
168  m_root = new RegEntry(root_path);
169  m_root->makeHard(pRootObj);
170  m_root->setDataSvc(this);
171  preLoad().ignore();
172  }
173  return SUCCESS;
174 }
175 
180 StatusCode DataSvc::setRoot(const std::string& root_path,
181  IOpaqueAddress* pRootAddr) {
182  clearStore().ignore();
183  return i_setRoot (root_path, pRootAddr);
184 }
185 
191 StatusCode DataSvc::i_setRoot(const std::string& root_path,
192  IOpaqueAddress* pRootAddr) {
193  if ( pRootAddr ) {
194  m_root = new RegEntry(root_path);
195  m_root->makeHard(pRootAddr);
196  m_root->setDataSvc(this);
197  preLoad().ignore();
198  }
199  return SUCCESS;
200 }
201 
204  if ( pDataLoader ) pDataLoader->addRef();
206  if ( pDataLoader ) {
207  pDataLoader->setDataProvider(this).ignore();
208  }
209  m_dataLoader = pDataLoader;
210  return SUCCESS;
211 }
212 
215  IRegistry*& refpParent) {
216  if ( !pObject ) return INVALID_OBJECT;
217  return objectParent(pObject->registry(), refpParent);
218 }
221  IRegistry*& refpParent) {
222  if ( !checkRoot() ) return INVALID_ROOT;
223  const RegEntry* node_entry = CAST_REGENTRY(const RegEntry*,pRegistry);
224  if ( !node_entry ) return INVALID_OBJECT;
225  refpParent = node_entry->parent();
226  return StatusCode::SUCCESS;
227 }
228 
231  std::vector<IRegistry*>& leaves) {
232  if ( !pObject ) return INVALID_OBJECT;
233  return objectLeaves(pObject->registry(), leaves);
234 }
235 
240  std::vector<IRegistry*>& leaves) {
241  if ( !checkRoot() ) return INVALID_ROOT;
242  const RegEntry* node_entry = CAST_REGENTRY(const RegEntry*,pRegistry);
243  if ( !node_entry ) return INVALID_OBJECT;
244  leaves = node_entry->leaves();
245  return StatusCode::SUCCESS;
246 }
247 
249 StatusCode DataSvc::registerAddress(const std::string& fullPath,
250  IOpaqueAddress* pAddress) {
251  if ( fullPath.empty() ) return INVALID_OBJ_PATH;
252  return registerAddress( fullPath.front() != SEPARATOR ? m_root : nullptr,
253  fullPath, pAddress);
254 }
255 
258  const std::string& objectPath,
259  IOpaqueAddress* pAddress) {
260  IRegistry* pRegistry = ( parentObj ? parentObj->registry() : nullptr );
261  return registerAddress(pRegistry, objectPath, pAddress);
262 }
263 
266  const std::string& objPath,
267  IOpaqueAddress* pAddress) {
268  if ( !checkRoot() ) return INVALID_ROOT;
269  if ( objPath.empty() ) return INVALID_OBJ_PATH;
270 
271  if ( !parentObj ) {
272  if ( objPath.front() != SEPARATOR ) {
273  return registerAddress(m_root, objPath, pAddress);
274  }
275  std::string::size_type sep = objPath.find(SEPARATOR,1);
276  if ( sep == std::string::npos ) {
277  return INVALID_PARENT;
278  }
279  if ( objPath.compare(0,sep,m_rootName) == 0 ) {
280  return registerAddress(m_root, objPath.substr(sep), pAddress);
281  }
282  }
283  if ( objPath.front() != SEPARATOR ) {
284  return registerAddress(parentObj, char(SEPARATOR)+objPath, pAddress);
285  }
286  RegEntry* par_entry = CAST_REGENTRY(RegEntry*,parentObj);
287  if ( !par_entry ) return INVALID_PARENT;
288 
289  std::string::size_type sep = objPath.rfind(SEPARATOR);
290  if ( sep > 0 && sep != std::string::npos ) {
291  auto p_path = objPath.substr( 0, sep);
292  auto o_path = objPath.substr( sep );
293  RegEntry* p_entry = par_entry->findLeaf(p_path);
294  // Create default object leafs if the
295  // intermediate nodes are not present
296  if ( 0 == p_entry && m_forceLeaves ) {
297  DataObject *pLeaf = createDefaultObject();
298  StatusCode sc = registerObject(par_entry->identifier(),
299  p_path,
300  pLeaf);
301  if ( sc.isFailure() ) delete pLeaf;
302  p_entry = par_entry->findLeaf(p_path);
303  }
304  if ( !p_entry ) return INVALID_PARENT;
305  return registerAddress(p_entry, o_path, pAddress);
306  }
307  StatusCode status = par_entry->add(objPath, pAddress);
308  return status.isSuccess() ? status : DOUBL_OBJ_PATH;
309 }
310 
312 StatusCode DataSvc::unregisterAddress(const std::string& fullPath) {
313  if ( fullPath.empty() ) return INVALID_OBJ_PATH;
314  return unregisterAddress( fullPath.front() != SEPARATOR ? m_root : nullptr,
315  fullPath );
316 }
317 
320  const std::string& objPath) {
321  return unregisterAddress( pParent ? pParent->registry() : nullptr,
322  objPath);
323 }
324 
327  const std::string& objPath) {
328  if ( !checkRoot() ) return INVALID_ROOT;
329  if ( objPath.empty() ) return INVALID_OBJ_PATH;
330 
331  if ( !pParent ) {
332  if ( objPath.front() != SEPARATOR ) {
333  return unregisterAddress(m_root, objPath);
334  }
335  std::string::size_type sep = objPath.find(SEPARATOR,1);
336  if ( sep != std::string::npos &&
337  objPath.compare( 0, sep, m_rootName) == 0 ) {
338  return unregisterAddress(m_root, objPath.substr(sep));
339  }
340  return INVALID_PARENT;
341  }
342  if ( objPath.front() != SEPARATOR ) {
343  return unregisterAddress(pParent, char(SEPARATOR)+objPath);
344  }
345  RegEntry* node_entry = CAST_REGENTRY(RegEntry*,pParent);
346  if ( node_entry ) {
347  RegEntry* leaf_entry = node_entry->findLeaf(objPath);
348  if ( leaf_entry ) {
349  std::string::size_type sep = objPath.rfind(SEPARATOR);
350  if ( sep > 0 && sep != std::string::npos ) {
351  return unregisterAddress(leaf_entry->parent(), objPath.substr(sep));
352  }
353  StatusCode status = node_entry->remove(objPath);
354  if ( status.isSuccess() ) return status;
355  }
356  }
357  return INVALID_PARENT;
358 }
359 
361 StatusCode DataSvc::registerObject (const std::string& fullPath,
362  DataObject* pObject) {
363  return registerObject(nullptr, fullPath, pObject);
364 }
365 
366 
368 StatusCode DataSvc::registerObject (const std::string& parentPath,
369  const std::string& objPath,
370  DataObject* pObject) {
371  DataObject* pO = nullptr;
372  StatusCode status = retrieveObject(parentPath, pO);
373  if ( !status.isSuccess() && m_forceLeaves ) {
374  pO = createDefaultObject();
375  status = registerObject(parentPath, pO);
376  if ( !status.isSuccess() ) pO->release();
377  }
378  if ( status.isFailure() ) return status;
379  return registerObject(pO, objPath, pObject);
380 }
381 
383 StatusCode DataSvc::registerObject(const std::string& parentPath,
384  int item,
385  DataObject* pObject) {
386  return registerObject(parentPath, itemToPath(item), pObject);
387 }
388 
391  int item,
392  DataObject* pObject) {
393  return registerObject(parentObj, itemToPath(item), pObject);
394 }
395 
398  const std::string& objPath,
399  DataObject* pObject) {
400  if ( !checkRoot() ) return INVALID_ROOT;
401 
402  if ( !parentObj ) {
403  if ( !objPath.empty() ) {
404  if ( objPath.front() == SEPARATOR ) {
405  std::string::size_type sep = objPath.find(SEPARATOR,1);
406  if ( sep != std::string::npos ) {
407  return registerObject(objPath.substr( 0, sep), objPath.substr( sep ), pObject);
408  }
409  }
410  else {
411  return registerObject(m_rootName, objPath, pObject);
412  }
413  }
414  return INVALID_OBJ_PATH;
415  }
416  RegEntry* node_entry = CAST_REGENTRY(RegEntry*,parentObj->registry());
417  if ( node_entry ) {
418  StatusCode status = INVALID_PARENT;
419  std::string::size_type sep = objPath.find(SEPARATOR,1);
420  if ( sep != std::string::npos ) {
421  auto p_path = objPath.substr( 0, sep );
422  auto o_path = objPath.substr( sep );
423  RegEntry* par_entry = node_entry->findLeaf(p_path);
424  // Create default object leafs if the
425  // intermediate nodes are not present
426  if ( 0 == par_entry && m_forceLeaves ) {
427  DataObject *pLeaf = createDefaultObject();
428  StatusCode sc = registerObject(parentObj, p_path, pLeaf);
429  if ( ! sc.isSuccess() ) {
430  delete pLeaf;
431  }
432  par_entry = node_entry->findLeaf(p_path);
433  }
434  else if ( 0 != par_entry && par_entry->object() == 0 ) {
435  status = i_retrieveEntry( node_entry, p_path, par_entry);
436  if ( !status.isSuccess() && !par_entry->address() && m_forceLeaves ) {
437  DataObject *pLeaf = createDefaultObject();
438  StatusCode sc = registerObject(parentObj, p_path, pLeaf);
439  if ( ! sc.isSuccess() ) {
440  delete pLeaf;
441  }
442  par_entry = node_entry->findLeaf(p_path);
443  }
444  }
445  node_entry = par_entry;
446  if ( node_entry ) {
447  DataObject* obj = node_entry->object();
448  if ( obj ) {
449  status = registerObject( obj, o_path, pObject );
450  }
451  }
452  }
453  else {
454  RegEntry* leaf = node_entry->findLeaf(objPath);
455  if ( !leaf ) {
456  status = node_entry->add( objPath, pObject );
457  }
458  else {
459  DataObject* obj = leaf->object();
460  if ( !obj ) {
461  if ( !pObject ) {
462  error() << "registerObject: trying to register null DataObject" << endmsg;
463  return StatusCode::FAILURE;
464  }
465  else {
466  pObject->setRegistry(leaf);
467  }
468  leaf->setAddress(0);
469  leaf->setObject(pObject);
470  status = StatusCode::SUCCESS;
471  }
472  else {
473  status = DOUBL_OBJ_PATH;
474  }
475  }
476  }
477  return status;
478  }
479  return INVALID_PARENT;
480 }
481 
483 StatusCode DataSvc::unregisterObject(const std::string& fullPath) {
484  DataObject* pObject = nullptr;
485  StatusCode status = findObject(fullPath, pObject);
486  if ( status.isFailure() ) return status;
487  RegEntry* pEntry = CAST_REGENTRY(RegEntry*,pObject->registry());
488  if ( !pEntry ) return INVALID_ROOT;
489 
490  if ( !pEntry->isEmpty() ) return DIR_NOT_EMPTY;
491 
492  RegEntry* pParent = pEntry->parentEntry();
493  if ( !pParent ) return INVALID_PARENT;
494 
495  if ( pObject ) pObject->addRef();
496  pParent->remove(pEntry);
497  return StatusCode::SUCCESS;
498 }
499 
501 StatusCode DataSvc::unregisterObject(const std::string& parentPath,
502  const std::string& objPath) {
503  DataObject* pO = nullptr;
504  StatusCode status = findObject(parentPath, pO);
505  if ( status.isFailure() ) return status;
506  return unregisterObject(pO, objPath);
507 }
508 
510 StatusCode DataSvc::unregisterObject(const std::string& parentPath, int item) {
511  return unregisterObject(parentPath, itemToPath(item));
512 }
513 
516  if ( !checkRoot() ) return INVALID_ROOT;
517  RegEntry* entry = m_root->findLeaf(pObject);
518  if ( !entry ) return INVALID_OBJECT;
519  RegEntry* parent = entry->parentEntry();
520  if ( !parent ) return INVALID_PARENT;
521  if ( !entry->isEmpty() ) return DIR_NOT_EMPTY;
522  if ( entry->object() ) entry->object()->addRef();
523  if ( parent ) parent->remove(entry);
524  return SUCCESS;
525 }
526 
529  const std::string& objectPath) {
530  if ( checkRoot() ) {
531  try {
532  RegEntry* parent = CAST_REGENTRY(RegEntry*,pParentObj->registry());
533  if ( parent ) {
534  RegEntry* entry = parent->findLeaf(objectPath);
535  if ( entry ) {
536  if ( entry->isEmpty() ) {
537  if ( entry->object() ) {
538  entry->object()->addRef();
539  }
540  parent->remove(entry);
541  return SUCCESS;
542  }
543  return DIR_NOT_EMPTY;
544  }
545  return INVALID_OBJECT;
546  }
547  }
548  catch(...) {
549  }
550  return INVALID_PARENT;
551  }
552  return INVALID_ROOT;
553 }
554 
557  return unregisterObject(pParentObj, itemToPath(item));
558 }
559 
562 DataObject* DataSvc::handleDataFault(IRegistry* pReg, const std::string& path) {
563  return i_handleDataFault(pReg,path);
564 }
565 
567 {
568  if ( m_enableFaultHdlr ) {
569  IRegistry* pLeaf = nullptr;
570  if ( pReg && path.empty() ) {
571  DataIncident incident(name(), m_faultName, pReg->identifier());
572  m_incidentSvc->fireIncident(incident);
573  return pReg->object();
574  }
575  else if ( pReg ) {
576  std::string p = pReg->identifier();
577  if (path.front() != SEPARATOR ) p += SEPARATOR;
578  p.append(path.data(),path.size());
579  DataIncident incident(name(), m_faultName, p);
580  m_incidentSvc->fireIncident(incident);
581  pLeaf = m_root->findLeaf(p);
582  }
583  else {
584  std::string p = m_root->identifier();
585  if (path.front() != SEPARATOR ) p += SEPARATOR;
586  p.append(path.data(),path.size());
587  DataIncident incident(name(), m_faultName, p);
588  m_incidentSvc->fireIncident(incident);
589  pLeaf = m_root->findLeaf(p);
590  }
591  if ( pLeaf ) {
592  return pLeaf->object();
593  }
594  }
595  return nullptr;
596 }
597 
602  IConversionSvc* pLoader = getDataLoader(pRegistry);
603  return loadObject(pLoader, pRegistry);
604 }
605 
610  StatusCode status = INVALID_OBJ_ADDR;
611  DataObject* pObject = nullptr;
612  if ( !pLoader ) { // Precondition: Data loader must be present
613  if (handleDataFault(pRegistry)) return SUCCESS;
614  else return NO_DATA_LOADER;
615  }
616  if ( !pRegistry ) { // Precondition: Directory must be valid
617  if (handleDataFault(pRegistry)) return SUCCESS;
618  else return INVALID_OBJ_ADDR;
619  }
620 
621  VERMSG << "Requested object " << pRegistry->identifier() << endmsg;
622 
623  if ( m_enableAccessHdlr ) {
624  // Fire data access incident
625  DataIncident incident(name(), m_accessName, pRegistry->identifier());
626  m_incidentSvc->fireIncident(incident);
627  }
628  if ( !m_inhibitPathes.empty() ) {
629  auto inhibit = std::find(m_inhibitPathes.begin(), m_inhibitPathes.end(),
630  pRegistry->identifier());
631  if ( inhibit != m_inhibitPathes.end() ) {
632  return NO_ACCESS;
633  }
634  }
635  IOpaqueAddress* pAddress = pRegistry->address();
636  if ( !pAddress ) { // Precondition:
637  return INVALID_OBJ_ADDR; // Address must be valid
638  }
639  try {
640  status = pLoader->createObj(pAddress, pObject); // Call data loader
641  if ( status.isSuccess() ) {
642 
643  VERMSG << "Object " << pRegistry->identifier() << " created" << endmsg;
644 
645  RegEntry *pEntry = CAST_REGENTRY(RegEntry*,pRegistry);
646  pEntry->setObject(pObject);
647 
648  VERMSG << "Filling object " << pRegistry->identifier() << endmsg;
649  status = pLoader->fillObjRefs(pAddress, pObject);
650  }
651  }
652  catch( const GaudiException& exc ) {
653  if ( handleDataFault(pRegistry) ) {
654  return SUCCESS;
655  }
656  throw GaudiException("GaudiException in loadObject() " + pRegistry->identifier(),
657  name(), StatusCode::FAILURE, exc);
658  }
659  catch( const std::exception& x) {
660  if ( handleDataFault(pRegistry) ) {
661  return SUCCESS;
662  }
663  throw GaudiException("std::exception in loadObject() " + pRegistry->identifier() +
664  ": " + System::typeinfoName(typeid(x)) + ", " + x.what(),
666  }
667  catch(...) {
668  if ( handleDataFault(pRegistry) ) {
669  return SUCCESS;
670  }
671  throw GaudiException("UNKN exception in loadObject() " + pRegistry->identifier(),
673  }
674  if ( !status.isSuccess() ) {
675  if ( handleDataFault(pRegistry) ) {
676  return StatusCode::SUCCESS;
677  }
678  }
679  ON_VERBOSE if ( status.isSuccess() ) {
680  verbose() << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
681  }
682  return status;
683 }
684 
687  const std::string& path,
688  RegEntry*& pEntry) {
689  return i_retrieveEntry(parentObj,path,pEntry);
690 }
691 
693  boost::string_ref path,
694  RegEntry*& pEntry) {
695  // A.Valassi 16.08.2001 avoid core dump if store is empty
696  if ( !checkRoot() ) return StatusCode(INVALID_ROOT,true);
697 
698  static const auto empty = boost::string_ref{};
699  auto sep = find(path,SEPARATOR,1);
700  pEntry = nullptr;
701 
702  if ( !parentObj ) {
703  if ( path.empty() || path == m_rootName ) {
704  parentObj = m_root;
705  path = empty;
706  } else if ( path.front() != SEPARATOR ) {
707  parentObj = m_root;
708  } else if ( sep != boost::string_ref::npos ) {
709  if ( !m_root->object() ) {
710  RegEntry* r = nullptr;
711  auto status = i_retrieveEntry(m_root, empty, r);
712  if ( !status.isSuccess() ) return status;
713  }
714  parentObj = m_root;
715  path = path.substr(sep);
716  } else {
717  return INVALID_OBJ_PATH;
718  }
719  sep = find(path,SEPARATOR,1);
720  }
721 
722  StatusCode status = StatusCode(INVALID_ROOT,true);
723  if ( sep != boost::string_ref::npos ) { // the string contains a separator (after pos 0)
724  if (!parentObj->object()) { // if the parent object has not been loaded yet, load it now
725  status = loadObject(parentObj);
726  if ( !status.isSuccess() ) return status;
727  }
728  auto p_path = path.substr(0,sep);
729  RegEntry* root_entry = parentObj->findLeaf(p_path);
730  if ( !root_entry && m_enableFaultHdlr ) {
731  // If not even the parent is there, an incident
732  // to load the parent must be fired...
733  i_handleDataFault(parentObj, p_path);
734  root_entry = parentObj->findLeaf(p_path);
735  }
736  if ( root_entry ) {
737  DataObject* pO = root_entry->object();
738  if ( !pO ) {
739  // Object is not loaded: load the object if at all possible
740  status = loadObject(root_entry);
741  if ( !status.isSuccess() ) return status;
742  }
743  if ( root_entry->isSoft() ) {
744  root_entry = CAST_REGENTRY(RegEntry*,pO->registry());
745  }
746  return i_retrieveEntry(root_entry, path.substr(sep), pEntry);
747  }
748  return status;
749  } else if ( path.empty() ) {
750  pEntry = parentObj;
751  } else {
752  if (!parentObj->object()) { // if the parent object has not been loaded yet, load it now
753  status = loadObject(parentObj);
754  if ( !status.isSuccess() ) return status;
755  }
756  // last leave in search: find leaf and load
757  pEntry = parentObj->findLeaf(path);
758  // If no registry entry was found, trigger incident for action-on-demand
759  if ( !pEntry && m_enableFaultHdlr ) {
760  i_handleDataFault(parentObj, path);
761  pEntry = (path.empty() ? parentObj : parentObj->findLeaf(path) );
762  }
763  }
764 
765  // Check results and return
766  if ( !pEntry ) return INVALID_OBJ_PATH;
767  if ( !pEntry->object() ) return loadObject(pEntry);
768 
769  if ( m_enableAccessHdlr ) {
770  // Fire data access incident
771  // I do not know if this is a good idea....
772  // This fires too often!
773  //
774  //DataIncident incident(name(), m_accessName, pEntry->identifier());
775  //m_incidentSvc->fireIncident(incident);
776  return SUCCESS;
777  }
778  return SUCCESS;
779 }
780 
783  const std::string& path,
784  DataObject*& pObject) {
785  pObject = nullptr;
786  RegEntry *result = nullptr, *parent = CAST_REGENTRY(RegEntry*,pRegistry);
787  StatusCode status = i_retrieveEntry(parent, path, result);
788  if ( status.isSuccess() ) {
789  pObject = result->object();
790  }
791  return status;
792 }
793 
795 StatusCode DataSvc::retrieveObject(const std::string& fullPath,
796  DataObject*& pObject) {
797  IRegistry* nullDir = nullptr;
798  return retrieveObject(nullDir, fullPath, pObject);
799 }
800 
802 StatusCode DataSvc::retrieveObject(const std::string& parentPath,
803  const std::string& objectPath,
804  DataObject*& pObject) {
805  DataObject* parent = nullptr;
806  StatusCode status = retrieveObject(parentPath, parent);
807  if ( status.isSuccess() ) {
808  status = retrieveObject (parent, objectPath, pObject);
809  }
810  return status;
811 }
812 
814 StatusCode DataSvc::retrieveObject(const std::string& parentPath,
815  int item,
816  DataObject*& pObject) {
817  return retrieveObject(parentPath, itemToPath(item), pObject);
818 }
819 
822  const std::string& path,
823  DataObject*& pObject) {
824  IRegistry* pRegistry = (parentObj ? parentObj->registry() : nullptr);
825  return retrieveObject(pRegistry, path, pObject);
826 }
827 
830  int item,
831  DataObject*& pObject) {
832  return retrieveObject(parentObj, itemToPath(item), pObject);
833 }
834 
837  const std::string& path,
838  DataObject*& pObject) {
839  pObject = nullptr;
840  IRegistry* pReg = ( pRegistry ? pRegistry : m_root );
841  RegEntry* root_entry = CAST_REGENTRY(RegEntry*, pReg);
842  if ( root_entry ) {
843  if ( !path.empty() ) {
844  pReg = root_entry->find(path);
845  }
846  if ( !pReg ) {
847  return INVALID_OBJ_PATH;
848  }
849  pObject = pReg->object();
850  }
851  return (!pObject) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
852 }
853 
856  DataObject*& pObject) {
857  pObject = nullptr;
858  if ( checkRoot() ) {
859  if ( path.empty() || path == m_rootName ) {
860  pObject = m_root->object();
861  return (0 == pObject) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
862  }
863  else if ( path.front() != SEPARATOR ) {
864  return findObject(m_rootName, path, pObject);
865  }
866  return findObject((IRegistry*)nullptr, path, pObject);
867  }
868  return INVALID_ROOT;
869 }
870 
872 StatusCode DataSvc::findObject(const std::string& parentPath,
873  const std::string& objectPath,
874  DataObject*& pObject) {
875  DataObject* parent = nullptr;
876  StatusCode status = findObject(parentPath, parent);
877  if ( status.isSuccess() ) {
878  status = findObject (parent, objectPath, pObject);
879  }
880  return status;
881 }
882 
884 StatusCode DataSvc::findObject(const std::string& parentPath,
885  int item, DataObject*& pObject) {
886  return findObject(parentPath, itemToPath(item), pObject);
887 }
888 
891  int item,
892  DataObject*& pObject) {
893  return findObject(parentObj, itemToPath(item), pObject);
894 }
895 
898  const std::string& path,
899  DataObject*& pObject) {
900  IRegistry* pDir = ( parentObj ? parentObj->registry() : nullptr );
901  return findObject(pDir, path, pObject);
902 }
903 
905 StatusCode DataSvc::updateObject(const std::string& updatePath) {
906  DataObject* pO = nullptr;
907  StatusCode status = findObject(updatePath, pO);
908  if ( status.isSuccess() ) {
909  return updateObject(pO);
910  }
911  return retrieveObject(updatePath, pO);
912 }
913 
916  if ( !pRegistry ) { // Precondition:
917  return INVALID_OBJ_ADDR; // Addres must be valid
918  }
919  DataObject* toUpdate = pRegistry->object();
920  if ( !toUpdate ) { // Try first to load
921  return loadObject(pRegistry);
922  }
923  return updateObject(toUpdate);
924 }
925 
928  StatusCode status = INVALID_OBJ_ADDR;
929  if ( !toUpdate ) { // Precondition:
930  return INVALID_OBJECT; // Address must be valid
931  }
932  IRegistry* pRegistry = toUpdate->registry(); // Precondition:
933  if ( !pRegistry ) { // Need valid registry
934  return INVALID_OBJECT;
935  }
936  IOpaqueAddress* pAddress = pRegistry->address(); // Precondition:
937  if ( !pAddress ) { // Need valid address
938  return INVALID_OBJ_ADDR;
939  }
940  IConversionSvc* pLoader = getDataLoader(pRegistry);
941  if ( !pLoader ) { // Precondition:
942  return NO_DATA_LOADER; // Data loader must be present
943  }
944  if ( !m_inhibitPathes.empty() ) {
945  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(),
946  pRegistry->identifier());
947  if ( inhibit != m_inhibitPathes.end() ) {
948  return NO_ACCESS;
949  }
950  }
951  try {
952  status = pLoader->updateObj(pAddress, toUpdate); // Call data loader
953  if ( status.isSuccess() ) {
954  status = pLoader->updateObjRefs(pAddress, toUpdate);
955  }
956  }
957  catch( const GaudiException& exc ) {
958  throw GaudiException("GaudiException in updateObject() " +
959  pRegistry->name(),
960  name(),
961  StatusCode::FAILURE, exc);
962  }
963  catch( const std::exception& x) {
964  throw GaudiException("std::exception in updateObject() " +
965  pRegistry->name() + ": " +
966  System::typeinfoName(typeid(x)) + ", " +
967  x.what(),
969  }
970  catch(...) {
971  throw GaudiException("UNKN exception in updateObject() " +
972  pRegistry->name(),
974  }
975  return status;
976 }
977 
979 StatusCode DataSvc::updateObject(const std::string& parentPath,
980  const std::string& updatePath) {
981  DataObject* pParent = nullptr;
982  StatusCode status = findObject(parentPath, pParent);
983  if ( status.isSuccess() ) {
984  status = updateObject( pParent, updatePath);
985  }
986  return status;
987 }
988 
991  const std::string& updatePath) {
992  DataObject* pObject = nullptr;
993  StatusCode status = findObject(parent, updatePath, pObject);
994  if ( status.isSuccess() ) {
995  status = updateObject(pObject);
996  }
997  return status;
998 }
999 
1000 // Link object
1002  const std::string& objPath, DataObject* to) {
1003  if ( checkRoot() ) {
1004  try {
1005  RegEntry* from_entry = CAST_REGENTRY(RegEntry*,from);
1006  if ( from_entry ) {
1007  // First check if both objects are already registered to the store
1008  RegEntry* to_entry = m_root->findLeaf(to);
1009  if ( !to_entry ) {
1010  return INVALID_OBJECT;
1011  }
1012  else {
1013  std::string::size_type sep = objPath.rfind(SEPARATOR);
1014  if ( sep > 0 && sep != std::string::npos ) { // in case the objPath is a sub-directory itself
1015  DataObject* pO = nullptr;
1016  StatusCode sc = retrieveObject(from, objPath.substr(0,sep), pO);
1017  if ( sc.isSuccess() ) {
1018  sc = linkObject(pO->registry(), objPath.substr(sep), to);
1019  }
1020  return sc;
1021  }
1022  // Now register the soft link
1023  StatusCode status = from_entry->add( objPath, to, true);
1024  return status.isSuccess() ?
1026  }
1027  }
1028  }
1029  catch (...) {
1030  }
1031  return INVALID_PARENT;
1032  }
1033  return INVALID_ROOT;
1034 }
1035 
1037 StatusCode DataSvc::linkObject(const std::string& fullPath,
1038  DataObject* to) {
1039  if ( !fullPath.empty() ) {
1040  if ( fullPath.front() != SEPARATOR ) {
1041  return linkObject(m_rootName, fullPath, to);
1042  }
1043  auto sep = fullPath.rfind(SEPARATOR);
1044  return linkObject( fullPath.substr( 0, sep), fullPath.substr(sep), to);
1045  }
1046  return INVALID_OBJ_PATH;
1047 }
1048 
1050 StatusCode DataSvc::linkObject(const std::string& from,
1051  const std::string& objPath,
1052  DataObject* to) {
1053  DataObject* pO = nullptr;
1054  StatusCode status = retrieveObject(from, pO);
1055  if ( status.isSuccess() ) {
1056  return linkObject(pO->registry(), objPath, to);
1057  }
1058  return status;
1059 }
1060 
1063  const std::string& objPath,
1064  DataObject* to) {
1065  if ( from ) {
1066  IRegistry* from_entry = from->registry();
1067  if ( from_entry ) {
1068  return linkObject( from_entry, objPath, to);
1069  }
1070  }
1071  return INVALID_PARENT;
1072 }
1073 
1076  const std::string& objPath) {
1077  if ( checkRoot() ) {
1078  try {
1079  RegEntry* from_entry = CAST_REGENTRY(RegEntry*,from);
1080  if ( from_entry ) {
1081  std::string::size_type sep = objPath.rfind(SEPARATOR);
1082  if ( sep > 0 && sep != std::string::npos ) { // in case the objPath is a sub-directory itself
1083  DataObject* pO = nullptr;
1084  StatusCode sc = findObject(from, objPath.substr(0,sep), pO);
1085  if ( sc.isSuccess() ) {
1086  sc = unlinkObject(pO->registry(), objPath.substr(sep));
1087  }
1088  return sc;
1089  }
1090  StatusCode status = from_entry->remove( objPath );
1091  if ( status.isSuccess() ) {
1092  return status;
1093  }
1094  return INVALID_OBJ_PATH;
1095  }
1096  }
1097  catch (...) {
1098  }
1099  return INVALID_PARENT;
1100  }
1101  return INVALID_ROOT;
1102 }
1103 
1105 StatusCode DataSvc::unlinkObject(const std::string& fullPath) {
1106  if ( !fullPath.empty() ) {
1107  if ( fullPath.front() != SEPARATOR ) {
1108  return unlinkObject(m_rootName, fullPath);
1109  }
1110  auto sep = fullPath.rfind(SEPARATOR);
1111  return unlinkObject(fullPath.substr(0,sep), fullPath.substr(sep));
1112  }
1113  return INVALID_OBJ_PATH;
1114 }
1115 
1117 StatusCode DataSvc::unlinkObject(const std::string& from,
1118  const std::string& objPath) {
1119  DataObject* pObject = nullptr;
1120  StatusCode status = findObject(from, pObject);
1121  if ( status.isSuccess() ) {
1122  status = unlinkObject(pObject->registry(), objPath);
1123  }
1124  return status;
1125 }
1126 
1129  const std::string& objPath) {
1130  if ( checkRoot() ) {
1131  IRegistry* from_entry = m_root->findLeaf(from);
1132  return unlinkObject(from_entry, objPath);
1133  }
1134  return INVALID_ROOT;
1135 }
1136 
1139  auto i = std::find(std::begin(m_preLoads), std::end(m_preLoads), item);
1140  if ( i == std::end(m_preLoads) ) {
1141  m_preLoads.push_back(item);
1142  }
1143  return StatusCode::SUCCESS;
1144 }
1145 
1147 StatusCode DataSvc::addPreLoadItem(const std::string& itemPath) {
1148  return addPreLoadItem( DataStoreItem(itemPath,1) );
1149 }
1150 
1153  m_preLoads.erase(std::remove(std::begin(m_preLoads), std::end(m_preLoads), item),
1154  std::end(m_preLoads));
1155  return StatusCode::SUCCESS;
1156 }
1157 
1159 StatusCode DataSvc::removePreLoadItem(const std::string& itemPath) {
1160  return removePreLoadItem( DataStoreItem(itemPath,1) );
1161 }
1162 
1165  m_preLoads.erase(std::begin(m_preLoads), std::end(m_preLoads));
1166  return StatusCode::SUCCESS;
1167 }
1168 
1170 StatusCode DataSvc::preLoad(int depth, int load_depth, DataObject* pObject) {
1171  //unused: StatusCode sc = StatusCode::FAILURE;
1172  if ( pObject && depth++ < load_depth ) {
1173  RegEntry* dir = CAST_REGENTRY(RegEntry*,pObject->registry());
1174  if ( dir ) {
1175  for (const auto& i : *dir) {
1176  DataObject *pObj = nullptr;
1177  StatusCode status = retrieveObject(pObject, i->name(), pObj);
1178  if ( status.isSuccess() && depth < load_depth ) {
1179  preLoad(depth, load_depth, pObj).ignore();
1180  }
1181  }
1182  }
1183  }
1184  return StatusCode::SUCCESS;
1185 }
1186 
1189  DataObject* pObj = nullptr;
1190  for (const auto& i : m_preLoads ) {
1191  StatusCode sc = retrieveObject( i.path(), pObj);
1192  int load_depth = i.depth();
1193  if ( sc.isSuccess() && load_depth > 1 ) {
1194  preLoad(1, load_depth, pObj).ignore();
1195  }
1196  }
1197  return StatusCode::SUCCESS;
1198 }
1199 
1202  // Nothing to do: just call base class initialisation
1204  if ( !sc.isSuccess() ) {
1205  return sc;
1206  }
1207  sc = service("IncidentSvc", m_incidentSvc, true);
1208  if ( UNLIKELY(!sc.isSuccess()) ) {
1209  error() << "Failed to access incident service." << endmsg;
1210  }
1211  return sc;
1212 }
1213 
1216  // the finalize part is copied here
1217  setDataLoader(nullptr).ignore();
1218  resetPreLoad().ignore();
1219  clearStore().ignore();
1220  if ( m_incidentSvc ) {
1222  m_incidentSvc = nullptr;
1223  }
1224  // re-initialize the base class
1226  if ( UNLIKELY(!sc.isSuccess()) ) {
1227  error() << "Unable to reinitialize base class" << endmsg;
1228  return sc;
1229  }
1230  // the initialize part is copied here
1231  sc = service("IncidentSvc", m_incidentSvc, true);
1232  if ( UNLIKELY(!sc.isSuccess()) ) {
1233  error() << "Failed to access incident service." << endmsg;
1234  return sc;
1235  }
1236  // return
1237  return StatusCode::SUCCESS;
1238 }
1239 
1242  // Nothing to do: just call base class initialisation
1243  setDataLoader(nullptr).ignore();
1244  resetPreLoad().ignore();
1245  clearStore().ignore();
1246  if ( m_incidentSvc ) {
1248  m_incidentSvc = nullptr;
1249  }
1250  return Service::finalize();
1251 }
1252 
1255  return( (CLID)m_rootCLID );
1256 }
1257 
1259 std::string DataSvc::rootName() const {
1260  return( m_rootName );
1261 }
1262 
1265  return new DataObject();
1266 }
1267 
1272  return m_dataLoader;
1273 }
1274 
1276 DataSvc::DataSvc(const std::string& name,ISvcLocator* svc)
1277 : base_class(name,svc), m_rootCLID( /*CLID_Event*/ 110),
1278  m_rootName( "/Event"), m_root(nullptr)
1279 {
1280  m_dataLoader = nullptr;
1281  m_inhibitMap = 0;
1282  m_incidentSvc = nullptr;
1283  m_forceLeaves = false;
1284  m_enableFaultHdlr = false;
1285  m_enableAccessHdlr = false;
1286  m_faultName = "DataFault";
1287  m_accessName = "DataAccess";
1288  declareProperty("RootCLID", m_rootCLID);
1289  declareProperty("RootName", m_rootName);
1290  declareProperty("ForceLeaves", m_forceLeaves);
1291  declareProperty("InhibitPathes", m_inhibitPathes);
1292  declareProperty("DataFaultName", m_faultName);
1293  declareProperty("DataAccessName", m_accessName);
1294  declareProperty("EnableFaultHandler", m_enableFaultHdlr);
1295  declareProperty("EnableAccessHandler", m_enableAccessHdlr);
1296 }
1297 
1300  setDataLoader(nullptr).ignore();
1301  resetPreLoad().ignore();
1302  clearStore().ignore();
1303 }
virtual StatusCode setDataLoader(IConversionSvc *svc)
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service.
Definition: DataSvc.cpp:203
virtual StatusCode reinitialize()
Service initialization.
Definition: DataSvc.cpp:1215
The path for this objects is already in use.
#define VERMSG
Definition: DataSvc.cpp:72
#define UNLIKELY(x)
Definition: Kernel.h:127
bool m_enableAccessHdlr
Flag to enable interrupts on data access requests.
Definition: DataSvc.h:60
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:92
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:26
virtual StatusCode findObject(const std::string &fullPath, DataObject *&pObject)
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:855
virtual StatusCode removePreLoadItem(const DataStoreItem &item)
Remove an item from the preload list.
Definition: DataSvc.cpp:1152
virtual StatusCode registerObject(const std::string &fullPath, DataObject *pObject)
Register object with the data store.
Definition: DataSvc.cpp:361
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.
Definition: DataSvc.cpp:230
bool m_enableFaultHdlr
Flag to enable interrupts on data creation requests.
Definition: DataSvc.h:62
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
Invalid root path object cannot be retrieved or stored.
Normal successful completion.
Definition: IInterface.h:219
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
No data loader available.
Sorry, the requested object is not loaded.
tuple c
Definition: gaudirun.py:341
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.
Definition: DataSvc.h:50
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)
IDataManagerSvc: Analyze by traversing all data objects in the data store.
Definition: DataSvc.cpp:145
virtual StatusCode updateObject(IRegistry *pDirectory)
Update object identified by its directory entry.
Definition: DataSvc.cpp:915
virtual StatusCode resetPreLoad()
Clear the preload list.
Definition: DataSvc.cpp:1164
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.
Definition: DataSvc.cpp:601
Access to the requested leaf is inhibited.
LoadItems m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:56
std::string m_accessName
Name of the data access incident.
Definition: DataSvc.h:70
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition: DataObject.h:65
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.
Definition: DataSvc.cpp:165
DataSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: DataSvc.cpp:1276
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:385
DataObject * i_handleDataFault(IRegistry *pReg, boost::string_ref path=boost::string_ref{})
Definition: DataSvc.cpp:566
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
Definition: DataSvc.cpp:1188
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:64
virtual StatusCode registerAddress(const std::string &fullPath, IOpaqueAddress *pAddress)
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:249
virtual unsigned long release()
IInterface implementation: Reference the object.
Description of the DataStoreItem class.
Definition: DataStoreItem.h:18
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:69
IIncidentSvc * m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:54
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:88
IConversionSvc * m_dataLoader
Pointer to data loader service.
Definition: DataSvc.h:52
virtual StatusCode setRoot(const std::string &root_name, DataObject *pRootObj)
Initialize data store for new event by giving new event path and root object.
Definition: DataSvc.cpp:154
Directory entry is NOT empty.
virtual bool isSoft() const
Is the link soft or hard.
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:53
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
void setObject(DataObject *obj)
Set/Update object address.
virtual IOpaqueAddress * address() const
Retrieve opaque storage address.
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:692
DataSvcHelpers::InhibitMap * m_inhibitMap
Map with object paths to be inhibited from loading.
Definition: DataSvc.h:66
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode retrieveEntry(DataSvcHelpers::RegistryEntry *pNode, const std::string &path, DataSvcHelpers::RegistryEntry *&pEntry)
Retrieve registry entry from store.
Definition: DataSvc.cpp:686
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
def remove
Definition: install.py:153
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:84
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent)
IDataManagerSvc: Explore the object store: retrieve the object's parent.
Definition: DataSvc.cpp:214
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.
Definition: DataSvc.cpp:782
unsigned int CLID
Class ID definition.
Definition: ClassID.h:9
bool m_forceLeaves
Allow forced creation of default leaves on registerObject.
Definition: DataSvc.h:58
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)
Definition: DataSvc.cpp:64
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
virtual StatusCode initialize()
Service initialization.
Definition: DataSvc.cpp:1201
tuple end
Definition: IOTest.py:101
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: DataSvc.cpp:1001
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:35
virtual StatusCode reinitialize()
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Definition: Service.cpp:294
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:44
std::string m_faultName
Name of the data fault incident.
Definition: DataSvc.h:72
virtual const std::string & identifier() const
Full identifier (or key)
DataObject * handleDataFault(IRegistry *pReg, const std::string &path="")
Invoke data fault handling if enabled.
Definition: DataSvc.cpp:562
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).
Definition: Service.cpp:74
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.
Definition: DataSvc.cpp:115
virtual StatusCode unregisterObject(const std::string &fullPath)
Unregister object from the data store.
Definition: DataSvc.cpp:483
Object pointer is invalid.
virtual StatusCode unlinkObject(IRegistry *from, const std::string &objPath)
Remove a link to another object.
Definition: DataSvc.cpp:1075
string s
Definition: gaudirun.py:210
tuple item
print s1,s2
Definition: ana.py:146
Templated class to add the standard messaging functionalities.
virtual StatusCode clearSubTree(const std::string &sub_tree_path)
IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name...
Definition: DataSvc.cpp:77
std::vector< std::string > m_inhibitPathes
Property for the inhibited leaves.
Definition: DataSvc.h:68
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
virtual ~DataSvc()
Standard Destructor.
Definition: DataSvc.cpp:1299
CLID m_rootCLID
Integer Property corresponding to CLID of root entry.
Definition: DataSvc.h:48
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.
Definition: Service.h:142
virtual StatusCode unregisterAddress(const std::string &fullPath)
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:312
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...
Definition: DataSvc.cpp:127
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.
void ignore() const
Definition: StatusCode.h:107
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:211
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
Definition: DataSvc.cpp:1271
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
list i
Definition: ana.py:128
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
virtual StatusCode finalize()
Service initialization.
Definition: DataSvc.cpp:1241
#define ON_VERBOSE
Definition: DataSvc.cpp:69
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: Service.cpp:199
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:1264
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.
Definition: MsgStream.h:244
virtual std::string rootName() const
IDataManagerSvc: Accessor for root event name.
Definition: DataSvc.cpp:1259
DataSvcHelpers::RegistryEntry RegEntry
Definition: DataSvc.cpp:66
virtual StatusCode addPreLoadItem(const DataStoreItem &item)
Add an item to the preload list.
Definition: DataSvc.cpp:1138
virtual CLID rootCLID() const
IDataManagerSvc: Accessor for root event CLID.
Definition: DataSvc.cpp:1254
void makeHard(DataObject *pObject)
Initialize link as hard link.