The Gaudi Framework  v33r1 (b1225454)
HiveWhiteBoard.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 //====================================================================
12 // WhiteBoard (Concurrent Event Data Store)
13 //--------------------------------------------------------------------
14 //
15 //====================================================================
16 // Include files
18 #include "GaudiKernel/DataObjID.h"
19 #include "GaudiKernel/DataObject.h"
20 #include "GaudiKernel/DataSvc.h"
21 #include "GaudiKernel/MsgStream.h"
22 #include "GaudiKernel/Service.h"
23 #include "GaudiKernel/SmartIF.h"
25 #include "Rtypes.h"
26 #include "ThreadLocalStorage.h"
27 #include "boost/callable_traits.hpp"
28 #include "tbb/concurrent_queue.h"
29 #include "tbb/tbb_stddef.h"
30 #if TBB_INTERFACE_VERSION_MAJOR < 12
31 # include "tbb/recursive_mutex.h"
32 #endif // TBB_INTERFACE_VERSION_MAJOR < 12
33 #include <mutex>
34 #include <utility>
35 
36 // Interfaces
44 #include "GaudiKernel/IRegistry.h"
47 
48 namespace {
49  struct Partition final {
50  SmartIF<IDataProviderSvc> dataProvider;
51  SmartIF<IDataManagerSvc> dataManager;
52  int eventNumber = -1;
53 
54  // allow acces 'by type' -- used in fwd
55  template <typename T>
56  T* get();
57  };
58  template <>
59  IDataProviderSvc* Partition::get<IDataProviderSvc>() {
60  return dataProvider.get();
61  }
62  template <>
63  IDataManagerSvc* Partition::get<IDataManagerSvc>() {
64  return dataManager.get();
65  }
66 
67  // C++20: replace with http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0290r2.html
68  // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4033.html
69 
70 #if TBB_INTERFACE_VERSION_MAJOR < 12
71  template <typename T, typename Mutex = tbb::recursive_mutex, typename ReadLock = typename Mutex::scoped_lock,
72 #else
73  template <typename T, typename Mutex = std::recursive_mutex,
74  typename ReadLock = std::scoped_lock<std::recursive_mutex>,
75 #endif // TBB_INTERFACE_VERSION_MAJOR < 12
76  typename WriteLock = ReadLock>
77  class Synced {
78  T m_obj;
79  mutable Mutex m_mtx;
80 
81  public:
82  template <typename F>
83  decltype( auto ) with_lock( F&& f ) {
84  WriteLock lock{m_mtx};
85  return f( m_obj );
86  }
87  template <typename F>
88  decltype( auto ) with_lock( F&& f ) const {
89  ReadLock lock{m_mtx};
90  return f( m_obj );
91  }
92  };
93  // transform an f(T) into an f(Synced<T>)
94  template <typename Fun>
95  auto with_lock( Fun&& f ) {
96  return [f = std::forward<Fun>( f )]( auto& p ) -> decltype( auto ) { return p.with_lock( f ); };
97  }
98  // call f(T) for each element in a container of Synced<T>
99  template <typename ContainerOfSynced, typename Fun>
100  void for_( ContainerOfSynced& c, Fun&& f ) {
101  std::for_each( begin( c ), end( c ), with_lock( std::forward<Fun>( f ) ) );
102  }
103 } // namespace
104 
105 TTHREAD_TLS( Synced<Partition>* ) s_current = nullptr;
106 
107 namespace {
108  namespace detail {
109  // given a callable F(Arg_t,...)
110  // argument_t<F> will be equal to Arg_t
111  template <typename F>
112  using argument_t = std::tuple_element_t<0, boost::callable_traits::args_t<F>>;
113  } // namespace detail
114 
115  template <typename Fun>
116  StatusCode fwd( Fun f ) {
117  if ( !s_current ) return IDataProviderSvc::Status::INVALID_ROOT;
118  return s_current->with_lock( [&]( Partition& p ) {
119  auto* svc = p.get<std::decay_t<detail::argument_t<Fun>>>();
120  return svc ? f( *svc ) : IDataProviderSvc::Status::INVALID_ROOT;
121  } );
122  }
123 } // namespace
124 
137 class HiveWhiteBoard : public extends<Service, IDataProviderSvc, IDataManagerSvc, IHiveWhiteBoard> {
138 protected:
139  Gaudi::Property<CLID> m_rootCLID{this, "RootCLID", 110 /*CLID_Event*/, "CLID of root entry"};
140  Gaudi::Property<std::string> m_rootName{this, "RootName", "/Event", "name of root entry"};
141  Gaudi::Property<std::string> m_loader{this, "DataLoader", "EventPersistencySvc", ""};
142  Gaudi::Property<size_t> m_slots{this, "EventSlots", 1, "number of event slots"};
143  Gaudi::Property<bool> m_forceLeaves{this, "ForceLeaves", false, "force creation of default leaves on registerObject"};
144  Gaudi::Property<bool> m_enableFaultHdlr{this, "EnableFaultHandler", false,
145  "enable incidents on data creation requests"};
146 
154  tbb::concurrent_queue<size_t> m_freeSlots;
155 
156 public:
158  using extends::extends;
159 
161  ~HiveWhiteBoard() override {
162  setDataLoader( 0 ).ignore();
163  resetPreLoad().ignore();
164  clearStore().ignore();
165  for_( m_partitions, []( Partition& p ) {
166  p.dataManager->release();
167  p.dataProvider->release();
168  } );
170  }
171 
173  size_t freeSlots() override { return m_freeSlots.unsafe_size(); }
174 
176  CLID rootCLID() const override { return (CLID)m_rootCLID; }
178  const std::string& rootName() const override { return m_rootName; }
179 
181  StatusCode registerAddress( std::string_view path, IOpaqueAddress* pAddr ) override {
182  return fwd( [&]( IDataManagerSvc& p ) { return p.registerAddress( path, pAddr ); } );
183  }
185  StatusCode registerAddress( IRegistry* parent, std::string_view path, IOpaqueAddress* pAdd ) override {
186  return fwd( [&]( IDataManagerSvc& p ) { return p.registerAddress( parent, path, pAdd ); } );
187  }
189  StatusCode unregisterAddress( std::string_view path ) override {
190  return fwd( [&]( IDataManagerSvc& p ) { return p.unregisterAddress( path ); } );
191  }
193  StatusCode unregisterAddress( IRegistry* pParent, std::string_view path ) override {
194  return fwd( [&]( IDataManagerSvc& p ) { return p.unregisterAddress( pParent, path ); } );
195  }
197  StatusCode objectLeaves( const DataObject* pObject, std::vector<IRegistry*>& leaves ) override {
198  return fwd( [&]( IDataManagerSvc& p ) { return p.objectLeaves( pObject, leaves ); } );
199  }
201  StatusCode objectLeaves( const IRegistry* pObject, std::vector<IRegistry*>& leaves ) override {
202  return fwd( [&]( IDataManagerSvc& p ) { return p.objectLeaves( pObject, leaves ); } );
203  }
205  StatusCode objectParent( const DataObject* pObject, IRegistry*& refpParent ) override {
206  return fwd( [&]( IDataManagerSvc& p ) { return p.objectParent( pObject, refpParent ); } );
207  }
209  StatusCode objectParent( const IRegistry* pObject, IRegistry*& refpParent ) override {
210  return fwd( [&]( IDataManagerSvc& p ) { return p.objectParent( pObject, refpParent ); } );
211  }
213  StatusCode clearSubTree( std::string_view path ) override {
214  return fwd( [&]( IDataManagerSvc& p ) { return p.clearSubTree( path ); } );
215  }
217  StatusCode clearSubTree( DataObject* pObject ) override {
218  return fwd( [&]( IDataManagerSvc& p ) { return p.clearSubTree( pObject ); } );
219  }
221  StatusCode clearStore() override {
222  for_( m_partitions, []( Partition& p ) { p.dataManager->clearStore().ignore(); } );
223  return StatusCode::SUCCESS;
224  }
225 
227  StatusCode traverseSubTree( std::string_view path, IDataStoreAgent* pAgent ) override {
228  return fwd( [&]( IDataManagerSvc& p ) { return p.traverseSubTree( path, pAgent ); } );
229  }
231  StatusCode traverseSubTree( DataObject* pObject, IDataStoreAgent* pAgent ) override {
232  return fwd( [&]( IDataManagerSvc& p ) { return p.traverseSubTree( pObject, pAgent ); } );
233  }
236  return fwd( [&]( IDataManagerSvc& p ) { return p.traverseTree( pAgent ); } );
237  }
241  return fwd(
242  [pObj, path = std::move( path )]( IDataManagerSvc& p ) { return p.setRoot( std::move( path ), pObj ); } );
243  }
244 
248  return fwd(
249  [pAddr, path = std::move( path )]( IDataManagerSvc& p ) { return p.setRoot( std::move( path ), pAddr ); } );
250  }
251 
256  StatusCode setDataLoader( IConversionSvc* pDataLoader, IDataProviderSvc* = nullptr ) override {
257  if ( pDataLoader ) pDataLoader->addRef();
259  if ( pDataLoader ) pDataLoader->setDataProvider( this ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
260  m_dataLoader = pDataLoader;
261  for_( m_partitions, [&]( Partition& p ) { p.dataManager->setDataLoader( m_dataLoader, this ).ignore(); } );
262  return StatusCode::SUCCESS;
263  }
265  StatusCode addPreLoadItem( const DataStoreItem& item ) override {
266  for_( m_partitions, [&]( Partition& p ) {
267  p.dataProvider->addPreLoadItem( item ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
268  } );
269  return StatusCode::SUCCESS;
270  }
272  StatusCode removePreLoadItem( const DataStoreItem& item ) override {
273  for_( m_partitions, [&]( Partition& p ) {
274  p.dataProvider->removePreLoadItem( item ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
275  } );
276  return StatusCode::SUCCESS;
277  }
280  for_( m_partitions, [&]( Partition& p ) {
281  p.dataProvider->resetPreLoad().ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
282  } );
283  return StatusCode::SUCCESS;
284  }
286  StatusCode preLoad() override {
287  return fwd( [&]( IDataProviderSvc& p ) { return p.preLoad(); } );
288  }
290  StatusCode registerObject( std::string_view parent, std::string_view obj, DataObject* pObj ) override {
291  return fwd( [&]( IDataProviderSvc& p ) { return p.registerObject( parent, obj, pObj ); } );
292  }
294  StatusCode registerObject( DataObject* parent, std::string_view obj, DataObject* pObj ) override {
295  return fwd( [&]( IDataProviderSvc& p ) { return p.registerObject( parent, obj, pObj ); } );
296  }
298  StatusCode unregisterObject( std::string_view path ) override {
299  return fwd( [&]( IDataProviderSvc& p ) { return p.unregisterObject( path ); } );
300  }
303  return fwd( [&]( IDataProviderSvc& p ) { return p.unregisterObject( pObj ); } );
304  }
306  StatusCode unregisterObject( DataObject* pObj, std::string_view path ) override {
307  return fwd( [&]( IDataProviderSvc& p ) { return p.unregisterObject( pObj, path ); } );
308  }
310  StatusCode retrieveObject( IRegistry* parent, std::string_view path, DataObject*& pObj ) override {
311  return fwd( [&]( IDataProviderSvc& p ) { return p.retrieveObject( parent, path, pObj ); } );
312  }
314  StatusCode findObject( std::string_view path, DataObject*& pObj ) override {
315  return fwd( [&]( IDataProviderSvc& p ) { return p.retrieveObject( path, pObj ); } );
316  }
318  StatusCode findObject( IRegistry* parent, std::string_view path, DataObject*& pObj ) override {
319  return fwd( [&]( IDataProviderSvc& p ) { return p.retrieveObject( parent, path, pObj ); } );
320  }
322  StatusCode linkObject( IRegistry* from, std::string_view objPath, DataObject* to ) override {
323  return fwd( [&]( IDataProviderSvc& p ) { return p.linkObject( from, objPath, to ); } );
324  }
326  StatusCode linkObject( std::string_view fullPath, DataObject* to ) override {
327  return fwd( [&]( IDataProviderSvc& p ) { return p.linkObject( fullPath, to ); } );
328  }
330  StatusCode unlinkObject( IRegistry* from, std::string_view objPath ) override {
331  return fwd( [&]( IDataProviderSvc& p ) { return p.unlinkObject( from, objPath ); } );
332  }
334  StatusCode unlinkObject( DataObject* from, std::string_view objPath ) override {
335  return fwd( [&]( IDataProviderSvc& p ) { return p.unlinkObject( from, objPath ); } );
336  }
338  StatusCode unlinkObject( std::string_view path ) override {
339  return fwd( [&]( IDataProviderSvc& p ) { return p.unlinkObject( path ); } );
340  }
342  StatusCode updateObject( IRegistry* pDirectory ) override {
343  return fwd( [&]( IDataProviderSvc& p ) { return p.updateObject( pDirectory ); } );
344  }
346  StatusCode updateObject( DataObject* pObj ) override {
347  return fwd( [&]( IDataProviderSvc& p ) { return p.updateObject( pObj ); } );
348  }
349 
350  //
351  //---IHiveWhiteBard implemenation--------------------------------------------------
352  //
353 
355  StatusCode clearStore( size_t partition ) override {
356  return m_partitions[partition].with_lock( []( Partition& p ) { return p.dataManager->clearStore(); } );
357  }
358 
360  StatusCode selectStore( size_t partition ) override {
361  s_current = &m_partitions[partition];
362  return StatusCode::SUCCESS;
363  }
364 
366  StatusCode setNumberOfStores( size_t slots ) override {
368  warning() << "Too late to change the number of slots!" << endmsg;
369  return StatusCode::FAILURE;
370  }
371  m_slots = slots;
373  return StatusCode::SUCCESS;
374  }
375 
377  size_t getNumberOfStores() const override { return m_slots; }
378 
380  bool exists( const DataObjID& id ) override {
381  DataObject* pObject{nullptr};
382  return findObject( id.fullKey(), pObject ).isSuccess();
383  }
384 
386  size_t allocateStore( int evtnumber ) override {
387  // take next free slot in the list
388  size_t slot = std::string::npos;
389  if ( m_freeSlots.try_pop( slot ) ) {
390  assert( slot != std::string::npos );
391  assert( slot < m_partitions.size() );
392  m_partitions[slot].with_lock( [evtnumber]( Partition& p ) {
393  assert( p.eventNumber == -1 ); // or whatever value represents 'free'
394  p.eventNumber = evtnumber;
395  } );
396  }
397  return slot;
398  }
399 
401  StatusCode freeStore( size_t partition ) override {
402  assert( partition < m_partitions.size() );
403  auto prev = m_partitions[partition].with_lock( []( Partition& p ) { return std::exchange( p.eventNumber, -1 ); } );
404  if ( UNLIKELY( prev == -1 ) ) return StatusCode::FAILURE; // double free -- should never happen!
405  m_freeSlots.push( partition );
406  return StatusCode::SUCCESS;
407  }
408 
410  size_t getPartitionNumber( int eventnumber ) const override {
412  with_lock( [eventnumber]( const Partition& p ) { return p.eventNumber == eventnumber; } ) );
413  return i != end( m_partitions ) ? std::distance( begin( m_partitions ), i ) : std::string::npos;
414  }
415 
417  StatusCode sc = service( m_loader, m_addrCreator, true );
418  if ( !sc.isSuccess() ) {
419  error() << "Failed to retrieve data loader "
420  << "\"" << m_loader << "\"" << endmsg;
421  return sc;
422  }
423  IConversionSvc* dataLoader = nullptr;
424  sc = service( m_loader, dataLoader, true );
425  if ( !sc.isSuccess() ) {
426  error() << MSG::ERROR << "Failed to retrieve data loader "
427  << "\"" << m_loader << "\"" << endmsg;
428  return sc;
429  }
430  sc = setDataLoader( dataLoader );
431  dataLoader->release();
432  if ( !sc.isSuccess() ) {
433  error() << MSG::ERROR << "Failed to set data loader "
434  << "\"" << m_loader << "\"" << endmsg;
435  return sc;
436  }
437  return sc;
438  }
439 
443  m_addrCreator = nullptr;
444  m_dataLoader = nullptr;
445  return StatusCode::SUCCESS;
446  }
447 
448  //
449  //---IService implemenation---------------------------------------------------------
450  //
451 
453  StatusCode initialize() override {
455  if ( !sc.isSuccess() ) {
456  error() << "Unable to initialize base class" << endmsg;
457  return sc;
458  }
459  if ( m_slots < (size_t)1 ) {
460  error() << "Invalid number of slots (" << m_slots << ")" << endmsg;
461  return StatusCode::FAILURE;
462  }
463 
464  if ( !setNumberOfStores( m_slots ).isSuccess() ) {
465  error() << "Cannot set number of slots" << endmsg;
466  return StatusCode::FAILURE;
467  }
468 
470  for ( size_t i = 0; i < m_slots; i++ ) {
471  DataSvc* svc = new DataSvc( name() + "_" + std::to_string( i ), serviceLocator() );
472  // Percolate properties
473  svc->setProperty( m_rootCLID ).ignore();
474  svc->setProperty( m_rootName ).ignore();
475  svc->setProperty( m_forceLeaves ).ignore();
477  // make sure that CommonMessaging is initialized
478  svc->setProperty( m_outputLevel ).ignore();
479 
480  sc = svc->initialize();
481  if ( !sc.isSuccess() ) {
482  error() << "Failed to instantiate DataSvc as store partition" << endmsg;
483  return sc;
484  }
485  m_partitions[i].with_lock( [&]( Partition& p ) {
486  p.dataProvider = svc;
487  p.dataManager = svc;
488  } );
489  m_freeSlots.push( i );
490  }
491  selectStore( 0 ).ignore();
492  return attachServices();
493  }
494 
498  if ( !sc.isSuccess() ) {
499  error() << "Unable to reinitialize base class" << endmsg;
500  return sc;
501  }
502  detachServices().ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
503  sc = attachServices();
504  if ( !sc.isSuccess() ) {
505  error() << "Failed to attach necessary services." << endmsg;
506  return sc;
507  }
508  return StatusCode::SUCCESS;
509  }
510 
512  StatusCode finalize() override {
513  setDataLoader( 0 ).ignore();
514  clearStore().ignore();
515  return Service::finalize();
516  }
517 };
518 
519 // Instantiation of a static factory class used by clients to create
520 // instances of this service
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Gaudi::Property< int > m_outputLevel
Definition: Service.h:186
#define UNLIKELY(x)
Definition: Kernel.h:106
StatusCode initialize() override
Definition: Service.cpp:70
Gaudi::Property< std::string > m_rootName
StatusCode unregisterObject(DataObject *pObj) override
Unregister object from the data store.
StatusCode registerAddress(std::string_view path, IOpaqueAddress *pAddr) override
IDataManagerSvc: Register object address with the data store.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:287
StatusCode retrieveObject(IRegistry *parent, std::string_view path, DataObject *&pObj) override
Retrieve object from data store.
size_t allocateStore(int evtnumber) override
Allocate a store partition for a given event number.
virtual StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves)=0
Explore the object store: retrieve all leaves attached to the object The object is identified by its ...
T distance(T... args)
virtual StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress)=0
Register object address with the data store.
virtual StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *toObj)=0
Add a link to another object.
Gaudi::Property< bool > m_enableFaultHdlr
StatusCode finalize() override
Definition: Service.cpp:174
Implementation of property with value of concrete type.
Definition: Property.h:370
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:62
StatusCode setProperty(const Gaudi::Details::PropertyBase &p) override
set the property form another property
virtual StatusCode traverseSubTree(std::string_view sub_tree_path, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by its full path name.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
StatusCode freeStore(size_t partition) override
Free a store partition.
StatusCode registerObject(std::string_view parent, std::string_view obj, DataObject *pObj) override
Register object with the data store.
StatusCode traverseSubTree(std::string_view path, IDataStoreAgent *pAgent) override
Analyze by traversing all data objects below the sub tree.
StatusCode unregisterObject(std::string_view path) override
Unregister object from the data store.
StatusCode clearStore(size_t partition) override
Remove all data objects in one 'slot' of the data store.
StatusCode linkObject(std::string_view fullPath, DataObject *to) override
Add a link to another object.
StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *to) override
Add a link to another object.
StatusCode unregisterObject(DataObject *pObj, std::string_view path) override
Unregister object from the data store.
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
virtual StatusCode unregisterAddress(std::string_view fullPath)=0
Unregister object address from the data store.
T to_string(T... args)
IAddressCreator interface definition.
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
Gaudi::Property< std::string > m_loader
StatusCode unregisterAddress(IRegistry *pParent, std::string_view path) override
IDataManagerSvc: Unregister object address from the data store.
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
virtual StatusCode preLoad()=0
Load all preload items of the list.
StatusCode resetPreLoad() override
Clear the preload list.
StatusCode finalize() override
Service initialisation.
StatusCode clearSubTree(DataObject *pObject) override
Remove all data objects below the sub tree identified.
StatusCode objectParent(const IRegistry *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
StatusCode addPreLoadItem(const DataStoreItem &item) override
Add an item to the preload list.
StatusCode updateObject(DataObject *pObj) override
Update object.
std::vector< Synced< Partition > > m_partitions
Datastore partitions.
StatusCode clearSubTree(std::string_view path) override
Remove all data objects below the sub tree identified.
auto get(const Handle &handle, const Algo &, const EventContext &) -> decltype(details::deref(handle.get()))
Data provider interface definition.
StatusCode preLoad() override
load all preload items of the list
Description of the DataStoreItem class.
Definition: DataStoreItem.h:27
StatusCode unregisterAddress(std::string_view path) override
IDataManagerSvc: Unregister object address from the data store.
StatusCode unlinkObject(std::string_view path) override
Remove a link to another object.
size_t freeSlots() override
Get free slots number.
virtual StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent)=0
IDataManagerSvc: Explore the object store: retrieve the object's parent.
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
virtual StatusCode unlinkObject(IRegistry *from, std::string_view objPath)=0
Remove a link to another object.
size_t getPartitionNumber(int eventnumber) const override
Get the partition number corresponding to a given event.
StatusCode selectStore(size_t partition) override
Activate a partition object. The identifies the partition uniquely.
Invalid root path object cannot be retrieved or stored.
STL class.
#define DECLARE_COMPONENT(type)
StatusCode registerAddress(IRegistry *parent, std::string_view path, IOpaqueAddress *pAdd) override
IDataManagerSvc: Register object address with the data store.
virtual StatusCode unregisterObject(std::string_view fullPath)=0
Unregister object from the data store.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:284
virtual StatusCode clearSubTree(std::string_view sub_path)=0
Remove all data objects below the sub tree identified by its full path name.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode detachServices()
Gaudi::Property< CLID > m_rootCLID
TupleObj.h GaudiAlg/TupleObj.h namespace with few technical implementations.
StatusCode objectLeaves(const IRegistry *pObject, std::vector< IRegistry * > &leaves) override
Explore the object store: retrieve all leaves attached to the object.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
typename arg_helper< lambda >::type argument_t
Definition: EventIDBase.h:43
virtual StatusCode updateObject(IRegistry *pDirectory)=0
Update object identified by its directory entry.
CLID rootCLID() const override
IDataManagerSvc: Accessor for root event CLID.
T lock(T... args)
StatusCode removePreLoadItem(const DataStoreItem &item) override
Remove an item from the preload list.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:32
StatusCode reinitialize() override
Definition: Service.cpp:247
def end
Definition: IOTest.py:123
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
T clear(T... args)
bool isSuccess() const
Definition: StatusCode.h:365
size_t getNumberOfStores() const override
Get the number of event slots (copies of DataSvc objects).
Gaudi::Property< size_t > m_slots
T move(T... args)
const std::string & rootName() const override
Name for root Event.
Data service base class.
TTHREAD_TLS(Synced< Partition > *) s_current
StatusCode attachServices()
StatusCode traverseSubTree(DataObject *pObject, IDataStoreAgent *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects below the sub tree.
T find_if(T... args)
T size(T... args)
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:168
StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
StatusCode setRoot(std::string path, IOpaqueAddress *pAddr) override
Initialize data store for new event by giving new event path and address of root object.
STL class.
StatusCode unlinkObject(DataObject *from, std::string_view objPath) override
Remove a link to another object.
virtual StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
virtual unsigned long release()=0
Release Interface instance.
IAddressCreator * m_addrCreator
Reference to address creator.
Generic data agent interface.
StatusCode registerObject(std::string_view fullPath, DataObject *pObject)
Register object with the data store.
Gaudi::Property< bool > m_forceLeaves
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
StatusCode initialize() override
Service initialization.
Definition: DataSvc.cpp:822
StatusCode setRoot(std::string path, DataObject *pObj) override
Initialize data store for new event by giving new event path and root object.
Data service base class.
Definition: DataSvc.h:52
StatusCode setDataLoader(IConversionSvc *pDataLoader, IDataProviderSvc *=nullptr) override
IDataManagerSvc: Pass a default data loader to the service.
constexpr static const auto FAILURE
Definition: StatusCode.h:101
const Gaudi::Algorithm & parent
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &leaves) override
Explore the object store: retrieve all leaves attached to the object.
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:93
StatusCode initialize() override
Service initialisation.
StatusCode traverseTree(IDataStoreAgent *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects in the data store.
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Opaque address interface definition.
IConversionSvc * m_dataLoader
Pointer to data loader service.
StatusCode findObject(std::string_view path, DataObject *&pObj) override
Find object identified by its full path in the data store.
T for_each(T... args)
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:40
StatusCode findObject(IRegistry *parent, std::string_view path, DataObject *&pObj) override
Find object identified by its full path in the data store.
tbb::concurrent_queue< size_t > m_freeSlots
fifo queue of free slots
StatusCode unlinkObject(IRegistry *from, std::string_view objPath) override
Remove a link to another object.
bool exists(const DataObjID &id) override
check if a data object exists in the current store
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
static GAUDI_API void setNumConcEvents(const std::size_t &nE)
StatusCode reinitialize() override
Service initialisation.
StatusCode setNumberOfStores(size_t slots) override
Set the number of event slots (copies of DataSvc objects).
~HiveWhiteBoard() override
Standard Destructor.
StatusCode registerObject(DataObject *parent, std::string_view obj, DataObject *pObj) override
Register object with the data store.