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"
23 #include "GaudiKernel/IOpaqueAddress.h"
24 #include "GaudiKernel/IConversionSvc.h"
25 
26 #include "GaudiKernel/DataObject.h"
27 #include "GaudiKernel/GaudiException.h"
28 
29 #include "GaudiKernel/RegistryEntry.h"
30 #include "GaudiKernel/DataSvc.h"
31 #include "GaudiKernel/DataIncident.h"
32 #include "GaudiKernel/IIncidentSvc.h"
33 
34 // Include files
35 #include <cassert>
36 #include <cstdlib>
37 #include <vector>
38 #include <algorithm>
39 #include <sstream>
40 
41 #include "boost/utility/string_ref.hpp"
42 
43 
44 namespace {
47  inline std::string itemToPath(int item) {
48  return '/' + std::to_string(item);
49  }
50 
51  inline boost::string_ref::size_type find( boost::string_ref s, char c, size_t o ) {
52  if (!s.empty()) s.remove_prefix(o);
53  auto r = s.find(c);
54  return r==boost::string_ref::npos ? r : ( r + o ) ;
55  }
56 }
57 
58 // If you absolutely need optimization: switch off dynamic_cast.
59 // This improves access to the data store roughly by 10 %
60 // for balanced trees.
61 //
62 // M.Frank
63 #define CAST_REGENTRY(x,y) dynamic_cast<x>(y)
64 //#define CAST_REGENTRY(x,y) (x)(y)
66 
67 #define ON_DEBUG if (UNLIKELY(outputLevel() <= MSG::DEBUG))
68 #define ON_VERBOSE if (UNLIKELY(outputLevel() <= MSG::VERBOSE))
69 
70 #define DEBMSG ON_DEBUG debug()
71 #define VERMSG ON_VERBOSE verbose()
72 
76 StatusCode DataSvc::clearSubTree(const std::string& sub_tree_path) {
77  DataObject* pObject = nullptr;
78  StatusCode status = findObject(sub_tree_path, pObject);
79  if ( status.isSuccess() ) {
80  RegEntry* node_entry = CAST_REGENTRY(RegEntry*,pObject->registry());
81  if ( node_entry ) {
82  RegEntry* parent = node_entry->parentEntry();
83  if ( parent ) {
84  parent->remove(node_entry);
85  return StatusCode::SUCCESS;
86  }
87  return INVALID_PARENT;
88  }
89  return INVALID_OBJECT;
90  }
91  return status;
92 }
93 
98  if ( checkRoot() ) {
99  RegEntry* entry = CAST_REGENTRY(RegEntry*,pObject->registry());
100  if ( entry ) {
101  RegEntry* parent = entry->parentEntry();
102  if ( parent ) {
103  parent->remove(entry);
104  return SUCCESS;
105  }
106  return INVALID_PARENT;
107  }
108  return INVALID_OBJECT;
109  }
110  return INVALID_ROOT;
111 }
112 
115  if ( checkRoot() ) {
116  m_root->release();
117  m_root = nullptr;
118  return SUCCESS;
119  }
120  return INVALID_ROOT;
121 }
122 
126 StatusCode DataSvc::traverseSubTree (const std::string& sub_tree_path,
127  IDataStoreAgent* pAgent) {
128  DataObject* pO = nullptr;
129  StatusCode status = findObject(sub_tree_path, pO);
130  if ( status.isFailure() ) return status;
131  return traverseSubTree(pO, pAgent);
132 }
133 
136  IDataStoreAgent* pAgent ) {
137  if ( !checkRoot() ) return INVALID_ROOT;
138  RegEntry* entry = CAST_REGENTRY(RegEntry*,pObject->registry());
139  if ( !entry ) return INVALID_OBJECT;
140  return entry->traverseTree(pAgent);
141 }
142 
145  if ( !checkRoot() ) return INVALID_ROOT;
146  return m_root->traverseTree(pAgent);
147 }
148 
153 StatusCode DataSvc::setRoot(std::string root_path,
154  DataObject* pRootObj) {
155  clearStore().ignore();
156  return i_setRoot (std::move(root_path), pRootObj);
157 }
158 
164 StatusCode DataSvc::i_setRoot(std::string root_path,
165  DataObject* pRootObj) {
166  if ( pRootObj ) {
167  m_root = new RegEntry(std::move(root_path));
168  m_root->makeHard(pRootObj);
169  m_root->setDataSvc(this);
170  preLoad().ignore();
171  }
172  return SUCCESS;
173 }
174 
179 StatusCode DataSvc::setRoot(std::string root_path,
180  IOpaqueAddress* pRootAddr) {
181  clearStore().ignore();
182  return i_setRoot (std::move(root_path), pRootAddr);
183 }
184 
190 StatusCode DataSvc::i_setRoot(std::string root_path,
191  IOpaqueAddress* pRootAddr) {
192  if ( pRootAddr ) {
193  m_root = new RegEntry(std::move(root_path));
194  m_root->makeHard(pRootAddr);
195  m_root->setDataSvc(this);
196  preLoad().ignore();
197  }
198  return SUCCESS;
199 }
200 
203  if ( pDataLoader ) pDataLoader->setDataProvider(this).ignore();
204  m_dataLoader = pDataLoader;
205  return SUCCESS;
206 }
207 
210  IRegistry*& refpParent) {
211  if ( !pObject ) return INVALID_OBJECT;
212  return objectParent(pObject->registry(), refpParent);
213 }
216  IRegistry*& refpParent) {
217  if ( !checkRoot() ) return INVALID_ROOT;
218  const RegEntry* node_entry = CAST_REGENTRY(const RegEntry*,pRegistry);
219  if ( !node_entry ) return INVALID_OBJECT;
220  refpParent = node_entry->parent();
221  return StatusCode::SUCCESS;
222 }
223 
226  std::vector<IRegistry*>& leaves) {
227  if ( !pObject ) return INVALID_OBJECT;
228  return objectLeaves(pObject->registry(), leaves);
229 }
230 
235  std::vector<IRegistry*>& leaves) {
236  if ( !checkRoot() ) return INVALID_ROOT;
237  const RegEntry* node_entry = CAST_REGENTRY(const RegEntry*,pRegistry);
238  if ( !node_entry ) return INVALID_OBJECT;
239  leaves = node_entry->leaves();
240  return StatusCode::SUCCESS;
241 }
242 
244 StatusCode DataSvc::registerAddress(const std::string& fullPath,
245  IOpaqueAddress* pAddress) {
246  if ( fullPath.empty() ) return INVALID_OBJ_PATH;
247  return registerAddress( fullPath.front() != SEPARATOR ? m_root : nullptr,
248  fullPath, pAddress);
249 }
250 
253  const std::string& objectPath,
254  IOpaqueAddress* pAddress) {
255  IRegistry* pRegistry = ( parentObj ? parentObj->registry() : nullptr );
256  return registerAddress(pRegistry, objectPath, pAddress);
257 }
258 
261  const std::string& objPath,
262  IOpaqueAddress* pAddress) {
263  if ( !checkRoot() ) return INVALID_ROOT;
264  if ( objPath.empty() ) return INVALID_OBJ_PATH;
265 
266  if ( !parentObj ) {
267  if ( objPath.front() != SEPARATOR ) {
268  return registerAddress(m_root, objPath, pAddress);
269  }
270  std::string::size_type sep = objPath.find(SEPARATOR,1);
271  if ( sep == std::string::npos ) {
272  return INVALID_PARENT;
273  }
274  if ( objPath.compare(0,sep,m_rootName) == 0 ) {
275  return registerAddress(m_root, objPath.substr(sep), pAddress);
276  }
277  }
278  if ( objPath.front() != SEPARATOR ) {
279  return registerAddress(parentObj, char(SEPARATOR)+objPath, pAddress);
280  }
281  RegEntry* par_entry = CAST_REGENTRY(RegEntry*,parentObj);
282  if ( !par_entry ) return INVALID_PARENT;
283 
284  std::string::size_type sep = objPath.rfind(SEPARATOR);
285  if ( sep > 0 && sep != std::string::npos ) {
286  auto p_path = objPath.substr( 0, sep);
287  auto o_path = objPath.substr( sep );
288  RegEntry* p_entry = par_entry->findLeaf(p_path);
289  // Create default object leafs if the
290  // intermediate nodes are not present
291  if ( 0 == p_entry && m_forceLeaves ) {
292  DataObject *pLeaf = createDefaultObject();
293  StatusCode sc = registerObject(par_entry->identifier(),
294  p_path,
295  pLeaf);
296  if ( sc.isFailure() ) delete pLeaf;
297  p_entry = par_entry->findLeaf(p_path);
298  }
299  if ( !p_entry ) return INVALID_PARENT;
300  return registerAddress(p_entry, o_path, pAddress);
301  }
302  StatusCode status = par_entry->add(objPath, pAddress);
303  return status.isSuccess() ? status : DOUBL_OBJ_PATH;
304 }
305 
307 StatusCode DataSvc::unregisterAddress(const std::string& fullPath) {
308  if ( fullPath.empty() ) return INVALID_OBJ_PATH;
309  return unregisterAddress( fullPath.front() != SEPARATOR ? m_root : nullptr,
310  fullPath );
311 }
312 
315  const std::string& objPath) {
316  return unregisterAddress( pParent ? pParent->registry() : nullptr,
317  objPath);
318 }
319 
322  const std::string& objPath) {
323  if ( !checkRoot() ) return INVALID_ROOT;
324  if ( objPath.empty() ) return INVALID_OBJ_PATH;
325 
326  if ( !pParent ) {
327  if ( objPath.front() != SEPARATOR ) {
328  return unregisterAddress(m_root, objPath);
329  }
330  std::string::size_type sep = objPath.find(SEPARATOR,1);
331  if ( sep != std::string::npos &&
332  objPath.compare( 0, sep, m_rootName) == 0 ) {
333  return unregisterAddress(m_root, objPath.substr(sep));
334  }
335  return INVALID_PARENT;
336  }
337  if ( objPath.front() != SEPARATOR ) {
338  return unregisterAddress(pParent, char(SEPARATOR)+objPath);
339  }
340  RegEntry* node_entry = CAST_REGENTRY(RegEntry*,pParent);
341  if ( node_entry ) {
342  RegEntry* leaf_entry = node_entry->findLeaf(objPath);
343  if ( leaf_entry ) {
344  std::string::size_type sep = objPath.rfind(SEPARATOR);
345  if ( sep > 0 && sep != std::string::npos ) {
346  return unregisterAddress(leaf_entry->parent(), objPath.substr(sep));
347  }
348  StatusCode status = node_entry->remove(objPath);
349  if ( status.isSuccess() ) return status;
350  }
351  }
352  return INVALID_PARENT;
353 }
354 
356 StatusCode DataSvc::registerObject (const std::string& fullPath,
357  DataObject* pObject) {
358  return registerObject(nullptr, fullPath, pObject);
359 }
360 
361 
363 StatusCode DataSvc::registerObject (const std::string& parentPath,
364  const std::string& objPath,
365  DataObject* pObject) {
366  DataObject* pO = nullptr;
367  StatusCode status = retrieveObject(parentPath, pO);
368  if ( !status.isSuccess() && m_forceLeaves ) {
369  pO = createDefaultObject();
370  status = registerObject(parentPath, pO);
371  if ( !status.isSuccess() ) pO->release();
372  }
373  if ( status.isFailure() ) return status;
374  return registerObject(pO, objPath, pObject);
375 }
376 
378 StatusCode DataSvc::registerObject(const std::string& parentPath,
379  int item,
380  DataObject* pObject) {
381  return registerObject(parentPath, itemToPath(item), pObject);
382 }
383 
386  int item,
387  DataObject* pObject) {
388  return registerObject(parentObj, itemToPath(item), pObject);
389 }
390 
393  const std::string& objPath,
394  DataObject* pObject) {
395  if ( !checkRoot() ) return INVALID_ROOT;
396 
397  if ( !parentObj ) {
398  if ( !objPath.empty() ) {
399  if ( objPath.front() == SEPARATOR ) {
400  auto sep = objPath.find(SEPARATOR,1);
401  if ( sep != std::string::npos ) {
402  return registerObject(objPath.substr( 0, sep), objPath.substr( sep ), pObject);
403  }
404  } else {
405  return registerObject(m_rootName, objPath, pObject);
406  }
407  }
408  return INVALID_OBJ_PATH;
409  }
410  RegEntry* node_entry = CAST_REGENTRY(RegEntry*,parentObj->registry());
411  if ( node_entry ) {
412  StatusCode status = INVALID_PARENT;
413  auto sep = objPath.find(SEPARATOR,1);
414  if ( sep != std::string::npos ) {
415  auto p_path = objPath.substr( 0, sep );
416  auto o_path = objPath.substr( sep );
417  RegEntry* par_entry = node_entry->findLeaf(p_path);
418  // Create default object leafs if the
419  // intermediate nodes are not present
420  if ( 0 == par_entry && m_forceLeaves ) {
421  DataObject *pLeaf = createDefaultObject();
422  StatusCode sc = registerObject(parentObj, p_path, pLeaf);
423  if ( ! sc.isSuccess() ) delete pLeaf;
424  par_entry = node_entry->findLeaf(p_path);
425  }
426  else if ( 0 != par_entry && par_entry->object() == 0 ) {
427  status = i_retrieveEntry( node_entry, p_path, par_entry);
428  if ( !status.isSuccess() && !par_entry->address() && m_forceLeaves ) {
429  DataObject *pLeaf = createDefaultObject();
430  StatusCode sc = registerObject(parentObj, p_path, pLeaf);
431  if ( ! sc.isSuccess() ) delete pLeaf;
432  par_entry = node_entry->findLeaf(p_path);
433  }
434  }
435  node_entry = par_entry;
436  if ( node_entry ) {
437  DataObject* obj = node_entry->object();
438  if ( obj ) {
439  status = registerObject( obj, o_path, pObject );
440  }
441  }
442  }
443  else {
444  RegEntry* leaf = node_entry->findLeaf(objPath);
445  if ( !leaf ) {
446  status = node_entry->add( objPath, pObject );
447  }
448  else {
449  DataObject* obj = leaf->object();
450  if ( !obj ) {
451  if ( !pObject ) {
452  error() << "registerObject: trying to register null DataObject" << endmsg;
453  return StatusCode::FAILURE;
454  }
455  else {
456  pObject->setRegistry(leaf);
457  }
458  leaf->setAddress(nullptr);
459  leaf->setObject(pObject);
460  status = StatusCode::SUCCESS;
461  }
462  else {
463  status = DOUBL_OBJ_PATH;
464  }
465  }
466  }
467  return status;
468  }
469  return INVALID_PARENT;
470 }
471 
473 StatusCode DataSvc::unregisterObject(const std::string& fullPath) {
474  DataObject* pObject = nullptr;
475  StatusCode status = findObject(fullPath, pObject);
476  if ( status.isFailure() ) return status;
477  RegEntry* pEntry = CAST_REGENTRY(RegEntry*,pObject->registry());
478  if ( !pEntry ) return INVALID_ROOT;
479  if ( !pEntry->isEmpty() ) return DIR_NOT_EMPTY;
480  RegEntry* pParent = pEntry->parentEntry();
481  if ( !pParent ) return INVALID_PARENT;
482  if ( pObject ) pObject->addRef();
483  pParent->remove(pEntry);
484  return StatusCode::SUCCESS;
485 }
486 
488 StatusCode DataSvc::unregisterObject(const std::string& parentPath,
489  const std::string& objPath) {
490  DataObject* pO = nullptr;
491  StatusCode status = findObject(parentPath, pO);
492  return status.isSuccess() ? unregisterObject(pO, objPath) : status;
493 }
494 
496 StatusCode DataSvc::unregisterObject(const std::string& parentPath, int item) {
497  return unregisterObject(parentPath, itemToPath(item));
498 }
499 
502  if ( !checkRoot() ) return INVALID_ROOT;
503  RegEntry* entry = m_root->findLeaf(pObject);
504  if ( !entry ) return INVALID_OBJECT;
505  RegEntry* parent = entry->parentEntry();
506  if ( !parent ) return INVALID_PARENT;
507  if ( !entry->isEmpty() ) return DIR_NOT_EMPTY;
508  if ( entry->object() ) entry->object()->addRef();
509  if ( parent ) parent->remove(entry);
510  return SUCCESS;
511 }
512 
515  const std::string& objectPath) {
516  if ( checkRoot() ) {
517  try {
518  RegEntry* parent = CAST_REGENTRY(RegEntry*,pParentObj->registry());
519  if ( parent ) {
520  RegEntry* entry = parent->findLeaf(objectPath);
521  if ( entry ) {
522  if ( entry->isEmpty() ) {
523  if ( entry->object() ) {
524  entry->object()->addRef();
525  }
526  parent->remove(entry);
527  return SUCCESS;
528  }
529  return DIR_NOT_EMPTY;
530  }
531  return INVALID_OBJECT;
532  }
533  }
534  catch(...) {
535  }
536  return INVALID_PARENT;
537  }
538  return INVALID_ROOT;
539 }
540 
543  return unregisterObject(pParentObj, itemToPath(item));
544 }
545 
548 DataObject* DataSvc::handleDataFault(IRegistry* pReg, const std::string& path) {
549  return i_handleDataFault(pReg,path);
550 }
551 
553 {
554  if ( m_enableFaultHdlr ) {
555  IRegistry* pLeaf = nullptr;
556  if ( pReg && path.empty() ) {
557  DataIncident incident(name(), m_faultName, pReg->identifier());
558  m_incidentSvc->fireIncident(incident);
559  return pReg->object();
560  }
561  else if ( pReg ) {
562  std::string p = pReg->identifier();
563  if (path.front() != SEPARATOR ) p += SEPARATOR;
564  p.append(path.data(),path.size());
565  DataIncident incident(name(), m_faultName, p);
566  m_incidentSvc->fireIncident(incident);
567  pLeaf = m_root->findLeaf(p);
568  }
569  else {
570  std::string p = m_root->identifier();
571  if (path.front() != SEPARATOR ) p += SEPARATOR;
572  p.append(path.data(),path.size());
573  DataIncident incident(name(), m_faultName, p);
574  m_incidentSvc->fireIncident(incident);
575  pLeaf = m_root->findLeaf(p);
576  }
577  if ( pLeaf ) {
578  return pLeaf->object();
579  }
580  }
581  return nullptr;
582 }
583 
588  IConversionSvc* pLoader = getDataLoader(pRegistry);
589  return loadObject(pLoader, pRegistry);
590 }
591 
596  StatusCode status = INVALID_OBJ_ADDR;
597  DataObject* pObject = nullptr;
598  if ( !pLoader ) { // Precondition: Data loader must be present
599  if (handleDataFault(pRegistry)) return SUCCESS;
600  else return NO_DATA_LOADER;
601  }
602  if ( !pRegistry ) { // Precondition: Directory must be valid
603  if (handleDataFault(pRegistry)) return SUCCESS;
604  else return INVALID_OBJ_ADDR;
605  }
606 
607  VERMSG << "Requested object " << pRegistry->identifier() << endmsg;
608 
609  if ( m_enableAccessHdlr ) {
610  // Fire data access incident
611  DataIncident incident(name(), m_accessName, pRegistry->identifier());
612  m_incidentSvc->fireIncident(incident);
613  }
614  if ( !m_inhibitPathes.empty() ) {
615  auto inhibit = std::find(m_inhibitPathes.begin(), m_inhibitPathes.end(),
616  pRegistry->identifier());
617  if ( inhibit != m_inhibitPathes.end() ) {
618  return NO_ACCESS;
619  }
620  }
621  IOpaqueAddress* pAddress = pRegistry->address();
622  if ( !pAddress ) { // Precondition:
623  return INVALID_OBJ_ADDR; // Address must be valid
624  }
625  try {
626  status = pLoader->createObj(pAddress, pObject); // Call data loader
627  if ( status.isSuccess() ) {
628 
629  VERMSG << "Object " << pRegistry->identifier() << " created" << endmsg;
630 
631  RegEntry *pEntry = CAST_REGENTRY(RegEntry*,pRegistry);
632  pEntry->setObject(pObject);
633 
634  VERMSG << "Filling object " << pRegistry->identifier() << endmsg;
635  status = pLoader->fillObjRefs(pAddress, pObject);
636  }
637  }
638  catch( const GaudiException& exc ) {
639  if ( handleDataFault(pRegistry) ) {
640  return SUCCESS;
641  }
642  throw GaudiException("GaudiException in loadObject() " + pRegistry->identifier(),
643  name(), StatusCode::FAILURE, exc);
644  }
645  catch( const std::exception& x) {
646  if ( handleDataFault(pRegistry) ) {
647  return SUCCESS;
648  }
649  throw GaudiException("std::exception in loadObject() " + pRegistry->identifier() +
650  ": " + System::typeinfoName(typeid(x)) + ", " + x.what(),
652  }
653  catch(...) {
654  if ( handleDataFault(pRegistry) ) {
655  return SUCCESS;
656  }
657  throw GaudiException("UNKN exception in loadObject() " + pRegistry->identifier(),
659  }
660  if ( !status.isSuccess() ) {
661  if ( handleDataFault(pRegistry) ) {
662  return StatusCode::SUCCESS;
663  }
664  }
665  ON_VERBOSE if ( status.isSuccess() ) {
666  verbose() << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
667  }
668  return status;
669 }
670 
673  const std::string& path,
674  RegEntry*& pEntry) {
675  return i_retrieveEntry(parentObj,path,pEntry);
676 }
677 
679  boost::string_ref path,
680  RegEntry*& pEntry) {
681  // A.Valassi 16.08.2001 avoid core dump if store is empty
682  if ( !checkRoot() ) return StatusCode(INVALID_ROOT,true);
683 
684  static const auto empty = boost::string_ref{};
685  auto sep = find(path,SEPARATOR,1);
686  pEntry = nullptr;
687 
688  if ( !parentObj ) {
689  if ( path.empty() || path == m_rootName ) {
690  parentObj = m_root;
691  path = empty;
692  } else if ( path.front() != SEPARATOR ) {
693  parentObj = m_root;
694  } else if ( sep != boost::string_ref::npos ) {
695  if ( !m_root->object() ) {
696  RegEntry* r = nullptr;
697  auto status = i_retrieveEntry(m_root, empty, r);
698  if ( !status.isSuccess() ) return status;
699  }
700  parentObj = m_root;
701  path = path.substr(sep);
702  } else {
703  return INVALID_OBJ_PATH;
704  }
705  sep = find(path,SEPARATOR,1);
706  }
707 
708  StatusCode status = StatusCode(INVALID_ROOT,true);
709  if ( sep != boost::string_ref::npos ) { // the string contains a separator (after pos 0)
710  if (!parentObj->object()) { // if the parent object has not been loaded yet, load it now
711  status = loadObject(parentObj);
712  if ( !status.isSuccess() ) return status;
713  }
714  auto p_path = path.substr(0,sep);
715  RegEntry* root_entry = parentObj->findLeaf(p_path);
716  if ( !root_entry && m_enableFaultHdlr ) {
717  // If not even the parent is there, an incident
718  // to load the parent must be fired...
719  i_handleDataFault(parentObj, p_path);
720  root_entry = parentObj->findLeaf(p_path);
721  }
722  if ( root_entry ) {
723  DataObject* pO = root_entry->object();
724  if ( !pO ) {
725  // Object is not loaded: load the object if at all possible
726  status = loadObject(root_entry);
727  if ( !status.isSuccess() ) return status;
728  }
729  if ( root_entry->isSoft() ) {
730  root_entry = CAST_REGENTRY(RegEntry*,pO->registry());
731  }
732  return i_retrieveEntry(root_entry, path.substr(sep), pEntry);
733  }
734  return status;
735  } else if ( path.empty() ) {
736  pEntry = parentObj;
737  } else {
738  if (!parentObj->object()) { // if the parent object has not been loaded yet, load it now
739  status = loadObject(parentObj);
740  if ( !status.isSuccess() ) return status;
741  }
742  // last leave in search: find leaf and load
743  pEntry = parentObj->findLeaf(path);
744  // If no registry entry was found, trigger incident for action-on-demand
745  if ( !pEntry && m_enableFaultHdlr ) {
746  i_handleDataFault(parentObj, path);
747  pEntry = (path.empty() ? parentObj : parentObj->findLeaf(path) );
748  }
749  }
750 
751  // Check results and return
752  if ( !pEntry ) return INVALID_OBJ_PATH;
753  if ( !pEntry->object() ) return loadObject(pEntry);
754 
755  if ( m_enableAccessHdlr ) {
756  // Fire data access incident
757  // I do not know if this is a good idea....
758  // This fires too often!
759  //
760  //DataIncident incident(name(), m_accessName, pEntry->identifier());
761  //m_incidentSvc->fireIncident(incident);
762  return SUCCESS;
763  }
764  return SUCCESS;
765 }
766 
769  const std::string& path,
770  DataObject*& pObject) {
771  pObject = nullptr;
772  RegEntry *result = nullptr, *parent = CAST_REGENTRY(RegEntry*,pRegistry);
773  StatusCode status = i_retrieveEntry(parent, path, result);
774  if ( status.isSuccess() ) pObject = result->object();
775  return status;
776 }
777 
779 StatusCode DataSvc::retrieveObject(const std::string& fullPath,
780  DataObject*& pObject) {
781  IRegistry* nullDir = nullptr;
782  return retrieveObject(nullDir, fullPath, pObject);
783 }
784 
786 StatusCode DataSvc::retrieveObject(const std::string& parentPath,
787  const std::string& objectPath,
788  DataObject*& pObject) {
789  DataObject* parent = nullptr;
790  StatusCode status = retrieveObject(parentPath, parent);
791  return status.isSuccess() ? retrieveObject (parent, objectPath, pObject)
792  : status;
793 }
794 
796 StatusCode DataSvc::retrieveObject(const std::string& parentPath,
797  int item,
798  DataObject*& pObject) {
799  return retrieveObject(parentPath, itemToPath(item), pObject);
800 }
801 
804  const std::string& path,
805  DataObject*& pObject) {
806  IRegistry* pRegistry = (parentObj ? parentObj->registry() : nullptr);
807  return retrieveObject(pRegistry, path, pObject);
808 }
809 
812  int item,
813  DataObject*& pObject) {
814  return retrieveObject(parentObj, itemToPath(item), pObject);
815 }
816 
819  const std::string& path,
820  DataObject*& pObject) {
821  pObject = nullptr;
822  IRegistry* pReg = ( pRegistry ? pRegistry : m_root );
823  RegEntry* root_entry = CAST_REGENTRY(RegEntry*, pReg);
824  if ( root_entry ) {
825  if ( !path.empty() ) pReg = root_entry->find(path);
826  if ( !pReg ) return INVALID_OBJ_PATH;
827  pObject = pReg->object();
828  }
829  return (!pObject) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
830 }
831 
834  DataObject*& pObject) {
835  pObject = nullptr;
836  if ( checkRoot() ) {
837  if ( path.empty() || path == m_rootName ) {
838  pObject = m_root->object();
839  return !pObject ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
840  }
841  else if ( path.front() != SEPARATOR ) {
842  return findObject(m_rootName, path, pObject);
843  }
844  return findObject((IRegistry*)nullptr, path, pObject);
845  }
846  return INVALID_ROOT;
847 }
848 
850 StatusCode DataSvc::findObject(const std::string& parentPath,
851  const std::string& objectPath,
852  DataObject*& pObject) {
853  DataObject* parent = nullptr;
854  StatusCode status = findObject(parentPath, parent);
855  return status.isSuccess() ? findObject (parent, objectPath, pObject)
856  : status;
857 }
858 
860 StatusCode DataSvc::findObject(const std::string& parentPath,
861  int item, DataObject*& pObject) {
862  return findObject(parentPath, itemToPath(item), pObject);
863 }
864 
867  int item,
868  DataObject*& pObject) {
869  return findObject(parentObj, itemToPath(item), pObject);
870 }
871 
874  const std::string& path,
875  DataObject*& pObject) {
876  IRegistry* pDir = ( parentObj ? parentObj->registry() : nullptr );
877  return findObject(pDir, path, pObject);
878 }
879 
881 StatusCode DataSvc::updateObject(const std::string& updatePath) {
882  DataObject* pO = nullptr;
883  StatusCode status = findObject(updatePath, pO);
884  return status.isSuccess() ? updateObject(pO)
885  : retrieveObject(updatePath, pO);
886 }
887 
890  if ( !pRegistry ) { // Precondition:
891  return INVALID_OBJ_ADDR; // Addres must be valid
892  }
893  DataObject* toUpdate = pRegistry->object();
894  if ( !toUpdate ) { // Try first to load
895  return loadObject(pRegistry);
896  }
897  return updateObject(toUpdate);
898 }
899 
902  StatusCode status = INVALID_OBJ_ADDR;
903  if ( !toUpdate ) { // Precondition:
904  return INVALID_OBJECT; // Address must be valid
905  }
906  IRegistry* pRegistry = toUpdate->registry(); // Precondition:
907  if ( !pRegistry ) { // Need valid registry
908  return INVALID_OBJECT;
909  }
910  IOpaqueAddress* pAddress = pRegistry->address(); // Precondition:
911  if ( !pAddress ) { // Need valid address
912  return INVALID_OBJ_ADDR;
913  }
914  IConversionSvc* pLoader = getDataLoader(pRegistry);
915  if ( !pLoader ) { // Precondition:
916  return NO_DATA_LOADER; // Data loader must be present
917  }
918  if ( !m_inhibitPathes.empty() ) {
919  auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(),
920  pRegistry->identifier());
921  if ( inhibit != m_inhibitPathes.end() ) {
922  return NO_ACCESS;
923  }
924  }
925  try {
926  status = pLoader->updateObj(pAddress, toUpdate); // Call data loader
927  if ( status.isSuccess() ) {
928  status = pLoader->updateObjRefs(pAddress, toUpdate);
929  }
930  }
931  catch( const GaudiException& exc ) {
932  throw GaudiException("GaudiException in updateObject() " +
933  pRegistry->name(),
934  name(),
935  StatusCode::FAILURE, exc);
936  }
937  catch( const std::exception& x) {
938  throw GaudiException("std::exception in updateObject() " +
939  pRegistry->name() + ": " +
940  System::typeinfoName(typeid(x)) + ", " +
941  x.what(),
943  }
944  catch(...) {
945  throw GaudiException("UNKN exception in updateObject() " +
946  pRegistry->name(),
948  }
949  return status;
950 }
951 
953 StatusCode DataSvc::updateObject(const std::string& parentPath,
954  const std::string& updatePath) {
955  DataObject* pParent = nullptr;
956  StatusCode status = findObject(parentPath, pParent);
957  return status.isSuccess() ? updateObject( pParent, updatePath)
958  : status;
959 }
960 
963  const std::string& updatePath) {
964  DataObject* pObject = nullptr;
965  StatusCode status = findObject(parent, updatePath, pObject);
966  return status.isSuccess() ? updateObject(pObject)
967  : status;
968 }
969 
970 // Link object
972  const std::string& objPath, DataObject* to) {
973  if ( checkRoot() ) {
974  try {
975  RegEntry* from_entry = CAST_REGENTRY(RegEntry*,from);
976  if ( from_entry ) {
977  // First check if both objects are already registered to the store
978  RegEntry* to_entry = m_root->findLeaf(to);
979  if ( !to_entry ) {
980  return INVALID_OBJECT;
981  }
982  else {
983  std::string::size_type sep = objPath.rfind(SEPARATOR);
984  if ( sep > 0 && sep != std::string::npos ) { // in case the objPath is a sub-directory itself
985  DataObject* pO = nullptr;
986  StatusCode sc = retrieveObject(from, objPath.substr(0,sep), pO);
987  if ( sc.isSuccess() ) {
988  sc = linkObject(pO->registry(), objPath.substr(sep), to);
989  }
990  return sc;
991  }
992  // Now register the soft link
993  StatusCode status = from_entry->add( objPath, to, true);
994  return status.isSuccess() ?
995  IDataProviderSvc_NO_ERROR : DOUBL_OBJ_PATH;
996  }
997  }
998  }
999  catch (...) {
1000  }
1001  return INVALID_PARENT;
1002  }
1003  return INVALID_ROOT;
1004 }
1005 
1007 StatusCode DataSvc::linkObject(const std::string& fullPath,
1008  DataObject* to) {
1009  if ( !fullPath.empty() ) {
1010  if ( fullPath.front() != SEPARATOR ) {
1011  return linkObject(m_rootName, fullPath, to);
1012  }
1013  auto sep = fullPath.rfind(SEPARATOR);
1014  return linkObject( fullPath.substr( 0, sep), fullPath.substr(sep), to);
1015  }
1016  return INVALID_OBJ_PATH;
1017 }
1018 
1020 StatusCode DataSvc::linkObject(const std::string& from,
1021  const std::string& objPath,
1022  DataObject* to) {
1023  DataObject* pO = nullptr;
1024  StatusCode status = retrieveObject(from, pO);
1025  return status.isSuccess() ? linkObject(pO->registry(), objPath, to)
1026  : status;
1027 }
1028 
1031  const std::string& objPath,
1032  DataObject* to) {
1033  if ( from ) {
1034  IRegistry* from_entry = from->registry();
1035  if ( from_entry ) {
1036  return linkObject( from_entry, objPath, to);
1037  }
1038  }
1039  return INVALID_PARENT;
1040 }
1041 
1044  const std::string& objPath) {
1045  if ( checkRoot() ) {
1046  try {
1047  RegEntry* from_entry = CAST_REGENTRY(RegEntry*,from);
1048  if ( from_entry ) {
1049  std::string::size_type sep = objPath.rfind(SEPARATOR);
1050  if ( sep > 0 && sep != std::string::npos ) { // in case the objPath is a sub-directory itself
1051  DataObject* pO = nullptr;
1052  StatusCode sc = findObject(from, objPath.substr(0,sep), pO);
1053  if ( sc.isSuccess() ) {
1054  sc = unlinkObject(pO->registry(), objPath.substr(sep));
1055  }
1056  return sc;
1057  }
1058  StatusCode status = from_entry->remove( objPath );
1059  if ( status.isSuccess() ) return status;
1060  return INVALID_OBJ_PATH;
1061  }
1062  }
1063  catch (...) {
1064  }
1065  return INVALID_PARENT;
1066  }
1067  return INVALID_ROOT;
1068 }
1069 
1071 StatusCode DataSvc::unlinkObject(const std::string& fullPath) {
1072  if ( fullPath.empty() ) return INVALID_OBJ_PATH;
1073  if ( fullPath.front() != SEPARATOR ) {
1074  return unlinkObject(m_rootName, fullPath);
1075  }
1076  auto sep = fullPath.rfind(SEPARATOR);
1077  return unlinkObject(fullPath.substr(0,sep), fullPath.substr(sep));
1078 }
1079 
1081 StatusCode DataSvc::unlinkObject(const std::string& from,
1082  const std::string& objPath) {
1083  DataObject* pObject = nullptr;
1084  StatusCode status = findObject(from, pObject);
1085  return status.isSuccess() ? unlinkObject(pObject->registry(), objPath)
1086  : status;
1087 }
1088 
1091  const std::string& objPath) {
1092  if ( !checkRoot() ) return INVALID_ROOT;
1093  IRegistry* from_entry = m_root->findLeaf(from);
1094  return unlinkObject(from_entry, objPath);
1095 }
1096 
1099  auto i = std::find(std::begin(m_preLoads), std::end(m_preLoads), item);
1100  if ( i == std::end(m_preLoads) ) {
1101  m_preLoads.push_back(item);
1102  }
1103  return StatusCode::SUCCESS;
1104 }
1105 
1107 StatusCode DataSvc::addPreLoadItem(const std::string& itemPath) {
1108  return addPreLoadItem( DataStoreItem(itemPath,1) );
1109 }
1110 
1114  std::end(m_preLoads));
1115  return StatusCode::SUCCESS;
1116 }
1117 
1119 StatusCode DataSvc::removePreLoadItem(const std::string& itemPath) {
1120  return removePreLoadItem( DataStoreItem(itemPath,1) );
1121 }
1122 
1126  return StatusCode::SUCCESS;
1127 }
1128 
1130 StatusCode DataSvc::preLoad(int depth, int load_depth, DataObject* pObject) {
1131  //unused: StatusCode sc = StatusCode::FAILURE;
1132  if ( pObject && depth++ < load_depth ) {
1133  RegEntry* dir = CAST_REGENTRY(RegEntry*,pObject->registry());
1134  if ( dir ) {
1135  for (const auto& i : *dir) {
1136  DataObject *pObj = nullptr;
1137  StatusCode status = retrieveObject(pObject, i->name(), pObj);
1138  if ( status.isSuccess() && depth < load_depth ) {
1139  preLoad(depth, load_depth, pObj).ignore();
1140  }
1141  }
1142  }
1143  }
1144  return StatusCode::SUCCESS;
1145 }
1146 
1149  DataObject* pObj = nullptr;
1150  for (const auto& i : m_preLoads ) {
1151  StatusCode sc = retrieveObject( i.path(), pObj);
1152  int load_depth = i.depth();
1153  if ( sc.isSuccess() && load_depth > 1 ) {
1154  preLoad(1, load_depth, pObj).ignore();
1155  }
1156  }
1157  return StatusCode::SUCCESS;
1158 }
1159 
1162  // Nothing to do: just call base class initialisation
1164  if ( UNLIKELY(!sc.isSuccess()) ) return sc;
1165  m_incidentSvc = service("IncidentSvc", true);
1166  if ( UNLIKELY(!m_incidentSvc) ) {
1167  error() << "Failed to access incident service." << endmsg;
1168  }
1169  return sc;
1170 }
1171 
1174  // the finalize part is copied here
1175  setDataLoader(nullptr).ignore();
1176  resetPreLoad().ignore();
1177  clearStore().ignore();
1178  m_incidentSvc.reset();
1179  // re-initialize the base class
1181  if ( UNLIKELY(!sc.isSuccess()) ) {
1182  error() << "Unable to reinitialize base class" << endmsg;
1183  return sc;
1184  }
1185  // the initialize part is copied here
1186  m_incidentSvc = service("IncidentSvc", true);
1187  if ( UNLIKELY(!m_incidentSvc) ) {
1188  error() << "Failed to access incident service." << endmsg;
1189  return StatusCode::FAILURE;
1190  }
1191  // return
1192  return StatusCode::SUCCESS;
1193 }
1194 
1197  // Nothing to do: just call base class initialisation
1198  setDataLoader(nullptr).ignore();
1199  resetPreLoad().ignore();
1200  clearStore().ignore();
1201  m_incidentSvc.reset();
1202  return Service::finalize();
1203 }
1204 
1207  return( (CLID)m_rootCLID );
1208 }
1209 
1211 const std::string& DataSvc::rootName() const {
1212  return m_rootName;
1213 }
1214 
1217  return new DataObject();
1218 }
1219 
1224  return m_dataLoader.get();
1225 }
1226 
1228 DataSvc::DataSvc(const std::string& name,ISvcLocator* svc)
1229 : base_class(name,svc)
1230 {
1231  declareProperty("RootCLID", m_rootCLID);
1232  declareProperty("RootName", m_rootName);
1233  declareProperty("ForceLeaves", m_forceLeaves);
1234  declareProperty("InhibitPathes", m_inhibitPathes);
1235  declareProperty("DataFaultName", m_faultName);
1236  declareProperty("DataAccessName", m_accessName);
1237  declareProperty("EnableFaultHandler", m_enableFaultHdlr);
1238  declareProperty("EnableAccessHandler", m_enableAccessHdlr);
1239 }
1240 
1243  setDataLoader(nullptr).ignore();
1244  resetPreLoad().ignore();
1245  clearStore().ignore();
1246 }
StatusCode unregisterObject(const std::string &fullPath) override
Unregister object from the data store.
Definition: DataSvc.cpp:473
#define VERMSG
Definition: DataSvc.cpp:71
tuple c
Definition: gaudirun.py:392
StatusCode initialize() override
Definition: Service.cpp:62
bool m_enableAccessHdlr
Flag to enable interrupts on data access requests.
Definition: DataSvc.h:62
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:66
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:91
~DataSvc() override
Standard Destructor.
Definition: DataSvc.cpp:1242
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:25
virtual StatusCode removePreLoadItem(const DataStoreItem &item)
Remove an item from the preload list.
Definition: DataSvc.cpp:1112
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
constexpr char SEPARATOR
def remove(file, logdir)
Definition: install.py:153
StatusCode finalize() override
Definition: Service.cpp:187
bool m_enableFaultHdlr
Flag to enable interrupts on data creation requests.
Definition: DataSvc.h:64
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:45
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
StatusCode setRoot(std::string root_name, DataObject *pRootObj) override
Initialize data store for new event by giving new event path and root object.
Definition: DataSvc.cpp:153
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:52
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:56
list path
Definition: __init__.py:15
virtual StatusCode resetPreLoad()
Clear the preload list.
Definition: DataSvc.cpp:1124
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:587
LoadItems m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:58
std::string m_accessName
Name of the data access incident.
Definition: DataSvc.h:72
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition: DataObject.h:70
unsigned long release() override
IInterface implementation: Reference the object.
virtual const name_type & name() const =0
Name of the directory (or key)
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
Definition: DataSvc.h:54
StatusCode traverseTree(IDataStoreAgent *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects in the data store.
Definition: DataSvc.cpp:144
DataSvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: DataSvc.cpp:1228
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:387
DataObject * i_handleDataFault(IRegistry *pReg, boost::string_ref path=boost::string_ref{})
Definition: DataSvc.cpp:552
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:1148
StatusCode registerObject(const std::string &fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:356
virtual StatusCode registerAddress(const std::string &fullPath, IOpaqueAddress *pAddress)
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:244
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
std::vector< std::string > m_inhibitPathes
Property for the inhibited leaves.
Definition: DataSvc.h:70
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
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:87
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
virtual bool isSoft() const
Is the link soft or hard.
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:63
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
void setObject(DataObject *obj)
Set/Update object address.
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:678
IOpaqueAddress * address() const override
Retrieve opaque storage address.
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode retrieveEntry(DataSvcHelpers::RegistryEntry *pNode, const std::string &path, DataSvcHelpers::RegistryEntry *&pEntry)
Retrieve registry entry from store.
Definition: DataSvc.cpp:672
StatusCode setDataLoader(IConversionSvc *svc) override
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service.
Definition: DataSvc.cpp:202
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
StatusCode findObject(const std::string &fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:833
StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves) override
IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
Definition: DataSvc.cpp:225
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:83
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
const std::string & identifier() const override
Full identifier (or key)
StatusCode finalize() override
Service initialization.
Definition: DataSvc.cpp:1196
virtual bool isEmpty() const
Simple check if the Container is empty.
StatusCode reinitialize() override
Definition: Service.cpp:282
StatusCode clearSubTree(const std::string &sub_tree_path) override
IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name...
Definition: DataSvc.cpp:76
CLID rootCLID() const override
IDataManagerSvc: Accessor for root event CLID.
Definition: DataSvc.cpp:1206
StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:768
bool m_forceLeaves
Allow forced creation of default leaves on registerObject.
Definition: DataSvc.h:60
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual DataObject * object() const =0
Retrieve object behind the link.
StatusCode linkObject(IRegistry *from, const std::string &objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:971
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:63
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:34
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:56
std::string m_faultName
Name of the data fault incident.
Definition: DataSvc.h:74
virtual StatusCode i_setRoot(std::string root_name, DataObject *pRootObj)
Initialize data store for new event by giving new event path and root object.
Definition: DataSvc.cpp:164
DataObject * handleDataFault(IRegistry *pReg, const std::string &path="")
Invoke data fault handling if enabled.
Definition: DataSvc.cpp:548
DataObject * object() const override
Retrive object behind the link.
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
StatusCode reinitialize() override
Service initialization.
Definition: DataSvc.cpp:1173
virtual IRegistry * parent() const
Pointer to parent directory entry.
Generic data agent interface.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
StatusCode initialize() override
Service initialization.
Definition: DataSvc.cpp:1161
StatusCode unlinkObject(IRegistry *from, const std::string &objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:1043
string s
Definition: gaudirun.py:246
tuple item
print s1,s2
Definition: ana.py:146
CLID m_rootCLID
Integer Property corresponding to CLID of root entry.
Definition: DataSvc.h:50
StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
Definition: DataSvc.cpp:209
virtual StatusCode unregisterAddress(const std::string &fullPath)
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:307
#define UNLIKELY(x)
Definition: Kernel.h:126
virtual const id_type & identifier() const =0
Full identifier (or key)
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
Data service incident class.
Opaque address interface definition.
void ignore() const
Definition: StatusCode.h:108
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
Definition: DataSvc.cpp:1223
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...
Definition: DataSvc.cpp:126
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:889
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
list i
Definition: ana.py:128
#define ON_VERBOSE
Definition: DataSvc.cpp:68
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:1216
virtual IRegistry * find(const IRegistry *obj) const
Try to find an object identified by its pointer.
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:114
DataSvcHelpers::RegistryEntry RegEntry
Definition: DataSvc.cpp:65
const std::string & rootName() const override
IDataManagerSvc: Accessor for root event name.
Definition: DataSvc.cpp:1211
virtual StatusCode addPreLoadItem(const DataStoreItem &item)
Add an item to the preload list.
Definition: DataSvc.cpp:1098
void makeHard(DataObject *pObject)
Initialize link as hard link.