| The Gaudi Framework v30r0 (c919700c)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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/IConversionSvc.h"
23 #include "GaudiKernel/IConverter.h"
24 #include "GaudiKernel/IOpaqueAddress.h"
25
26 #include "GaudiKernel/DataObject.h"
27 #include "GaudiKernel/GaudiException.h"
28
29 #include "GaudiKernel/DataIncident.h"
30 #include "GaudiKernel/DataSvc.h"
31 #include "GaudiKernel/IIncidentSvc.h"
32 #include "GaudiKernel/RegistryEntry.h"
33
34 // Include files
35 #include <algorithm>
36 #include <cassert>
37 #include <cstdlib>
38 #include <sstream>
39 #include <vector>
40
41 #include "boost/utility/string_ref.hpp"
42
43 namespace
44 {
47 std::string itemToPath( int item ) { return '/' + std::to_string( item ); }
48
49 std::string operator+( char c, boost::string_ref sr )
50 {
51 std::string s{{c}};
52 s.append( sr.data(), sr.size() );
53 return s;
54 }
55
56 boost::string_ref::size_type find( boost::string_ref s, char c, size_t o )
57 {
58 if ( !s.empty() ) s.remove_prefix( o );
59 auto r = s.find( c );
60 return r == boost::string_ref::npos ? r : ( r + o );
61 }
62
63 std::string to_string( boost::string_ref sr ) { return {sr.data(), sr.size()}; }
64 }
65
66 // If you absolutely need optimization: switch off dynamic_cast.
67 // This improves access to the data store roughly by 10 %
68 // for balanced trees.
69 //
70 // M.Frank
71 #define CAST_REGENTRY( x, y ) dynamic_cast<x>( y )
72 //#define CAST_REGENTRY(x,y) (x)(y)
73 typedef DataSvcHelpers::RegistryEntry RegEntry;
74
75 #define ON_DEBUG if ( msgLevel( MSG::DEBUG ) )
76 #define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) )
77
78 #define DEBMSG ON_DEBUG debug()
79 #define VERMSG ON_VERBOSE verbose()
80
84 StatusCode DataSvc::clearSubTree( boost::string_ref sub_tree_path )
85 {
86 DataObject* pObject = nullptr;
87 StatusCode status = findObject( sub_tree_path, pObject );
88 if ( !status.isSuccess() ) return status;
89 RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
90 if ( !node_entry ) return INVALID_OBJECT;
91 RegEntry* parent = node_entry->parentEntry();
92 if ( !parent ) return INVALID_PARENT;
93 parent->remove( node_entry );
94 return StatusCode::SUCCESS;
95 }
96
100 StatusCode DataSvc::clearSubTree( DataObject* pObject )
101 {
102 if ( !checkRoot() ) return INVALID_ROOT;
103 RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
104 if ( !entry ) return INVALID_OBJECT;
105 RegEntry* parent = entry->parentEntry();
106 if ( !parent ) return INVALID_PARENT;
107 parent->remove( entry );
108 return SUCCESS;
109 }
110
112 StatusCode DataSvc::clearStore()
113 {
114 if ( !checkRoot() ) return INVALID_ROOT;
115 m_root->release();
116 m_root = nullptr;
117 return SUCCESS;
118 }
119
123 StatusCode DataSvc::traverseSubTree( boost::string_ref sub_tree_path, IDataStoreAgent* pAgent )
124 {
125 DataObject* pO = nullptr;
126 StatusCode status = findObject( sub_tree_path, pO );
127 return status.isSuccess() ? traverseSubTree( pO, pAgent ) : status;
128 }
129
131 StatusCode DataSvc::traverseSubTree( DataObject* pObject, IDataStoreAgent* pAgent )
132 {
133 if ( !checkRoot() ) return INVALID_ROOT;
134 RegEntry* entry = CAST_REGENTRY( RegEntry*, pObject->registry() );
135 if ( !entry ) return INVALID_OBJECT;
136 return entry->traverseTree( pAgent );
137 }
138
140 StatusCode DataSvc::traverseTree( IDataStoreAgent* pAgent )
141 {
142 if ( !checkRoot() ) return INVALID_ROOT;
143 return m_root->traverseTree( pAgent );
144 }
145
150 StatusCode DataSvc::setRoot( std::string root_path, DataObject* pRootObj )
151 {
152 clearStore().ignore();
153 return i_setRoot( std::move( root_path ), pRootObj );
154 }
155
161 StatusCode DataSvc::i_setRoot( std::string root_path, DataObject* pRootObj )
162 {
163 if ( pRootObj ) {
164 m_root = new RegEntry( std::move( root_path ) );
165 m_root->makeHard( pRootObj );
166 m_root->setDataSvc( this );
167 // No done with GaudiHive. preLoad().ignore();
168 }
169 return SUCCESS;
170 }
171
176 StatusCode DataSvc::setRoot( std::string root_path, IOpaqueAddress* pRootAddr )
177 {
178 clearStore().ignore();
179 return i_setRoot( std::move( root_path ), pRootAddr );
180 }
181
187 StatusCode DataSvc::i_setRoot( std::string root_path, IOpaqueAddress* pRootAddr )
188 {
189 if ( pRootAddr ) {
190 m_root = new RegEntry( std::move( root_path ) );
191 m_root->makeHard( pRootAddr );
192 m_root->setDataSvc( this );
193 // Not done with GaudiHive. preLoad().ignore();
194 }
195 return SUCCESS;
196 }
197
199 StatusCode DataSvc::setDataLoader( IConversionSvc* pDataLoader, IDataProviderSvc* dpsvc )
200 {
201 m_dataLoader = pDataLoader;
202 if ( m_dataLoader ) m_dataLoader->setDataProvider( dpsvc ? dpsvc : this ).ignore();
203 return SUCCESS;
204 }
205
207 StatusCode DataSvc::objectParent( const DataObject* pObject, IRegistry*& refpParent )
208 {
209 if ( !pObject ) return INVALID_OBJECT;
210 return objectParent( pObject->registry(), refpParent );
211 }
213 StatusCode DataSvc::objectParent( const IRegistry* pRegistry, IRegistry*& refpParent )
214 {
215 if ( !checkRoot() ) return INVALID_ROOT;
216 const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
217 if ( !node_entry ) return INVALID_OBJECT;
218 refpParent = node_entry->parent();
219 return StatusCode::SUCCESS;
220 }
221
223 StatusCode DataSvc::objectLeaves( const DataObject* pObject, std::vector<IRegistry*>& leaves )
224 {
225 if ( !pObject ) return INVALID_OBJECT;
226 return objectLeaves( pObject->registry(), leaves );
227 }
228
232 StatusCode DataSvc::objectLeaves( const IRegistry* pRegistry, std::vector<IRegistry*>& leaves )
233 {
234 if ( !checkRoot() ) return INVALID_ROOT;
235 const RegEntry* node_entry = CAST_REGENTRY( const RegEntry*, pRegistry );
236 if ( !node_entry ) return INVALID_OBJECT;
237 leaves = node_entry->leaves();
238 return StatusCode::SUCCESS;
239 }
240
242 StatusCode DataSvc::registerAddress( boost::string_ref fullPath, IOpaqueAddress* pAddress )
243 {
244 if ( fullPath.empty() ) return INVALID_OBJ_PATH;
245 return registerAddress( fullPath.front() != SEPARATOR ? m_root : nullptr, fullPath, pAddress );
246 }
247
249 StatusCode DataSvc::registerAddress( DataObject* parentObj, boost::string_ref objectPath, IOpaqueAddress* pAddress )
250 {
251 IRegistry* pRegistry = ( parentObj ? parentObj->registry() : nullptr );
252 return registerAddress( pRegistry, objectPath, pAddress );
253 }
254
256 StatusCode DataSvc::registerAddress( IRegistry* parentObj, boost::string_ref objPath, IOpaqueAddress* pAddress )
257 {
258 if ( !checkRoot() ) return INVALID_ROOT;
259 if ( objPath.empty() ) return INVALID_OBJ_PATH;
260
261 if ( !parentObj ) {
262 if ( objPath.front() != SEPARATOR ) {
263 return registerAddress( m_root, objPath, pAddress );
264 }
265 auto sep = find( objPath, SEPARATOR, 1 );
266 if ( sep == boost::string_ref::npos || objPath.substr( 0, sep ) != m_rootName.value() ) {
267 return INVALID_PARENT;
268 }
269 return registerAddress( m_root, objPath.substr( sep ), pAddress );
270 }
271 if ( objPath.front() != SEPARATOR ) {
272 return registerAddress( parentObj, char( SEPARATOR ) + objPath, pAddress );
273 }
274 RegEntry* par_entry = CAST_REGENTRY( RegEntry*, parentObj );
275 if ( !par_entry ) return INVALID_PARENT;
276
277 auto sep = objPath.rfind( SEPARATOR );
278 if ( sep > 0 && sep != boost::string_ref::npos ) {
279 auto p_path = objPath.substr( 0, sep );
280 auto o_path = objPath.substr( sep );
281 RegEntry* p_entry = par_entry->findLeaf( p_path );
282 // Create default object leafs if the
283 // intermediate nodes are not present
284 if ( !p_entry && m_forceLeaves ) {
285 DataObject* pLeaf = createDefaultObject();
286 StatusCode sc = registerObject( par_entry->identifier(), p_path, pLeaf );
287 if ( sc.isFailure() ) delete pLeaf;
288 p_entry = par_entry->findLeaf( p_path );
289 }
290 if ( !p_entry ) return INVALID_PARENT;
291 return registerAddress( p_entry, o_path, pAddress );
292 }
293 StatusCode status = par_entry->add( to_string( objPath ), pAddress );
294 return status.isSuccess() ? status : DOUBL_OBJ_PATH;
295 }
296
298 StatusCode DataSvc::unregisterAddress( boost::string_ref fullPath )
299 {
300 if ( fullPath.empty() ) return INVALID_OBJ_PATH;
301 return unregisterAddress( fullPath.front() != SEPARATOR ? m_root : nullptr, fullPath );
302 }
303
305 StatusCode DataSvc::unregisterAddress( DataObject* pParent, boost::string_ref objPath )
306 {
307 return unregisterAddress( pParent ? pParent->registry() : nullptr, objPath );
308 }
309
311 StatusCode DataSvc::unregisterAddress( IRegistry* pParent, boost::string_ref objPath )
312 {
313 if ( !checkRoot() ) return INVALID_ROOT;
314 if ( objPath.empty() ) return INVALID_OBJ_PATH;
315
316 if ( !pParent ) {
317 if ( objPath.front() != SEPARATOR ) return unregisterAddress( m_root, objPath );
318 auto sep = find( objPath, SEPARATOR, 1 );
319 if ( sep != boost::string_ref::npos && objPath.substr( 0, sep ) == m_rootName ) {
320 return unregisterAddress( m_root, objPath.substr( sep ) );
321 }
322 return INVALID_PARENT;
323 }
324 if ( objPath.front() != SEPARATOR ) {
325 return unregisterAddress( pParent, char( SEPARATOR ) + objPath );
326 }
327 RegEntry* node_entry = CAST_REGENTRY( RegEntry*, pParent );
328 if ( node_entry ) {
329 RegEntry* leaf_entry = node_entry->findLeaf( objPath );
330 if ( leaf_entry ) {
331 auto sep = objPath.rfind( SEPARATOR );
332 if ( sep > 0 && sep != boost::string_ref::npos ) {
333 return unregisterAddress( leaf_entry->parent(), objPath.substr( sep ) );
334 }
335 StatusCode status = node_entry->remove( objPath );
336 if ( status.isSuccess() ) return status;
337 }
338 }
339 return INVALID_PARENT;
340 }
341
343 StatusCode DataSvc::registerObject( boost::string_ref fullPath, DataObject* pObject )
344 {
345 return registerObject( nullptr, fullPath, pObject );
346 }
347
349 StatusCode DataSvc::registerObject( boost::string_ref parentPath, boost::string_ref objPath, DataObject* pObject )
350 {
351 DataObject* pO = nullptr;
352 StatusCode status = retrieveObject( parentPath, pO );
353 if ( !status.isSuccess() && m_forceLeaves ) {
354 pO = createDefaultObject();
355 status = registerObject( parentPath, pO );
356 if ( !status.isSuccess() ) pO->release();
357 }
358 return status.isSuccess() ? registerObject( pO, objPath, pObject ) : status;
359 }
360
362 StatusCode DataSvc::registerObject( boost::string_ref parentPath, int item, DataObject* pObject )
363 {
364 return registerObject( parentPath, itemToPath( item ), pObject );
365 }
366
368 StatusCode DataSvc::registerObject( DataObject* parentObj, int item, DataObject* pObject )
369 {
370 return registerObject( parentObj, itemToPath( item ), pObject );
371 }
372
374 StatusCode DataSvc::registerObject( DataObject* parentObj, boost::string_ref objPath, DataObject* pObject )
375 {
376 if ( !checkRoot() ) return INVALID_ROOT;
377
378 if ( !parentObj ) {
379 if ( !objPath.empty() ) {
380 if ( objPath.front() != SEPARATOR ) {
381 return registerObject( m_rootName.value(), objPath, pObject );
382 }
383 auto sep = find( objPath, SEPARATOR, 1 );
384 if ( sep != boost::string_ref::npos ) {
385 return registerObject( objPath.substr( 0, sep ), objPath.substr( sep ), pObject );
386 }
387 }
388 return INVALID_OBJ_PATH;
389 }
390 RegEntry* node_entry = CAST_REGENTRY( RegEntry*, parentObj->registry() );
391 if ( node_entry ) {
392 StatusCode status = INVALID_PARENT;
393 auto sep = find( objPath, SEPARATOR, 1 );
394 if ( sep != boost::string_ref::npos ) {
395 auto p_path = objPath.substr( 0, sep );
396 auto o_path = objPath.substr( sep );
397 RegEntry* par_entry = node_entry->findLeaf( p_path );
398 // Create default object leafs if the
399 // intermediate nodes are not present
400 if ( !par_entry && m_forceLeaves ) {
401 DataObject* pLeaf = createDefaultObject();
402 StatusCode sc = registerObject( parentObj, p_path, pLeaf );
403 if ( !sc.isSuccess() ) delete pLeaf;
404 par_entry = node_entry->findLeaf( p_path );
405 } else if ( par_entry && !par_entry->object() ) {
406 status = i_retrieveEntry( node_entry, p_path, par_entry );
407 if ( !status.isSuccess() && !par_entry->address() && m_forceLeaves ) {
408 DataObject* pLeaf = createDefaultObject();
409 StatusCode sc = registerObject( parentObj, p_path, pLeaf );
410 if ( !sc.isSuccess() ) delete pLeaf;
411 par_entry = node_entry->findLeaf( p_path );
412 }
413 }
414 node_entry = par_entry;
415 if ( node_entry ) {
416 DataObject* obj = node_entry->object();
417 if ( obj ) status = registerObject( obj, o_path, pObject );
418 }
419 } else {
420 RegEntry* leaf = node_entry->findLeaf( objPath );
421 if ( !leaf ) {
422 status = node_entry->add( to_string( objPath ), pObject );
423 } else {
424 DataObject* obj = leaf->object();
425 if ( !obj ) {
426 if ( !pObject ) {
427 error() << "registerObject: trying to register null DataObject" << endmsg;
428 return StatusCode::FAILURE;
429 }
430 pObject->setRegistry( leaf );
431 leaf->setAddress( nullptr );
432 leaf->setObject( pObject );
433 status = StatusCode::SUCCESS;
434 } else {
435 status = DOUBL_OBJ_PATH;
436 }
437 }
438 }
439 return status;
440 }
441 return INVALID_PARENT;
442 }
443
445 StatusCode DataSvc::unregisterObject( boost::string_ref fullPath )
446 {
447 DataObject* pObject = nullptr;
448 StatusCode status = findObject( fullPath, pObject );
449 if ( status.isFailure() ) return status;
450 RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pObject->registry() );
451 if ( !pEntry ) return INVALID_ROOT;
452 if ( !pEntry->isEmpty() ) return DIR_NOT_EMPTY;
453 RegEntry* pParent = pEntry->parentEntry();
454 if ( !pParent ) return INVALID_PARENT;
455 if ( pObject ) pObject->addRef();
456 pParent->remove( pEntry );
457 return StatusCode::SUCCESS;
458 }
459
461 StatusCode DataSvc::unregisterObject( boost::string_ref parentPath, boost::string_ref objPath )
462 {
463 DataObject* pO = nullptr;
464 StatusCode status = findObject( parentPath, pO );
465 return status.isSuccess() ? unregisterObject( pO, objPath ) : status;
466 }
467
469 StatusCode DataSvc::unregisterObject( boost::string_ref parentPath, int item )
470 {
471 return unregisterObject( parentPath, itemToPath( item ) );
472 }
473
475 StatusCode DataSvc::unregisterObject( DataObject* pObject )
476 {
477 if ( !checkRoot() ) return INVALID_ROOT;
478 RegEntry* entry = m_root->findLeaf( pObject );
479 if ( !entry ) return INVALID_OBJECT;
480 RegEntry* parent = entry->parentEntry();
481 if ( !parent ) return INVALID_PARENT;
482 if ( !entry->isEmpty() ) return DIR_NOT_EMPTY;
483 if ( entry->object() ) entry->object()->addRef();
484 if ( parent ) parent->remove( entry );
485 return SUCCESS;
486 }
487
489 StatusCode DataSvc::unregisterObject( DataObject* pParentObj, boost::string_ref objectPath )
490 {
491 if ( checkRoot() ) {
492 try {
493 RegEntry* parent = CAST_REGENTRY( RegEntry*, pParentObj->registry() );
494 if ( parent ) {
495 RegEntry* entry = parent->findLeaf( objectPath );
496 if ( entry ) {
497 if ( entry->isEmpty() ) {
498 if ( entry->object() ) {
499 entry->object()->addRef();
500 }
501 parent->remove( entry );
502 return SUCCESS;
503 }
504 return DIR_NOT_EMPTY;
505 }
506 return INVALID_OBJECT;
507 }
508 } catch ( ... ) {
509 }
510 return INVALID_PARENT;
511 }
512 return INVALID_ROOT;
513 }
514
516 StatusCode DataSvc::unregisterObject( DataObject* pParentObj, int item )
517 {
518 return unregisterObject( pParentObj, itemToPath( item ) );
519 }
520
523 DataObject* DataSvc::handleDataFault( IRegistry* pReg, boost::string_ref path )
524 {
525 return i_handleDataFault( pReg, path );
526 }
527
528 DataObject* DataSvc::i_handleDataFault( IRegistry* pReg, boost::string_ref path )
529 {
530 if ( m_enableFaultHdlr ) {
531 IRegistry* pLeaf = nullptr;
532 if ( pReg && path.empty() ) {
533 DataIncident incident( name(), m_faultName, pReg->identifier() );
534 m_incidentSvc->fireIncident( incident );
535 return pReg->object();
536 }
537 if ( pReg ) {
538 std::string p = pReg->identifier();
539 if ( path.front() != SEPARATOR ) p += SEPARATOR;
540 p.append( path.data(), path.size() );
541 DataIncident incident( name(), m_faultName, p );
542 m_incidentSvc->fireIncident( incident );
543 pLeaf = m_root->findLeaf( p );
544 } else {
545 std::string p = m_root->identifier();
546 if ( path.front() != SEPARATOR ) p += SEPARATOR;
547 p.append( path.data(), path.size() );
548 DataIncident incident( name(), m_faultName, p );
549 m_incidentSvc->fireIncident( incident );
550 pLeaf = m_root->findLeaf( p );
551 }
552 if ( pLeaf ) {
553 return pLeaf->object();
554 }
555 }
556 return nullptr;
557 }
558
562 StatusCode DataSvc::loadObject( IRegistry* pRegistry )
563 {
564 IConversionSvc* pLoader = getDataLoader( pRegistry );
565 return loadObject( pLoader, pRegistry );
566 }
567
571 StatusCode DataSvc::loadObject( IConversionSvc* pLoader, IRegistry* pRegistry )
572 {
573 StatusCode status = INVALID_OBJ_ADDR;
574 DataObject* pObject = nullptr;
575 if ( !pLoader ) { // Precondition: Data loader must be present
576 return handleDataFault( pRegistry ) ? StatusCode{SUCCESS} : NO_DATA_LOADER;
577 }
578 if ( !pRegistry ) { // Precondition: Directory must be valid
579 return handleDataFault( pRegistry ) ? StatusCode{SUCCESS} : INVALID_OBJ_ADDR;
580 }
581
582 VERMSG << "Requested object " << pRegistry->identifier() << endmsg;
583
584 if ( m_enableAccessHdlr ) {
585 // Fire data access incident
586 DataIncident incident( name(), m_accessName, pRegistry->identifier() );
587 m_incidentSvc->fireIncident( incident );
588 }
589 if ( !m_inhibitPathes.empty() ) {
590 auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), pRegistry->identifier() );
591 if ( inhibit != m_inhibitPathes.end() ) {
592 return NO_ACCESS;
593 }
594 }
595 IOpaqueAddress* pAddress = pRegistry->address();
596 if ( !pAddress ) { // Precondition:
597 return INVALID_OBJ_ADDR; // Address must be valid
598 }
599 try {
600 status = pLoader->createObj( pAddress, pObject ); // Call data loader
601 if ( status.isSuccess() ) {
602
603 VERMSG << "Object " << pRegistry->identifier() << " created" << endmsg;
604
605 RegEntry* pEntry = CAST_REGENTRY( RegEntry*, pRegistry );
606 pEntry->setObject( pObject );
607
608 VERMSG << "Filling object " << pRegistry->identifier() << endmsg;
609 status = pLoader->fillObjRefs( pAddress, pObject );
610 }
611 } catch ( const GaudiException& exc ) {
612 if ( handleDataFault( pRegistry ) ) {
613 return SUCCESS;
614 }
615 throw GaudiException( "GaudiException in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE,
616 exc );
617 } catch ( const std::exception& x ) {
618 if ( handleDataFault( pRegistry ) ) {
619 return SUCCESS;
620 }
621 throw GaudiException( "std::exception in loadObject() " + pRegistry->identifier() + ": " +
622 System::typeinfoName( typeid( x ) ) + ", " + x.what(),
623 name(), StatusCode::FAILURE );
624 } catch ( ... ) {
625 if ( handleDataFault( pRegistry ) ) {
626 return SUCCESS;
627 }
628 throw GaudiException( "UNKN exception in loadObject() " + pRegistry->identifier(), name(), StatusCode::FAILURE );
629 }
630 if ( !status.isSuccess() ) {
631 if ( handleDataFault( pRegistry ) ) {
632 return StatusCode::SUCCESS;
633 }
634 }
635 ON_VERBOSE if ( status.isSuccess() )
636 {
637 verbose() << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
638 }
639 return status;
640 }
641
643 StatusCode DataSvc::retrieveEntry( RegEntry* parentObj, boost::string_ref path, RegEntry*& pEntry )
644 {
645 return i_retrieveEntry( parentObj, path, pEntry );
646 }
647
648 StatusCode DataSvc::i_retrieveEntry( RegEntry* parentObj, boost::string_ref path, RegEntry*& pEntry )
649 {
650 // A.Valassi 16.08.2001 avoid core dump if store is empty
651 if ( !checkRoot() ) return StatusCode( INVALID_ROOT, true );
652
653 static const auto empty = boost::string_ref{};
654 auto sep = find( path, SEPARATOR, 1 );
655 pEntry = nullptr;
656
657 if ( !parentObj ) {
658 if ( path.empty() || path == m_rootName ) {
659 parentObj = m_root;
660 path = empty;
661 } else if ( path.front() != SEPARATOR ) {
662 parentObj = m_root;
663 } else if ( sep != boost::string_ref::npos ) {
664 if ( !m_root->object() ) {
665 RegEntry* r = nullptr;
666 auto status = i_retrieveEntry( m_root, empty, r );
667 if ( !status.isSuccess() ) return status;
668 }
669 parentObj = m_root;
670 path = path.substr( sep );
671 } else {
672 return INVALID_OBJ_PATH;
673 }
674 sep = find( path, SEPARATOR, 1 );
675 }
676
677 StatusCode status = StatusCode( INVALID_ROOT, true );
678 if ( sep != boost::string_ref::npos ) { // the string contains a separator (after pos 0)
679 if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
680 status = loadObject( parentObj );
681 if ( !status.isSuccess() ) return status;
682 }
683 auto p_path = path.substr( 0, sep );
684 RegEntry* root_entry = parentObj->findLeaf( p_path );
685 if ( !root_entry && m_enableFaultHdlr ) {
686 // If not even the parent is there, an incident
687 // to load the parent must be fired...
688 i_handleDataFault( parentObj, p_path );
689 root_entry = parentObj->findLeaf( p_path );
690 }
691 if ( root_entry ) {
692 DataObject* pO = root_entry->object();
693 if ( !pO ) {
694 // Object is not loaded: load the object if at all possible
695 status = loadObject( root_entry );
696 if ( !status.isSuccess() ) return status;
697 }
698 if ( root_entry->isSoft() ) {
699 root_entry = CAST_REGENTRY( RegEntry*, pO->registry() );
700 }
701 return i_retrieveEntry( root_entry, path.substr( sep ), pEntry );
702 }
703 return status;
704 } else if ( path.empty() ) {
705 pEntry = parentObj;
706 } else {
707 if ( !parentObj->object() ) { // if the parent object has not been loaded yet, load it now
708 status = loadObject( parentObj );
709 if ( !status.isSuccess() ) return status;
710 }
711 // last leave in search: find leaf and load
712 pEntry = parentObj->findLeaf( path );
713 // If no registry entry was found, trigger incident for action-on-demand
714 if ( !pEntry && m_enableFaultHdlr ) {
715 i_handleDataFault( parentObj, path );
716 pEntry = ( path.empty() ? parentObj : parentObj->findLeaf( path ) );
717 }
718 }
719
720 // Check results and return
721 if ( !pEntry ) return INVALID_OBJ_PATH;
722 if ( !pEntry->object() ) return loadObject( pEntry );
723
724 if ( m_enableAccessHdlr ) {
725 // Fire data access incident
726 // I do not know if this is a good idea....
727 // This fires too often!
728 //
729 // DataIncident incident(name(), m_accessName, pEntry->identifier());
730 // m_incidentSvc->fireIncident(incident);
731 return SUCCESS;
732 }
733 return SUCCESS;
734 }
735
737 StatusCode DataSvc::retrieveObject( IRegistry* pRegistry, boost::string_ref path, DataObject*& pObject )
738 {
739 pObject = nullptr;
740 RegEntry *result = nullptr, *parent = CAST_REGENTRY( RegEntry *, pRegistry );
741 StatusCode status = i_retrieveEntry( parent, path, result );
742 if ( status.isSuccess() ) pObject = result->object();
743 return status;
744 }
745
747 StatusCode DataSvc::retrieveObject( boost::string_ref fullPath, DataObject*& pObject )
748 {
749 IRegistry* nullDir = nullptr;
750 return retrieveObject( nullDir, fullPath, pObject );
751 }
752
754 StatusCode DataSvc::retrieveObject( boost::string_ref parentPath, boost::string_ref objectPath, DataObject*& pObject )
755 {
756 DataObject* parent = nullptr;
757 StatusCode status = retrieveObject( parentPath, parent );
758 return status.isSuccess() ? retrieveObject( parent, objectPath, pObject ) : status;
759 }
760
762 StatusCode DataSvc::retrieveObject( boost::string_ref parentPath, int item, DataObject*& pObject )
763 {
764 return retrieveObject( parentPath, itemToPath( item ), pObject );
765 }
766
768 StatusCode DataSvc::retrieveObject( DataObject* parentObj, boost::string_ref path, DataObject*& pObject )
769 {
770 IRegistry* pRegistry = ( parentObj ? parentObj->registry() : nullptr );
771 return retrieveObject( pRegistry, path, pObject );
772 }
773
775 StatusCode DataSvc::retrieveObject( DataObject* parentObj, int item, DataObject*& pObject )
776 {
777 return retrieveObject( parentObj, itemToPath( item ), pObject );
778 }
779
781 StatusCode DataSvc::findObject( IRegistry* pRegistry, boost::string_ref path, DataObject*& pObject )
782 {
783 pObject = nullptr;
784 IRegistry* pReg = ( pRegistry ? pRegistry : m_root );
785 RegEntry* root_entry = CAST_REGENTRY( RegEntry*, pReg );
786 if ( root_entry ) {
787 if ( !path.empty() ) pReg = root_entry->find( path );
788 if ( !pReg ) return INVALID_OBJ_PATH;
789 pObject = pReg->object();
790 }
791 return ( !pObject ) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
792 }
793
795 StatusCode DataSvc::findObject( boost::string_ref path, DataObject*& pObject )
796 {
797 pObject = nullptr;
798 if ( !checkRoot() ) return INVALID_ROOT;
799 if ( path.empty() || path == m_rootName.value() ) {
800 pObject = m_root->object();
801 return !pObject ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
802 }
803 return ( path.front() != SEPARATOR ) ? findObject( m_rootName.value(), path, pObject )
804 : findObject( static_cast<IRegistry*>( nullptr ), path, pObject );
805 }
806
808 StatusCode DataSvc::findObject( boost::string_ref parentPath, boost::string_ref objectPath, DataObject*& pObject )
809 {
810 DataObject* parent = nullptr;
811 StatusCode status = findObject( parentPath, parent );
812 return status.isSuccess() ? findObject( parent, objectPath, pObject ) : status;
813 }
814
816 StatusCode DataSvc::findObject( boost::string_ref parentPath, int item, DataObject*& pObject )
817 {
818 return findObject( parentPath, itemToPath( item ), pObject );
819 }
820
822 StatusCode DataSvc::findObject( DataObject* parentObj, int item, DataObject*& pObject )
823 {
824 return findObject( parentObj, itemToPath( item ), pObject );
825 }
826
828 StatusCode DataSvc::findObject( DataObject* parentObj, boost::string_ref path, DataObject*& pObject )
829 {
830 IRegistry* pDir = ( parentObj ? parentObj->registry() : nullptr );
831 return findObject( pDir, path, pObject );
832 }
833
835 StatusCode DataSvc::updateObject( boost::string_ref updatePath )
836 {
837 DataObject* pO = nullptr;
838 StatusCode status = findObject( updatePath, pO );
839 return status.isSuccess() ? updateObject( pO ) : retrieveObject( updatePath, pO );
840 }
841
843 StatusCode DataSvc::updateObject( IRegistry* pRegistry )
844 {
845 if ( !pRegistry ) { // Precondition:
846 return INVALID_OBJ_ADDR; // Addres must be valid
847 }
848 DataObject* toUpdate = pRegistry->object();
849 if ( !toUpdate ) { // Try first to load
850 return loadObject( pRegistry );
851 }
852 return updateObject( toUpdate );
853 }
854
856 StatusCode DataSvc::updateObject( DataObject* toUpdate )
857 {
858 StatusCode status = INVALID_OBJ_ADDR;
859 if ( !toUpdate ) { // Precondition:
860 return INVALID_OBJECT; // Address must be valid
861 }
862 IRegistry* pRegistry = toUpdate->registry(); // Precondition:
863 if ( !pRegistry ) { // Need valid registry
864 return INVALID_OBJECT;
865 }
866 IOpaqueAddress* pAddress = pRegistry->address(); // Precondition:
867 if ( !pAddress ) { // Need valid address
868 return INVALID_OBJ_ADDR;
869 }
870 IConversionSvc* pLoader = getDataLoader( pRegistry );
871 if ( !pLoader ) { // Precondition:
872 return NO_DATA_LOADER; // Data loader must be present
873 }
874 if ( !m_inhibitPathes.empty() ) {
875 auto inhibit = std::find( m_inhibitPathes.begin(), m_inhibitPathes.end(), pRegistry->identifier() );
876 if ( inhibit != m_inhibitPathes.end() ) {
877 return NO_ACCESS;
878 }
879 }
880 try {
881 status = pLoader->updateObj( pAddress, toUpdate ); // Call data loader
882 if ( status.isSuccess() ) {
883 status = pLoader->updateObjRefs( pAddress, toUpdate );
884 }
885 } catch ( const GaudiException& exc ) {
886 throw GaudiException( "GaudiException in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE, exc );
887 } catch ( const std::exception& x ) {
888 throw GaudiException( "std::exception in updateObject() " + pRegistry->name() + ": " +
889 System::typeinfoName( typeid( x ) ) + ", " + x.what(),
890 name(), StatusCode::FAILURE );
891 } catch ( ... ) {
892 throw GaudiException( "UNKN exception in updateObject() " + pRegistry->name(), name(), StatusCode::FAILURE );
893 }
894 return status;
895 }
896
898 StatusCode DataSvc::updateObject( boost::string_ref parentPath, boost::string_ref updatePath )
899 {
900 DataObject* pParent = nullptr;
901 StatusCode status = findObject( parentPath, pParent );
902 return status.isSuccess() ? updateObject( pParent, updatePath ) : status;
903 }
904
906 StatusCode DataSvc::updateObject( DataObject* parent, boost::string_ref updatePath )
907 {
908 DataObject* pObject = nullptr;
909 StatusCode status = findObject( parent, updatePath, pObject );
910 return status.isSuccess() ? updateObject( pObject ) : status;
911 }
912
913 // Link object
914 StatusCode DataSvc::linkObject( IRegistry* from, boost::string_ref objPath, DataObject* to )
915 {
916 if ( !checkRoot() ) return INVALID_ROOT;
917 try {
918 RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
919 if ( from_entry ) {
920 // First check if both objects are already registered to the store
921 RegEntry* to_entry = m_root->findLeaf( to );
922 if ( !to_entry ) return INVALID_OBJECT;
923 auto sep = objPath.rfind( SEPARATOR );
924 if ( sep > 0 && sep != boost::string_ref::npos ) { // in case the objPath is a sub-directory itself
925 DataObject* pO = nullptr;
926 StatusCode sc = retrieveObject( from, objPath.substr( 0, sep ), pO );
927 return sc.isSuccess() ? linkObject( pO->registry(), objPath.substr( sep ), to ) : sc;
928 }
929 // Now register the soft link
930 StatusCode status = from_entry->add( to_string( objPath ), to, true );
931 return status.isSuccess() ? IDataProviderSvc_NO_ERROR : DOUBL_OBJ_PATH;
932 }
933 } catch ( ... ) {
934 }
935 return INVALID_PARENT;
936 }
937
939 StatusCode DataSvc::linkObject( boost::string_ref fullPath, DataObject* to )
940 {
941 if ( fullPath.empty() ) return INVALID_OBJ_PATH;
942 if ( fullPath.front() != SEPARATOR ) {
943 return linkObject( m_rootName.value(), fullPath, to );
944 }
945 auto sep = fullPath.rfind( SEPARATOR );
946 return linkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ), to );
947 }
948
950 StatusCode DataSvc::linkObject( boost::string_ref from, boost::string_ref objPath, DataObject* to )
951 {
952 DataObject* pO = nullptr;
953 StatusCode status = retrieveObject( from, pO );
954 return status.isSuccess() ? linkObject( pO->registry(), objPath, to ) : status;
955 }
956
958 StatusCode DataSvc::linkObject( DataObject* from, boost::string_ref objPath, DataObject* to )
959 {
960 if ( from ) {
961 IRegistry* from_entry = from->registry();
962 if ( from_entry ) {
963 return linkObject( from_entry, objPath, to );
964 }
965 }
966 return INVALID_PARENT;
967 }
968
970 StatusCode DataSvc::unlinkObject( IRegistry* from, boost::string_ref objPath )
971 {
972 if ( !checkRoot() ) return INVALID_ROOT;
973 try {
974 RegEntry* from_entry = CAST_REGENTRY( RegEntry*, from );
975 if ( from_entry ) {
976 auto sep = objPath.rfind( SEPARATOR );
977 if ( sep > 0 && sep != boost::string_ref::npos ) { // in case the objPath is a sub-directory itself
978 DataObject* pO = nullptr;
979 StatusCode sc = findObject( from, objPath.substr( 0, sep ), pO );
980 return sc.isSuccess() ? unlinkObject( pO->registry(), objPath.substr( sep ) ) : sc;
981 }
982 StatusCode status = from_entry->remove( objPath );
983 if ( status.isSuccess() ) return status;
984 return INVALID_OBJ_PATH;
985 }
986 } catch ( ... ) {
987 }
988 return INVALID_PARENT;
989 }
990
992 StatusCode DataSvc::unlinkObject( boost::string_ref fullPath )
993 {
994 if ( fullPath.empty() ) return INVALID_OBJ_PATH;
995 if ( fullPath.front() != SEPARATOR ) {
996 return unlinkObject( m_rootName.value(), fullPath );
997 }
998 auto sep = fullPath.rfind( SEPARATOR );
999 return unlinkObject( fullPath.substr( 0, sep ), fullPath.substr( sep ) );
1000 }
1001
1003 StatusCode DataSvc::unlinkObject( boost::string_ref from, boost::string_ref objPath )
1004 {
1005 DataObject* pObject = nullptr;
1006 StatusCode status = findObject( from, pObject );
1007 return status.isSuccess() ? unlinkObject( pObject->registry(), objPath ) : status;
1008 }
1009
1011 StatusCode DataSvc::unlinkObject( DataObject* from, boost::string_ref objPath )
1012 {
1013 if ( !checkRoot() ) return INVALID_ROOT;
1014 IRegistry* from_entry = m_root->findLeaf( from );
1015 return unlinkObject( from_entry, objPath );
1016 }
1017
1019 StatusCode DataSvc::addPreLoadItem( const DataStoreItem& item )
1020 {
1021 auto i = std::find( begin( m_preLoads ), end( m_preLoads ), item );
1022 if ( i == end( m_preLoads ) ) m_preLoads.push_back( item );
1023 return StatusCode::SUCCESS;
1024 }
1025
1027 StatusCode DataSvc::addPreLoadItem( std::string itemPath )
1028 {
1029 return addPreLoadItem( DataStoreItem( std::move( itemPath ), 1 ) );
1030 }
1031
1033 StatusCode DataSvc::removePreLoadItem( const DataStoreItem& item )
1034 {
1035 m_preLoads.erase( std::remove( begin( m_preLoads ), end( m_preLoads ), item ), end( m_preLoads ) );
1036 return StatusCode::SUCCESS;
1037 }
1038
1040 StatusCode DataSvc::removePreLoadItem( std::string itemPath )
1041 {
1042 return removePreLoadItem( DataStoreItem( std::move( itemPath ), 1 ) );
1043 }
1044
1046 StatusCode DataSvc::resetPreLoad()
1047 {
1048 m_preLoads.erase( begin( m_preLoads ), end( m_preLoads ) );
1049 return StatusCode::SUCCESS;
1050 }
1051
1053 StatusCode DataSvc::preLoad( int depth, int load_depth, DataObject* pObject )
1054 {
1055 // unused: StatusCode sc = StatusCode::FAILURE;
1056 if ( pObject && depth++ < load_depth ) {
1057 RegEntry* dir = CAST_REGENTRY( RegEntry*, pObject->registry() );
1058 if ( dir ) {
1059 for ( const auto& i : *dir ) {
1060 DataObject* pObj = nullptr;
1061 StatusCode status = retrieveObject( pObject, i->name(), pObj );
1062 if ( status.isSuccess() && depth < load_depth ) {
1063 preLoad( depth, load_depth, pObj ).ignore();
1064 }
1065 }
1066 }
1067 }
1068 return StatusCode::SUCCESS;
1069 }
1070
1072 StatusCode DataSvc::preLoad()
1073 {
1074 DataObject* pObj = nullptr;
1075 for ( const auto& i : m_preLoads ) {
1076 StatusCode sc = retrieveObject( i.path(), pObj );
1077 int load_depth = i.depth();
1078 if ( sc.isSuccess() && load_depth > 1 ) {
1079 preLoad( 1, load_depth, pObj ).ignore();
1080 }
1081 }
1082 return StatusCode::SUCCESS;
1083 }
1084
1086 StatusCode DataSvc::initialize()
1087 {
1088 // Nothing to do: just call base class initialisation
1089 StatusCode sc = Service::initialize();
1090 if ( UNLIKELY( !sc.isSuccess() ) ) return sc;
1091 m_incidentSvc = service( "IncidentSvc", true );
1092 if ( UNLIKELY( !m_incidentSvc ) ) {
1093 error() << "Failed to access incident service." << endmsg;
1094 }
1095 return sc;
1096 }
1097
1099 StatusCode DataSvc::reinitialize()
1100 {
1101 // the finalize part is copied here
1102 setDataLoader( nullptr ).ignore();
1103 resetPreLoad().ignore();
1104 clearStore().ignore();
1105 m_incidentSvc.reset();
1106 // re-initialize the base class
1107 StatusCode sc = Service::reinitialize();
1108 if ( UNLIKELY( !sc.isSuccess() ) ) {
1109 error() << "Unable to reinitialize base class" << endmsg;
1110 return sc;
1111 }
1112 // the initialize part is copied here
1113 m_incidentSvc = service( "IncidentSvc", true );
1114 if ( UNLIKELY( !m_incidentSvc ) ) {
1115 error() << "Failed to access incident service." << endmsg;
1116 return StatusCode::FAILURE;
1117 }
1118 // return
1119 return StatusCode::SUCCESS;
1120 }
1121
1123 StatusCode DataSvc::finalize()
1124 {
1125 // Nothing to do: just call base class initialisation
1126 setDataLoader( nullptr ).ignore();
1127 resetPreLoad().ignore();
1128 clearStore().ignore();
1129 m_incidentSvc.reset();
1130 return Service::finalize();
1131 }
1132
1134 CLID DataSvc::rootCLID() const { return (CLID)m_rootCLID; }
1135
1137 const std::string& DataSvc::rootName() const { return m_rootName; }
1138
1140 DataObject* DataSvc::createDefaultObject() const { return new DataObject(); }
1141
1145 IConversionSvc* DataSvc::getDataLoader( IRegistry* /* pReg */ ) { return m_dataLoader.get(); }
1146
1148 DataSvc::~DataSvc()
1149 {
1150 setDataLoader( nullptr ).ignore();
1151 resetPreLoad().ignore();
1152 clearStore().ignore();
1153 }
DataSvc::registerAddress
StatusCode registerAddress(boost::string_ref fullPath, IOpaqueAddress *pAddress) override
IDataManagerSvc: Register object address with the data store.
Definition: DataSvc.cpp:242
DataSvc::unregisterAddress
StatusCode unregisterAddress(boost::string_ref fullPath) override
IDataManagerSvc: Unregister object address from the data store.
Definition: DataSvc.cpp:298
DataSvc::m_rootCLID
Gaudi::Property< CLID > m_rootCLID
Definition: DataSvc.h:56
DataSvc::addPreLoadItem
StatusCode addPreLoadItem(const DataStoreItem &item) override
Add an item to the preload list.
Definition: DataSvc.cpp:1019
DataSvc::unregisterObject
StatusCode unregisterObject(boost::string_ref fullPath) override
Unregister object from the data store.
Definition: DataSvc.cpp:445
VERMSG
#define VERMSG
Definition: DataSvc.cpp:79
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:128
StatusCode::SUCCESS
Definition: StatusCode.h:29
Gaudi::Units::sr
constexpr double sr
Definition: SystemOfUnits.h:116
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:64
DataSvc::linkObject
StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *to) override
Add a link to another object.
Definition: DataSvc.cpp:914
to_string
string to_string(const T &value)
Definition: mergesort.cpp:37
DataSvcHelpers::RegistryEntry::findLeaf
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
DataSvc::~DataSvc
~DataSvc() override
Standard Destructor.
Definition: DataSvc.cpp:1148
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:22
DataSvcHelpers::RegistryEntry::object
DataObject * object() const override
Retrive object behind the link.
Definition: RegistryEntry.h:122
gaudirun.c
c
Definition: gaudirun.py:407
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
DataSvc::preLoad
StatusCode preLoad() override
load all preload items of the list
Definition: DataSvc.cpp:1072
IConverter::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:895
SEPARATOR
constexpr char SEPARATOR
Definition: RegistryEntry.cpp:40
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:174
IConversionSvc
Definition: IConversionSvc.h:37
DataSvc::rootCLID
CLID rootCLID() const override
IDataManagerSvc: Accessor for root event CLID.
Definition: DataSvc.cpp:1134
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:336
DataSvc::m_accessName
Gaudi::Property< std::string > m_accessName
Definition: DataSvc.h:67
DataSvcHelpers::RegistryEntry::traverseTree
virtual StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
Definition: RegistryEntry.cpp:298
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
DataSvc::setRoot
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:150
GaudiPython.Bindings.SUCCESS
SUCCESS
Definition: Bindings.py:56
DataSvc::setDataLoader
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc=nullptr) override
IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service and optionally a data pro...
Definition: DataSvc.cpp:199
std::to_string
T to_string(T...args)
CommonMessagingBase::verbose
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Definition: CommonMessaging.h:118
DataSvc::m_rootName
Gaudi::Property< std::string > m_rootName
Definition: DataSvc.h:57
IConverter::setDataProvider
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
DataSvc::loadObject
virtual StatusCode loadObject(IRegistry *pNode)
Invoke Persistency service to create transient object from its persistent representation.
Definition: DataSvc.cpp:562
DataSvc::m_preLoads
LoadItems m_preLoads
Items to be pre-loaded.
Definition: DataSvc.h:70
DataSvc::m_forceLeaves
Gaudi::Property< bool > m_forceLeaves
Definition: DataSvc.h:58
DataObject::setRegistry
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition: DataObject.h:71
DataSvcHelpers::RegistryEntry::release
unsigned long release() override
IInterface implementation: Reference the object.
Definition: RegistryEntry.cpp:68
DataSvc::m_enableFaultHdlr
Gaudi::Property< bool > m_enableFaultHdlr
Definition: DataSvc.h:61
IRegistry::name
virtual const name_type & name() const =0
Name of the directory (or key)
DataSvc::traverseTree
StatusCode traverseTree(IDataStoreAgent *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects in the data store.
Definition: DataSvc.cpp:140
DataSvc::checkRoot
bool checkRoot()
Check if root path is valid.
Definition: DataSvc.h:321
DataSvc::i_handleDataFault
DataObject * i_handleDataFault(IRegistry *pReg, boost::string_ref path=boost::string_ref{})
Definition: DataSvc.cpp:528
DataSvc::retrieveEntry
StatusCode retrieveEntry(DataSvcHelpers::RegistryEntry *pNode, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Retrieve registry entry from store.
Definition: DataSvc.cpp:643
DataSvc::removePreLoadItem
StatusCode removePreLoadItem(const DataStoreItem &item) override
Remove an item from the preload list.
Definition: DataSvc.cpp:1033
DataSvcHelpers::RegistryEntry::leaves
const Store & leaves() const
Access the leaves of the object.
Definition: RegistryEntry.h:130
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:46
DataSvc::m_root
DataSvcHelpers::RegistryEntry * m_root
Pointer to root entry.
Definition: DataSvc.h:72
std::remove
T remove(T...args)
DataSvcHelpers::RegistryEntry::setAddress
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
Definition: RegistryEntry.cpp:117
DataStoreItem
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
DataSvc::clearSubTree
StatusCode clearSubTree(boost::string_ref sub_tree_path) override
IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name...
Definition: DataSvc.cpp:84
DataObject::registry
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:73
IConverter::updateObj
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
DataSvcHelpers::RegistryEntry::parentEntry
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:92
begin
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:58
std::string
STL class.
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
DataSvc.h
DataSvcHelpers::RegistryEntry::isSoft
virtual bool isSoft() const
Is the link soft or hard.
Definition: RegistryEntry.h:128
std::vector::push_back
T push_back(T...args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:106
DataObject::addRef
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:59
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
DataSvcHelpers::RegistryEntry::setObject
void setObject(DataObject *obj)
Set/Update object address.
Definition: RegistryEntry.cpp:128
DataSvc::i_retrieveEntry
StatusCode i_retrieveEntry(DataSvcHelpers::RegistryEntry *parentObj, boost::string_ref path, DataSvcHelpers::RegistryEntry *&pEntry)
Definition: DataSvc.cpp:648
DataSvc::m_faultName
Gaudi::Property< std::string > m_faultName
Definition: DataSvc.h:63
IRegistry::identifier
virtual const id_type & identifier() const =0
Full identifier (or key)
std::exception::what
T what(T...args)
IIncidentSvc.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
GaudiException.h
std::string::append
T append(T...args)
IConverter::updateObjRefs
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
DataSvc::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Pointer to incident service.
Definition: DataSvc.h:54
std::vector::erase
T erase(T...args)
DataSvc::unlinkObject
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
Definition: DataSvc.cpp:970
DataSvc::objectLeaves
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:223
DataSvcHelpers::RegistryEntry::setDataSvc
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:90
IRegistry
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:64
DataSvc::finalize
StatusCode finalize() override
Service initialization.
Definition: DataSvc.cpp:1123
DataSvcHelpers::RegistryEntry::isEmpty
virtual bool isEmpty() const
Simple check if the Container is empty.
Definition: RegistryEntry.h:134
Service::reinitialize
StatusCode reinitialize() override
Definition: Service.cpp:250
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
DataSvcHelpers::RegistryEntry::address
IOpaqueAddress * address() const override
Retrieve opaque storage address.
Definition: RegistryEntry.h:124
std::exception
STL class.
std::move
T move(T...args)
CAST_REGENTRY
#define CAST_REGENTRY(x, y)
Definition: DataSvc.cpp:71
IRegistry::object
virtual DataObject * object() const =0
Retrieve object behind the link.
IOpaqueAddress.h
RegistryEntry.h
DataSvcHelpers::RegistryEntry
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
DataObject::release
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:51
DataSvc::m_inhibitPathes
Gaudi::Property< std::vector< std::string > > m_inhibitPathes
Definition: DataSvc.h:59
GaudiPython.Bindings.DataObject
DataObject
Definition: Bindings.py:55
DataSvc::registerObject
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject) override
Register object with the data store.
Definition: DataSvc.cpp:343
std::find
T find(T...args)
DataSvcHelpers::RegistryEntry::add
virtual StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
Definition: RegistryEntry.cpp:208
DataSvc::i_setRoot
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:161
IConverter::fillObjRefs
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
std::vector< IRegistry * >
DataSvc::reinitialize
StatusCode reinitialize() override
Service initialization.
Definition: DataSvc.cpp:1099
DataSvc::m_dataLoader
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
Definition: DataSvc.h:52
DataSvcHelpers::RegistryEntry::parent
virtual IRegistry * parent() const
Pointer to parent directory entry.
Definition: RegistryEntry.h:126
IDataStoreAgent
Generic data agent interface.
Definition: IDataStoreAgent.h:16
IConversionSvc.h
DataSvc::initialize
StatusCode initialize() override
Service initialization.
Definition: DataSvc.cpp:1086
DataSvc::traverseSubTree
StatusCode traverseSubTree(boost::string_ref 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:123
gaudirun.s
string s
Definition: gaudirun.py:253
DataSvc::m_enableAccessHdlr
Gaudi::Property< bool > m_enableAccessHdlr
Definition: DataSvc.h:65
DataObject::name
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
Definition: DataObject.cpp:68
DataSvc::rootName
const std::string & rootName() const override
IDataManagerSvc: Accessor for root event name.
Definition: DataSvc.cpp:1137
DataSvc::objectParent
StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object&#39;s parent.
Definition: DataSvc.cpp:207
Service::service
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: Service.h:85
DataSvcHelpers::RegistryEntry::identifier
const std::string & identifier() const override
Full identifier (or key)
Definition: RegistryEntry.h:118
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:92
DataSvcHelpers::RegistryEntry::remove
virtual StatusCode remove(boost::string_ref name)
Remove an entry from the store.
Definition: RegistryEntry.cpp:154
StatusCode::FAILURE
Definition: StatusCode.h:29
DataIncident
Data service incident class.
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:84
DataSvc::retrieveObject
StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject) override
Retrieve object from data store.
Definition: DataSvc.cpp:737
DataSvc::getDataLoader
virtual IConversionSvc * getDataLoader(IRegistry *pReg)
Retrieve customizable data loader according to registry entry to be retrieved.
Definition: DataSvc.cpp:1145
DataIncident.h
IRegistry::address
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
DataSvc::updateObject
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition: DataSvc.cpp:843
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
DataSvc::resetPreLoad
StatusCode resetPreLoad() override
Clear the preload list.
Definition: DataSvc.cpp:1046
IConverter.h
DataSvc::findObject
StatusCode findObject(boost::string_ref fullPath, DataObject *&pObject) override
Find object identified by its full path in the data store.
Definition: DataSvc.cpp:795
ON_VERBOSE
#define ON_VERBOSE
Definition: DataSvc.cpp:76
DataSvc::createDefaultObject
virtual DataObject * createDefaultObject() const
Create default objects in case forced creation of leaves is requested.
Definition: DataSvc.cpp:1140
DataSvcHelpers::RegistryEntry::find
virtual IRegistry * find(const IRegistry *obj) const
Try to find an object identified by its pointer.
Definition: RegistryEntry.h:140
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
DataSvc::clearStore
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Definition: DataSvc.cpp:112
Gaudi::operator+
decltype(std::declval< TP >()+std::declval< T >()) operator+(const T &v, const Property< TP, V, H > &p)
implemantation of (value + property)
Definition: Property.h:686
RegEntry
DataSvcHelpers::RegistryEntry RegEntry
Definition: DataSvc.cpp:73
DataObject.h
DataSvc::handleDataFault
DataObject * handleDataFault(IRegistry *pReg, boost::string_ref path="")
Invoke data fault handling if enabled.
Definition: DataSvc.cpp:523
DataSvcHelpers::RegistryEntry::makeHard
void makeHard(DataObject *pObject)
Initialize link as hard link.
Definition: RegistryEntry.cpp:101