The Gaudi Framework  v32r0 (3325bb39)
EvtStoreSvc.cpp
Go to the documentation of this file.
8 #include "GaudiKernel/Service.h"
9 #include "GaudiKernel/System.h"
10 
11 #include "ThreadLocalStorage.h"
12 
13 #include "boost/algorithm/string/predicate.hpp"
14 
15 #include "tbb/concurrent_queue.h"
16 #include "tbb/mutex.h"
17 #include "tbb/recursive_mutex.h"
18 
19 #include <algorithm>
20 #include <iomanip>
21 #include <iterator>
22 #include <map>
23 #include <stdexcept>
24 #include <type_traits>
25 #include <unordered_map>
26 #include <utility>
27 #include <vector>
28 
29 namespace {
30 
31  class Entry final : public IRegistry {
34  std::string m_identifier;
35  static IDataProviderSvc* s_svc;
36 
37  public:
38  static void setDataProviderSvc( IDataProviderSvc* p ) { s_svc = p; }
39 
40  Entry( std::string id, std::unique_ptr<DataObject> data, std::unique_ptr<IOpaqueAddress> addr = {} ) noexcept
41  : m_data{std::move( data )}, m_addr{std::move( addr )}, m_identifier{std::move( id )} {
42  if ( m_data ) m_data->setRegistry( this );
43  if ( m_addr ) m_addr->setRegistry( this );
44  }
45  Entry( const Entry& ) = delete;
46  Entry& operator=( const Entry& rhs ) = delete;
47  Entry( Entry&& rhs ) = delete;
48  Entry& operator=( Entry&& rhs ) = delete;
49 
50  // required by IRegistry...
51  unsigned long addRef() override { return -1; }
52  unsigned long release() override { return -1; }
53  const name_type& name() const override { return m_identifier; } // should really be from last '/' onward...
54  const id_type& identifier() const override { return m_identifier; }
55  IDataProviderSvc* dataSvc() const override { return s_svc; }
56  DataObject* object() const override { return const_cast<DataObject*>( m_data.get() ); }
57  IOpaqueAddress* address() const override { return m_addr.get(); }
58  void setAddress( IOpaqueAddress* iAddr ) override { m_addr.reset( iAddr ); }
59  };
60  IDataProviderSvc* Entry::s_svc = nullptr;
61 
63  using OrderedMap = std::map<std::string_view, Entry>;
64 
65  template <typename Map = UnorderedMap>
66  class Store {
67  Map m_store;
68  static_assert( std::is_same_v<typename Map::key_type, std::string_view> );
69 
70  const auto& emplace( std::string_view k, std::unique_ptr<DataObject> d ) {
71  // tricky way to insert a string_view key which points to the
72  // string contained in the mapped type...
73  auto [i, b] = m_store.try_emplace( k, std::string{k}, std::move( d ) );
74  if ( !b ) throw std::runtime_error( "failed to insert " + std::string{k} );
75  auto nh = m_store.extract( i );
76  nh.key() = nh.mapped().identifier(); // "re-point" key to the string contained in the Entry
77  auto r = m_store.insert( std::move( nh ) );
78  if ( !r.inserted ) throw std::runtime_error( "failed to insert " + std::string{k} );
79  return r.position->second;
80  }
81 
82  public:
83  const DataObject* put( std::string_view k, std::unique_ptr<DataObject> data ) {
84  return emplace( k, std::move( data ) ).object();
85  }
86 
87  const DataObject* get( std::string_view k ) const noexcept {
88  const Entry* d = find( k );
89  return d ? d->object() : nullptr;
90  }
91  const Entry* find( std::string_view k ) const noexcept {
92  auto i = m_store.find( k );
93  return i != m_store.end() ? &( i->second ) : nullptr;
94  }
95 
96  auto begin() const noexcept { return m_store.begin(); }
97  auto end() const noexcept { return m_store.end(); }
98  void clear() noexcept { m_store.clear(); }
99  auto erase( std::string_view k ) { return m_store.erase( k ); }
100  template <typename Predicate>
101  void erase_if( Predicate p ) {
102  auto i = m_store.begin();
103  auto end = m_store.end();
104  while ( i != end ) {
105  if ( std::invoke( p, std::as_const( *i ) ) )
106  i = m_store.erase( i );
107  else
108  ++i;
109  }
110  }
111  };
112 
113  StatusCode dummy( std::string s ) {
114  std::string trace;
115  System::backTrace( trace, 6, 2 );
116  throw std::logic_error{"Unsupported Function Called: " + s + "\n" + trace};
117  return StatusCode::FAILURE;
118  }
119 
120  std::string_view normalize_path( std::string_view path, std::string_view prefix ) {
121  if ( path.size() >= prefix.size() && std::equal( prefix.begin(), prefix.end(), path.begin() ) )
122  path.remove_prefix( prefix.size() );
123  if ( !path.empty() && path.front() == '/' ) path.remove_prefix( 1 );
124  return path;
125  }
126 
128  DataObject* pObject = nullptr;
129  auto status = cnv.createObj( &addr, pObject ); // Call data loader
130  auto object = std::unique_ptr<DataObject>( pObject );
131  if ( status.isFailure() ) object.reset();
132  return object;
133  }
134 
135  // HiveWhiteBoard helpers
136  struct Partition final {
137  Store<> store;
138  int eventNumber = -1;
139  };
140 
141  template <typename T, typename Mutex = tbb::recursive_mutex, typename ReadLock = typename Mutex::scoped_lock,
142  typename WriteLock = ReadLock>
143  class Synced {
144  T m_obj;
145  mutable Mutex m_mtx;
146 
147  public:
148  template <typename F>
149  decltype( auto ) with_lock( F&& f ) {
150  WriteLock lock{m_mtx};
151  return f( m_obj );
152  }
153  template <typename F>
154  decltype( auto ) with_lock( F&& f ) const {
155  ReadLock lock{m_mtx};
156  return f( m_obj );
157  }
158  };
159  // transform an f(T) into an f(Synced<T>)
160  template <typename Fun>
161  auto with_lock( Fun&& f ) {
162  return [f = std::forward<Fun>( f )]( auto& p ) -> decltype( auto ) { return p.with_lock( f ); };
163  }
164 
165  TTHREAD_TLS( Synced<Partition>* ) s_current = nullptr;
166 
167  template <typename Fun>
168  StatusCode fwd( Fun&& f ) {
169  return s_current ? s_current->with_lock( std::forward<Fun>( f ) )
171  }
172 
173 } // namespace
174 
185 class GAUDI_API EvtStoreSvc : public extends<Service, IDataProviderSvc, IDataManagerSvc, IHiveWhiteBoard> {
186  Gaudi::Property<CLID> m_rootCLID{this, "RootCLID", 110 /*CLID_Event*/, "CLID of root entry"};
187  Gaudi::Property<std::string> m_rootName{this, "RootName", "/Event", "name of root entry"};
188  Gaudi::Property<bool> m_forceLeaves{this, "ForceLeaves", false, "force creation of default leaves on registerObject"};
189  Gaudi::Property<std::string> m_loader{this, "DataLoader", "EventPersistencySvc"};
190  Gaudi::Property<size_t> m_slots{this, "EventSlots", 1, "number of event slots"};
191 
193 
196 
199 
200  tbb::concurrent_queue<size_t> m_freeSlots;
201 
202 public:
203  using extends::extends;
204 
205  CLID rootCLID() const override;
206  const std::string& rootName() const override;
207  StatusCode setDataLoader( IConversionSvc* svc, IDataProviderSvc* dpsvc ) override;
208 
209  size_t allocateStore( int evtnumber ) override;
210  StatusCode freeStore( size_t partition ) override;
211  size_t freeSlots() override { return m_freeSlots.unsafe_size(); }
212  StatusCode selectStore( size_t partition ) override;
213  StatusCode clearStore() override;
214  StatusCode clearStore( size_t partition ) override;
215  StatusCode setNumberOfStores( size_t slots ) override;
216  size_t getNumberOfStores() const override { return m_slots; }
217  size_t getPartitionNumber( int eventnumber ) const override;
218  bool exists( const DataObjID& id ) override {
219  DataObject* pObject{nullptr};
220  return findObject( id.fullKey(), pObject ).isSuccess();
221  }
222 
223  StatusCode objectParent( const DataObject*, IRegistry*& ) override { return dummy( __FUNCTION__ ); }
224  StatusCode objectParent( const IRegistry*, IRegistry*& ) override { return dummy( __FUNCTION__ ); }
225  StatusCode objectLeaves( const DataObject*, std::vector<IRegistry*>& ) override { return dummy( __FUNCTION__ ); }
226  StatusCode objectLeaves( const IRegistry*, std::vector<IRegistry*>& ) override { return dummy( __FUNCTION__ ); }
227 
228  StatusCode clearSubTree( std::string_view ) override;
229  StatusCode clearSubTree( DataObject* obj ) override {
230  return obj && obj->registry() ? clearSubTree( obj->registry()->identifier() ) : StatusCode::FAILURE;
231  }
232 
233  StatusCode traverseSubTree( std::string_view, IDataStoreAgent* ) override;
235  return ( obj && obj->registry() ) ? traverseSubTree( obj->registry()->identifier(), pAgent ) : StatusCode::FAILURE;
236  }
237  StatusCode traverseTree( IDataStoreAgent* pAgent ) override { return traverseSubTree( std::string_view{}, pAgent ); }
238 
239  StatusCode setRoot( std::string root_name, DataObject* pObject ) override;
240  StatusCode setRoot( std::string root_path, IOpaqueAddress* pRootAddr ) override;
241 
242  StatusCode unregisterAddress( std::string_view ) override { return dummy( __FUNCTION__ ); };
243  StatusCode unregisterAddress( IRegistry*, std::string_view ) override { return dummy( __FUNCTION__ ); };
244 
245  StatusCode registerAddress( std::string_view fullPath, IOpaqueAddress* pAddress ) override;
246  StatusCode registerAddress( IRegistry* parentObj, std::string_view objectPath, IOpaqueAddress* pAddress ) override;
247  StatusCode registerObject( std::string_view parentPath, std::string_view objectPath, DataObject* pObject ) override;
248  StatusCode registerObject( DataObject* parentObj, std::string_view objectPath, DataObject* pObject ) override;
249 
250  StatusCode unregisterObject( std::string_view ) override;
252  return ( obj && obj->registry() ) ? unregisterObject( obj->registry()->identifier() ) : StatusCode::FAILURE;
253  }
254  StatusCode unregisterObject( DataObject* obj, std::string_view sr ) override {
255  return !obj ? unregisterObject( sr )
256  : obj->registry() ? unregisterObject( ( obj->registry()->identifier() + '/' ).append( sr ) )
258  };
259 
260  StatusCode retrieveObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) override;
261 
262  StatusCode findObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) override;
263  StatusCode findObject( std::string_view fullPath, DataObject*& pObject ) override;
264 
265  StatusCode updateObject( IRegistry* ) override { return dummy( __FUNCTION__ ); }
266  StatusCode updateObject( DataObject* ) override { return dummy( __FUNCTION__ ); }
267 
268  StatusCode addPreLoadItem( const DataStoreItem& ) override;
269  StatusCode removePreLoadItem( const DataStoreItem& ) override;
271  m_preLoads.clear();
272  return StatusCode::SUCCESS;
273  }
274  StatusCode preLoad() override;
275 
276  StatusCode linkObject( IRegistry*, std::string_view, DataObject* ) override { return dummy( __FUNCTION__ ); }
277  StatusCode linkObject( std::string_view, DataObject* ) override { return dummy( __FUNCTION__ ); }
278  StatusCode unlinkObject( IRegistry*, std::string_view ) override { return dummy( __FUNCTION__ ); }
279  StatusCode unlinkObject( DataObject*, std::string_view ) override { return dummy( __FUNCTION__ ); }
280  StatusCode unlinkObject( std::string_view ) override { return dummy( __FUNCTION__ ); }
281 
282  StatusCode initialize() override {
283  Entry::setDataProviderSvc( this );
284  extends::initialize().ignore();
285  if ( !setNumberOfStores( m_slots ).isSuccess() ) {
286  error() << "Cannot set number of slots" << endmsg;
287  return StatusCode::FAILURE;
288  }
289  m_partitions = std::vector<Synced<Partition>>( m_slots );
290  for ( size_t i = 0; i < m_slots; i++ ) { m_freeSlots.push( i ); }
291  selectStore( 0 ).ignore();
292 
293  auto loader = serviceLocator()->service( m_loader ).as<IConversionSvc>().get();
294  if ( !loader ) {
295  error() << "Cannot get IConversionSvc " << m_loader.value() << endmsg;
296  return StatusCode::FAILURE;
297  }
298  return setDataLoader( loader, nullptr );
299  }
300  StatusCode finalize() override {
301  setDataLoader( nullptr, nullptr ).ignore(); // release
302  return extends::finalize();
303  }
304 };
305 
306 // Instantiation of a static factory class used by clients to create
307 // instances of this service
309 
310 CLID EvtStoreSvc::rootCLID() const { return m_rootCLID; }
311 const std::string& EvtStoreSvc::rootName() const { return m_rootName; }
313  m_dataLoader = pDataLoader;
314  if ( m_dataLoader ) m_dataLoader->setDataProvider( dpsvc ? dpsvc : this ).ignore();
315  return StatusCode::SUCCESS;
316 }
318 size_t EvtStoreSvc::allocateStore( int evtnumber ) {
319  // take next free slot in the list
320  size_t slot = std::string::npos;
321  if ( m_freeSlots.try_pop( slot ) ) {
322  assert( slot != std::string::npos );
323  assert( slot < m_partitions.size() );
324  [[maybe_unused]] auto prev = m_partitions[slot].with_lock(
325  [evtnumber]( Partition& p ) { return std::exchange( p.eventNumber, evtnumber ); } );
326  assert( prev == -1 ); // or whatever value represents 'free'
327  }
328  return slot;
329 }
332  if ( slots < size_t{1} ) {
333  error() << "Invalid number of slots (" << slots << ")" << endmsg;
334  return StatusCode::FAILURE;
335  }
336  if ( FSMState() == Gaudi::StateMachine::INITIALIZED || FSMState() == Gaudi::StateMachine::RUNNING ) {
337  error() << "Too late to change the number of slots!" << endmsg;
338  return StatusCode::FAILURE;
339  }
340  m_slots = slots;
342  return StatusCode::SUCCESS;
343 }
345 size_t EvtStoreSvc::getPartitionNumber( int eventnumber ) const {
346  auto i = std::find_if( begin( m_partitions ), end( m_partitions ),
347  with_lock( [eventnumber]( const Partition& p ) { return p.eventNumber == eventnumber; } ) );
348  return i != end( m_partitions ) ? std::distance( begin( m_partitions ), i ) : std::string::npos;
349 }
352  s_current = &m_partitions[partition];
353  return StatusCode::SUCCESS;
354 }
356 StatusCode EvtStoreSvc::freeStore( size_t partition ) {
357  assert( partition < m_partitions.size() );
358  auto prev = m_partitions[partition].with_lock( []( Partition& p ) { return std::exchange( p.eventNumber, -1 ); } );
359  if ( UNLIKELY( prev == -1 ) ) return StatusCode::FAILURE; // double free -- should never happen!
360  m_freeSlots.push( partition );
361  return StatusCode::SUCCESS;
362 }
364 StatusCode EvtStoreSvc::clearStore( size_t partition ) {
365  return m_partitions[partition].with_lock( []( Partition& p ) {
366  p.store.clear();
367  return StatusCode::SUCCESS;
368  } );
369 }
370 StatusCode EvtStoreSvc::clearSubTree( std::string_view top ) {
371  top = normalize_path( top, rootName() );
372  return fwd( [&]( Partition& p ) {
373  p.store.erase_if( [top]( const auto& value ) { return boost::algorithm::starts_with( value.first, top ); } );
374  return StatusCode::SUCCESS;
375  } );
376 }
378  return fwd( []( Partition& p ) {
379  p.store.clear();
380  return StatusCode::SUCCESS;
381  } );
382 }
383 StatusCode EvtStoreSvc::traverseSubTree( std::string_view top, IDataStoreAgent* pAgent ) {
384  return fwd( [&]( Partition& p ) {
385  top = normalize_path( top, rootName() );
386  auto cmp = []( const Entry* lhs, const Entry* rhs ) { return lhs->identifier() < rhs->identifier(); };
388  for ( const auto& v : p.store ) {
389  if ( boost::algorithm::starts_with( v.second.identifier(), top ) ) keys.insert( &v.second );
390  }
391  auto k = keys.begin();
392  while ( k != keys.end() ) {
393  const auto& id = ( *k )->identifier();
394  always() << "analyzing " << id << endmsg;
395  int level = std::count( id.begin(), id.end(), '/' );
396  bool accept = pAgent->analyse( const_cast<Entry*>( *( k++ ) ), level );
397  if ( !accept ) {
398  while ( k != keys.end() && boost::algorithm::starts_with( ( *k )->identifier(), id ) ) {
399  always() << "skipping " << ( *k )->identifier() << endmsg;
400  ++k;
401  }
402  }
403  }
404  return StatusCode::SUCCESS;
405  } );
406 }
408  if ( msgLevel( MSG::DEBUG ) ) {
409  debug() << "setRoot( " << root_path << ", (DataObject*)" << (void*)pObject << " )" << endmsg;
410  }
411  clearStore().ignore();
412  return registerObject( nullptr, root_path, pObject );
413 }
415  auto rootAddr = std::unique_ptr<IOpaqueAddress>( pRootAddr );
416  if ( msgLevel( MSG::DEBUG ) ) {
417  debug() << "setRoot( " << root_path << ", (IOpaqueAddress*)" << (void*)rootAddr.get() << " )" << endmsg;
418  }
419  clearStore().ignore();
420  if ( !rootAddr ) return Status::INVALID_OBJ_ADDR; // Precondition: Address must be valid
421  if ( msgLevel( MSG::DEBUG ) ) {
422  const std::string* par = rootAddr->par();
423  debug() << "par[0]=" << par[0] << endmsg;
424  debug() << "par[1]=" << par[1] << endmsg;
425  }
426  auto object = createObj( *m_dataLoader, *rootAddr ); // Call data loader
427  if ( !object ) return Status::INVALID_OBJECT;
428  if ( msgLevel( MSG::DEBUG ) ) { debug() << "Root Object " << root_path << " created " << endmsg; }
429  auto dummy = Entry{root_path, {}, std::move( rootAddr )};
430  object->setRegistry( &dummy );
431  auto status = m_dataLoader->fillObjRefs( dummy.address(), object.get() );
432  return status.isSuccess() ? registerObject( nullptr, root_path, object.release() ) : status;
433 }
434 StatusCode EvtStoreSvc::registerAddress( std::string_view path, IOpaqueAddress* pAddr ) {
435  return registerAddress( nullptr, path, pAddr );
436 }
437 StatusCode EvtStoreSvc::registerAddress( IRegistry* pReg, std::string_view path, IOpaqueAddress* pAddr ) {
438  auto addr = std::unique_ptr<IOpaqueAddress>( pAddr );
439  if ( msgLevel( MSG::DEBUG ) ) {
440  debug() << "registerAddress( (IRegistry*)" << (void*)pReg << ", " << path << ", (IOpaqueAddress*)" << addr.get()
441  << "[ " << addr->par()[0] << ", " << addr->par()[1] << " ]"
442  << " )" << endmsg;
443  }
444  if ( !addr ) return Status::INVALID_OBJ_ADDR; // Precondition: Address must be valid
445  if ( path.empty() || path[0] != '/' ) return StatusCode::FAILURE;
446  auto object = createObj( *m_dataLoader, *addr ); // Call data loader
447  if ( !object ) return Status::INVALID_OBJECT;
448  auto fullpath = ( pReg ? pReg->identifier() : m_rootName.value() ) + std::string{path};
449  // the data loader expects the path _including_ the root
450  auto dummy = Entry{fullpath, {}, std::move( addr )};
451  object->setRegistry( &dummy );
452  auto status = m_dataLoader->fillObjRefs( dummy.address(), object.get() );
453  if ( !status.isSuccess() ) return status;
454  // note: put will overwrite the registry in pObject to point at the
455  // one actually used -- so we do not dangle, pointing at dummy beyond its
456  // lifetime
457  if ( msgLevel( MSG::DEBUG ) ) {
458  debug() << "registerAddress: " << std::quoted( normalize_path( fullpath, rootName() ) ) << " (DataObject*)"
459  << (void*)object.get() << ( object ? " -> " + System::typeinfoName( typeid( *object ) ) : std::string{} )
460  << endmsg;
461  }
462  fwd( [&]( Partition& p ) {
463  p.store.put( normalize_path( fullpath, rootName() ), std::move( object ) );
464  return StatusCode::SUCCESS;
465  } ).ignore();
466  return status;
467 }
468 StatusCode EvtStoreSvc::registerObject( std::string_view parentPath, std::string_view objectPath,
469  DataObject* pObject ) {
470  if ( msgLevel( MSG::DEBUG ) ) {
471  debug() << "registerObject( " << parentPath << ", " << objectPath << ", " << (void*)pObject << " )" << endmsg;
472  }
473  return parentPath.empty()
474  ? registerObject( nullptr, objectPath, pObject )
475  : registerObject( nullptr, std::string{parentPath}.append( "/" ).append( objectPath ), pObject );
476 }
477 StatusCode EvtStoreSvc::registerObject( DataObject* parentObj, std::string_view path, DataObject* pObject ) {
478  if ( parentObj ) return StatusCode::FAILURE;
479  return fwd( [&]( Partition& p ) {
480  path = normalize_path( path, rootName() );
481  if ( m_forceLeaves ) {
482  auto dir = path;
483  for ( auto i = dir.rfind( '/' ); i != std::string_view::npos; i = dir.rfind( '/' ) ) {
484  dir = dir.substr( 0, i );
485  if ( !p.store.find( dir ) ) {
486  if ( msgLevel( MSG::DEBUG ) ) {
487  debug() << "registerObject: adding directory " << std::quoted( dir ) << endmsg;
488  }
489  p.store.put( dir, std::make_unique<DataObject>() );
490  }
491  }
492  }
493  if ( msgLevel( MSG::DEBUG ) ) {
494  debug() << "registerObject: " << std::quoted( path ) << " (DataObject*)" << (void*)pObject
495  << ( pObject ? " -> " + System::typeinfoName( typeid( *pObject ) ) : std::string{} ) << endmsg;
496  }
497  p.store.put( path, std::unique_ptr<DataObject>( pObject ) );
498  return StatusCode::SUCCESS;
499  } );
500 }
501 StatusCode EvtStoreSvc::retrieveObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) {
502  if ( pDirectory ) return StatusCode::FAILURE;
503  return fwd( [&]( Partition& p ) {
504  path = normalize_path( path, rootName() );
505  pObject = const_cast<DataObject*>( p.store.get( path ) );
506  if ( msgLevel( MSG::DEBUG ) ) {
507  debug() << "retrieveObject: " << std::quoted( path ) << " (DataObject*)" << (void*)pObject
508  << ( pObject ? " -> " + System::typeinfoName( typeid( *pObject ) ) : std::string{} ) << endmsg;
509  }
510  return pObject ? StatusCode::SUCCESS : StatusCode::FAILURE;
511  } );
512 }
513 StatusCode EvtStoreSvc::findObject( IRegistry* pDirectory, std::string_view path, DataObject*& pObject ) {
514  return retrieveObject( pDirectory, path, pObject );
515 }
516 StatusCode EvtStoreSvc::findObject( std::string_view fullPath, DataObject*& pObject ) {
517  return retrieveObject( nullptr, fullPath, pObject );
518 }
520  return fwd( [&]( Partition& p ) { return p.store.erase( sr ) != 0 ? StatusCode::SUCCESS : StatusCode::FAILURE; } );
521 }
523  auto i = std::find( m_preLoads.begin(), m_preLoads.begin(), item );
524  if ( i == m_preLoads.end() ) m_preLoads.push_back( item );
525  return StatusCode::SUCCESS;
526 }
528  auto i = std::remove( m_preLoads.begin(), m_preLoads.begin(), item );
529  m_preLoads.erase( i, m_preLoads.end() );
530  return StatusCode::SUCCESS;
531 }
533  for ( const auto& i : m_preLoads ) {
534  DataObject* pObj;
535  if ( msgLevel( MSG::DEBUG ) ) debug() << "Preloading " << i.path() << endmsg;
536  retrieveObject( nullptr, i.path(), pObj ).ignore();
537  }
538  return StatusCode::SUCCESS;
539 }
#define UNLIKELY(x)
Definition: Kernel.h:89
constexpr double sr
StatusCode setNumberOfStores(size_t slots) override
Set the number of event slots (copies of DataSvc objects).
const std::string & rootName() const override
T distance(T...args)
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc) override
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
Implementation of property with value of concrete type.
Definition: Property.h:352
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
virtual bool analyse(IRegistry *pObject, int level)=0
Analyse the data object.
StatusCode resetPreLoad() override
StatusCode updateObject(IRegistry *) override
StatusCode initialize() override
SmartIF< IConversionSvc > m_dataLoader
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
virtual const name_type & name() const =0
Name of the directory (or key)
StatusCode clearSubTree(DataObject *obj) override
tbb::concurrent_queue< size_t > m_freeSlots
StatusCode removePreLoadItem(const DataStoreItem &) override
StatusCode traverseSubTree(std::string_view, IDataStoreAgent *) override
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
StatusCode traverseTree(IDataStoreAgent *pAgent) override
Data provider interface definition.
T remove(T...args)
virtual const std::string * par() const =0
Retrieve String parameters.
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
STL class.
GAUDI_API int backTrace(void **addresses, const int depth)
size_t freeSlots() override
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
bool exists(const DataObjID &id) override
size_t getNumberOfStores() const override
StatusCode objectParent(const DataObject *, IRegistry *&) override
Invalid root path object cannot be retrieved or stored.
PropertyMgr & operator=(const PropertyMgr &)=delete
STL class.
StatusCode linkObject(std::string_view, DataObject *) override
#define DECLARE_COMPONENT(type)
StatusCode preLoad() override
virtual const id_type & identifier() const =0
Full identifier (or key)
std::vector< Synced< Partition > > m_partitions
The actual store(s)
StatusCode clearSubTree(std::string_view) override
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode updateObject(DataObject *) override
T append(T...args)
StatusCode finalize() override
virtual unsigned long addRef()=0
Add reference to object.
size_t allocateStore(int evtnumber) override
Allocate a store partition for a given event number.
virtual IDataProviderSvc * dataSvc() const =0
Retrieve pointer to Transient Store.
T lock(T...args)
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
string prefix
Definition: gaudirun.py:331
T reset(T...args)
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
StatusCode unlinkObject(DataObject *, std::string_view) override
T clear(T...args)
StatusCode unregisterObject(std::string_view) override
T move(T...args)
virtual DataObject * object() const =0
Retrieve object behind the link.
StatusCode objectParent(const IRegistry *, IRegistry *&) override
T count(T...args)
TTHREAD_TLS(Synced< Partition > *) s_current
StatusCode unregisterAddress(IRegistry *, std::string_view) override
StatusCode objectLeaves(const IRegistry *, std::vector< IRegistry * > &) override
StatusCode unregisterObject(DataObject *obj, std::string_view sr) override
T get(T...args)
StatusCode unregisterObject(DataObject *obj) override
StatusCode linkObject(IRegistry *, std::string_view, DataObject *) override
StatusCode clearStore() override
T find(T...args)
STL class.
StatusCode selectStore(size_t partition) override
Activate a partition object. The identifies the partition uniquely.
STL class.
Generic data agent interface.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
virtual unsigned long release()=0
release reference to object
STL class.
virtual void setAddress(IOpaqueAddress *pAddress)=0
Set/Update Opaque storage address.
StatusCode freeStore(size_t partition) override
Free a store partition.
Out1 * put(const DataObjectHandle< Out1 > &out_handle, Out2 &&out)
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override
StatusCode objectLeaves(const DataObject *, std::vector< IRegistry * > &) override
StatusCode unlinkObject(IRegistry *, std::string_view) override
string s
Definition: gaudirun.py:316
StatusCode setRoot(std::string root_name, DataObject *pObject) override
constexpr static const auto FAILURE
Definition: StatusCode.h:86
StatusCode unregisterAddress(std::string_view) override
size_t getPartitionNumber(int eventnumber) const override
Get the partition number corresponding to a given event.
AttribStringParser::Iterator begin(const AttribStringParser &parser)
virtual void setRegistry(IRegistry *r)=0
Update directory pointer.
Opaque address interface definition.
StatusCode registerObject(std::string_view parentPath, std::string_view objectPath, DataObject *pObject) override
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
#define GAUDI_API
Definition: Kernel.h:71
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
T equal(T...args)
KeyedObjectManager< map > Map
Forward declaration of specialized std::map-like object manager.
Use a minimal event store implementation, and adds everything required to satisfy the IDataProviderSv...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
StatusCode addPreLoadItem(const DataStoreItem &) override
StatusCode findObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
static GAUDI_API void setNumConcEvents(const std::size_t &nE)
StatusCode traverseSubTree(DataObject *obj, IDataStoreAgent *pAgent) override
StatusCode unlinkObject(std::string_view) override