The Gaudi Framework  v32r0 (3325bb39)
EvtStoreSvc Class Reference

Use a minimal event store implementation, and adds everything required to satisfy the IDataProviderSvc, IDataManagerSvc and IHiveWhiteBoard interfaces by throwing exceptions except when the functionality is really needed... More...

Inheritance diagram for EvtStoreSvc:
Collaboration diagram for EvtStoreSvc:

Public Member Functions

CLID rootCLID () const override
 
const std::stringrootName () const override
 
StatusCode setDataLoader (IConversionSvc *svc, IDataProviderSvc *dpsvc) override
 
size_t allocateStore (int evtnumber) override
 Allocate a store partition for a given event number. More...
 
StatusCode freeStore (size_t partition) override
 Free a store partition. More...
 
size_t freeSlots () override
 
StatusCode selectStore (size_t partition) override
 Activate a partition object. The identifies the partition uniquely. More...
 
StatusCode clearStore () override
 
StatusCode clearStore (size_t partition) override
 Remove all data objects in one 'slot' of the data store. More...
 
StatusCode setNumberOfStores (size_t slots) override
 Set the number of event slots (copies of DataSvc objects). More...
 
size_t getNumberOfStores () const override
 
size_t getPartitionNumber (int eventnumber) const override
 Get the partition number corresponding to a given event. More...
 
bool exists (const DataObjID &id) override
 
StatusCode objectParent (const DataObject *, IRegistry *&) override
 
StatusCode objectParent (const IRegistry *, IRegistry *&) override
 
StatusCode objectLeaves (const DataObject *, std::vector< IRegistry * > &) override
 
StatusCode objectLeaves (const IRegistry *, std::vector< IRegistry * > &) override
 
StatusCode clearSubTree (std::string_view) override
 
StatusCode clearSubTree (DataObject *obj) override
 
StatusCode traverseSubTree (std::string_view, IDataStoreAgent *) override
 
StatusCode traverseSubTree (DataObject *obj, IDataStoreAgent *pAgent) override
 
StatusCode traverseTree (IDataStoreAgent *pAgent) override
 
StatusCode setRoot (std::string root_name, DataObject *pObject) override
 
StatusCode setRoot (std::string root_path, IOpaqueAddress *pRootAddr) override
 
StatusCode unregisterAddress (std::string_view) override
 
StatusCode unregisterAddress (IRegistry *, std::string_view) override
 
StatusCode registerAddress (std::string_view fullPath, IOpaqueAddress *pAddress) override
 
StatusCode registerAddress (IRegistry *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress) override
 
StatusCode registerObject (std::string_view parentPath, std::string_view objectPath, DataObject *pObject) override
 
StatusCode registerObject (DataObject *parentObj, std::string_view objectPath, DataObject *pObject) override
 
StatusCode unregisterObject (std::string_view) override
 
StatusCode unregisterObject (DataObject *obj) override
 
StatusCode unregisterObject (DataObject *obj, std::string_view sr) override
 
StatusCode retrieveObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
 
StatusCode findObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
 
StatusCode findObject (std::string_view fullPath, DataObject *&pObject) override
 
StatusCode updateObject (IRegistry *) override
 
StatusCode updateObject (DataObject *) override
 
StatusCode addPreLoadItem (const DataStoreItem &) override
 
StatusCode removePreLoadItem (const DataStoreItem &) override
 
StatusCode resetPreLoad () override
 
StatusCode preLoad () override
 
StatusCode linkObject (IRegistry *, std::string_view, DataObject *) override
 
StatusCode linkObject (std::string_view, DataObject *) override
 
StatusCode unlinkObject (IRegistry *, std::string_view) override
 
StatusCode unlinkObject (DataObject *, std::string_view) override
 
StatusCode unlinkObject (std::string_view) override
 
StatusCode initialize () override
 
StatusCode finalize () override
 
- Public Member Functions inherited from extends< Service, IDataProviderSvc, IDataManagerSvc, IHiveWhiteBoard >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
- Public Member Functions inherited from Service
const std::stringname () const override
 Retrieve name of the service. More...
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 Initialize Service. More...
 
StatusCode sysStart () override
 Initialize Service. More...
 
StatusCode sysStop () override
 Initialize Service. More...
 
StatusCode sysFinalize () override
 Finalize Service. More...
 
StatusCode sysReinitialize () override
 Re-initialize the Service. More...
 
StatusCode sysRestart () override
 Re-initialize the Service. More...
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
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. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
 Declare used tool. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const
 Backward compatibility function for getting the output level. More...
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 

Private Attributes

Gaudi::Property< CLIDm_rootCLID {this, "RootCLID", 110 , "CLID of root entry"}
 
Gaudi::Property< std::stringm_rootName {this, "RootName", "/Event", "name of root entry"}
 
Gaudi::Property< bool > m_forceLeaves {this, "ForceLeaves", false, "force creation of default leaves on registerObject"}
 
Gaudi::Property< std::stringm_loader {this, "DataLoader", "EventPersistencySvc"}
 
Gaudi::Property< size_t > m_slots {this, "EventSlots", 1, "number of event slots"}
 
SmartIF< IConversionSvcm_dataLoader
 
std::vector< DataStoreItemm_preLoads
 Items to be pre-loaded. More...
 
std::vector< Synced< Partition > > m_partitions
 The actual store(s) More...
 
tbb::concurrent_queue< size_t > m_freeSlots
 

Additional Inherited Members

- Public Types inherited from extends< Service, IDataProviderSvc, IDataManagerSvc, IHiveWhiteBoard >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 
- Protected Member Functions inherited from Service
 ~Service () override
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBaseproperty (const std::string &name) const
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state. More...
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state. More...
 
Gaudi::Property< int > m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
 
Gaudi::Property< bool > m_auditInit {this, "AuditServices", false, "[[deprecated]] unused"}
 
Gaudi::Property< bool > m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
 
Gaudi::Property< bool > m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
 
Gaudi::Property< bool > m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
 
Gaudi::Property< bool > m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
 
Gaudi::Property< bool > m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
 
Gaudi::Property< bool > m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service. More...
 

Detailed Description

Use a minimal event store implementation, and adds everything required to satisfy the IDataProviderSvc, IDataManagerSvc and IHiveWhiteBoard interfaces by throwing exceptions except when the functionality is really needed...

Author
Gerhard Raven
Version
1.0

Definition at line 185 of file EvtStoreSvc.cpp.

Member Function Documentation

StatusCode EvtStoreSvc::addPreLoadItem ( const DataStoreItem item)
override

Definition at line 522 of file EvtStoreSvc.cpp.

522  {
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 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
T end(T...args)
T push_back(T...args)
T find(T...args)
T begin(T...args)
size_t EvtStoreSvc::allocateStore ( int  evtnumber)
override

Allocate a store partition for a given event number.

Definition at line 318 of file EvtStoreSvc.cpp.

318  {
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 }
tbb::concurrent_queue< size_t > m_freeSlots
T prev(T...args)
std::vector< Synced< Partition > > m_partitions
The actual store(s)
T size(T...args)
StatusCode EvtStoreSvc::clearStore ( )
override

Definition at line 377 of file EvtStoreSvc.cpp.

377  {
378  return fwd( []( Partition& p ) {
379  p.store.clear();
380  return StatusCode::SUCCESS;
381  } );
382 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode EvtStoreSvc::clearStore ( size_t  partition)
override

Remove all data objects in one 'slot' of the data store.

Definition at line 364 of file EvtStoreSvc.cpp.

364  {
365  return m_partitions[partition].with_lock( []( Partition& p ) {
366  p.store.clear();
367  return StatusCode::SUCCESS;
368  } );
369 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T partition(T...args)
std::vector< Synced< Partition > > m_partitions
The actual store(s)
StatusCode EvtStoreSvc::clearSubTree ( std::string_view  top)
override

Definition at line 370 of file EvtStoreSvc.cpp.

370  {
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 }
const std::string & rootName() const override
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode EvtStoreSvc::clearSubTree ( DataObject obj)
inlineoverride

Definition at line 229 of file EvtStoreSvc.cpp.

229  {
230  return obj && obj->registry() ? clearSubTree( obj->registry()->identifier() ) : StatusCode::FAILURE;
231  }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
virtual const id_type & identifier() const =0
Full identifier (or key)
StatusCode clearSubTree(std::string_view) override
constexpr static const auto FAILURE
Definition: StatusCode.h:86
bool EvtStoreSvc::exists ( const DataObjID id)
inlineoverride

Definition at line 218 of file EvtStoreSvc.cpp.

218  {
219  DataObject* pObject{nullptr};
220  return findObject( id.fullKey(), pObject ).isSuccess();
221  }
bool isSuccess() const
Definition: StatusCode.h:267
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
StatusCode findObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
StatusCode EvtStoreSvc::finalize ( )
inlineoverride

Definition at line 300 of file EvtStoreSvc.cpp.

300  {
301  setDataLoader( nullptr, nullptr ).ignore(); // release
302  return extends::finalize();
303  }
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc) override
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
StatusCode EvtStoreSvc::findObject ( IRegistry pDirectory,
std::string_view  path,
DataObject *&  pObject 
)
override

Definition at line 513 of file EvtStoreSvc.cpp.

513  {
514  return retrieveObject( pDirectory, path, pObject );
515 }
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
StatusCode EvtStoreSvc::findObject ( std::string_view  fullPath,
DataObject *&  pObject 
)
override

Definition at line 516 of file EvtStoreSvc.cpp.

516  {
517  return retrieveObject( nullptr, fullPath, pObject );
518 }
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
size_t EvtStoreSvc::freeSlots ( )
inlineoverride

Definition at line 211 of file EvtStoreSvc.cpp.

211 { return m_freeSlots.unsafe_size(); }
tbb::concurrent_queue< size_t > m_freeSlots
StatusCode EvtStoreSvc::freeStore ( size_t  partition)
override

Free a store partition.

Definition at line 356 of file EvtStoreSvc.cpp.

356  {
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 }
#define UNLIKELY(x)
Definition: Kernel.h:89
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
tbb::concurrent_queue< size_t > m_freeSlots
T partition(T...args)
T prev(T...args)
std::vector< Synced< Partition > > m_partitions
The actual store(s)
T size(T...args)
constexpr static const auto FAILURE
Definition: StatusCode.h:86
size_t EvtStoreSvc::getNumberOfStores ( ) const
inlineoverride

Definition at line 216 of file EvtStoreSvc.cpp.

216 { return m_slots; }
Gaudi::Property< size_t > m_slots
size_t EvtStoreSvc::getPartitionNumber ( int  eventnumber) const
override

Get the partition number corresponding to a given event.

Definition at line 345 of file EvtStoreSvc.cpp.

345  {
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 }
T distance(T...args)
STL namespace.
std::vector< Synced< Partition > > m_partitions
The actual store(s)
T find_if(T...args)
AttribStringParser::Iterator begin(const AttribStringParser &parser)
StatusCode EvtStoreSvc::initialize ( )
inlineoverride

Definition at line 282 of file EvtStoreSvc.cpp.

282  {
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  }
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  }
StatusCode setNumberOfStores(size_t slots) override
Set the number of event slots (copies of DataSvc objects).
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc) override
tbb::concurrent_queue< size_t > m_freeSlots
Gaudi::Property< std::string > m_loader
Gaudi::Property< size_t > m_slots
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:76
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
std::vector< Synced< Partition > > m_partitions
The actual store(s)
StatusCode selectStore(size_t partition) override
Activate a partition object. The identifies the partition uniquely.
STL class.
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
constexpr static const auto FAILURE
Definition: StatusCode.h:86
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:277
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
StatusCode EvtStoreSvc::linkObject ( IRegistry ,
std::string_view  ,
DataObject  
)
inlineoverride

Definition at line 276 of file EvtStoreSvc.cpp.

276 { return dummy( __FUNCTION__ ); }
StatusCode EvtStoreSvc::linkObject ( std::string_view  ,
DataObject  
)
inlineoverride

Definition at line 277 of file EvtStoreSvc.cpp.

277 { return dummy( __FUNCTION__ ); }
StatusCode EvtStoreSvc::objectLeaves ( const DataObject ,
std::vector< IRegistry * > &   
)
inlineoverride

Definition at line 225 of file EvtStoreSvc.cpp.

225 { return dummy( __FUNCTION__ ); }
StatusCode EvtStoreSvc::objectLeaves ( const IRegistry ,
std::vector< IRegistry * > &   
)
inlineoverride

Definition at line 226 of file EvtStoreSvc.cpp.

226 { return dummy( __FUNCTION__ ); }
StatusCode EvtStoreSvc::objectParent ( const DataObject ,
IRegistry *&   
)
inlineoverride

Definition at line 223 of file EvtStoreSvc.cpp.

223 { return dummy( __FUNCTION__ ); }
StatusCode EvtStoreSvc::objectParent ( const IRegistry ,
IRegistry *&   
)
inlineoverride

Definition at line 224 of file EvtStoreSvc.cpp.

224 { return dummy( __FUNCTION__ ); }
StatusCode EvtStoreSvc::preLoad ( )
override

Definition at line 532 of file EvtStoreSvc.cpp.

532  {
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 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
StatusCode EvtStoreSvc::registerAddress ( std::string_view  fullPath,
IOpaqueAddress pAddress 
)
override

Definition at line 434 of file EvtStoreSvc.cpp.

434  {
435  return registerAddress( nullptr, path, pAddr );
436 }
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override
StatusCode EvtStoreSvc::registerAddress ( IRegistry parentObj,
std::string_view  objectPath,
IOpaqueAddress pAddress 
)
override

Definition at line 437 of file EvtStoreSvc.cpp.

437  {
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 }
const std::string & rootName() const override
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
SmartIF< IConversionSvc > m_dataLoader
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
STL namespace.
Gaudi::Property< std::string > m_rootName
STL class.
T move(T...args)
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
STL class.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
constexpr static const auto FAILURE
Definition: StatusCode.h:86
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
StatusCode EvtStoreSvc::registerObject ( std::string_view  parentPath,
std::string_view  objectPath,
DataObject pObject 
)
override

Definition at line 468 of file EvtStoreSvc.cpp.

469  {
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 }
STL namespace.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
StatusCode registerObject(std::string_view parentPath, std::string_view objectPath, DataObject *pObject) override
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
StatusCode EvtStoreSvc::registerObject ( DataObject parentObj,
std::string_view  objectPath,
DataObject pObject 
)
override

Definition at line 477 of file EvtStoreSvc.cpp.

477  {
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 }
const std::string & rootName() const override
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
STL class.
Gaudi::Property< bool > m_forceLeaves
STL class.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
constexpr static const auto FAILURE
Definition: StatusCode.h:86
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
StatusCode EvtStoreSvc::removePreLoadItem ( const DataStoreItem item)
override

Definition at line 527 of file EvtStoreSvc.cpp.

527  {
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 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
T end(T...args)
T remove(T...args)
T erase(T...args)
T begin(T...args)
StatusCode EvtStoreSvc::resetPreLoad ( )
inlineoverride

Definition at line 270 of file EvtStoreSvc.cpp.

270  {
271  m_preLoads.clear();
272  return StatusCode::SUCCESS;
273  }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
T clear(T...args)
StatusCode EvtStoreSvc::retrieveObject ( IRegistry pDirectory,
std::string_view  path,
DataObject *&  pObject 
)
override

Definition at line 501 of file EvtStoreSvc.cpp.

501  {
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 }
const std::string & rootName() const override
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
STL class.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
constexpr static const auto FAILURE
Definition: StatusCode.h:86
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
CLID EvtStoreSvc::rootCLID ( ) const
override

Definition at line 310 of file EvtStoreSvc.cpp.

310 { return m_rootCLID; }
Gaudi::Property< CLID > m_rootCLID
const std::string & EvtStoreSvc::rootName ( ) const
override

Definition at line 311 of file EvtStoreSvc.cpp.

311 { return m_rootName; }
Gaudi::Property< std::string > m_rootName
StatusCode EvtStoreSvc::selectStore ( size_t  partition)
override

Activate a partition object. The identifies the partition uniquely.

Definition at line 351 of file EvtStoreSvc.cpp.

351  {
352  s_current = &m_partitions[partition];
353  return StatusCode::SUCCESS;
354 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T partition(T...args)
std::vector< Synced< Partition > > m_partitions
The actual store(s)
StatusCode EvtStoreSvc::setDataLoader ( IConversionSvc svc,
IDataProviderSvc dpsvc 
)
override

Definition at line 312 of file EvtStoreSvc.cpp.

312  {
313  m_dataLoader = pDataLoader;
314  if ( m_dataLoader ) m_dataLoader->setDataProvider( dpsvc ? dpsvc : this ).ignore();
315  return StatusCode::SUCCESS;
316 }
SmartIF< IConversionSvc > m_dataLoader
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
StatusCode EvtStoreSvc::setNumberOfStores ( size_t  slots)
override

Set the number of event slots (copies of DataSvc objects).

Definition at line 331 of file EvtStoreSvc.cpp.

331  {
332  if ( slots < size_t{1} ) {
333  error() << "Invalid number of slots (" << slots << ")" << endmsg;
334  return StatusCode::FAILURE;
335  }
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 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
Gaudi::Property< size_t > m_slots
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:52
constexpr static const auto FAILURE
Definition: StatusCode.h:86
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
static GAUDI_API void setNumConcEvents(const std::size_t &nE)
StatusCode EvtStoreSvc::setRoot ( std::string  root_name,
DataObject pObject 
)
override

Definition at line 407 of file EvtStoreSvc.cpp.

407  {
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 }
StatusCode clearStore() override
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
StatusCode registerObject(std::string_view parentPath, std::string_view objectPath, DataObject *pObject) override
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
StatusCode EvtStoreSvc::setRoot ( std::string  root_path,
IOpaqueAddress pRootAddr 
)
override

Definition at line 414 of file EvtStoreSvc.cpp.

414  {
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 }
bool isSuccess() const
Definition: StatusCode.h:267
SmartIF< IConversionSvc > m_dataLoader
STL class.
T move(T...args)
StatusCode clearStore() override
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
STL class.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
StatusCode registerObject(std::string_view parentPath, std::string_view objectPath, DataObject *pObject) override
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
StatusCode EvtStoreSvc::traverseSubTree ( std::string_view  top,
IDataStoreAgent pAgent 
)
override

Definition at line 383 of file EvtStoreSvc.cpp.

383  {
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 }
const std::string & rootName() const override
virtual bool analyse(IRegistry *pObject, int level)=0
Analyse the data object.
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
T move(T...args)
T count(T...args)
STL class.
AttribStringParser::Iterator begin(const AttribStringParser &parser)
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
StatusCode EvtStoreSvc::traverseSubTree ( DataObject obj,
IDataStoreAgent pAgent 
)
inlineoverride

Definition at line 234 of file EvtStoreSvc.cpp.

234  {
235  return ( obj && obj->registry() ) ? traverseSubTree( obj->registry()->identifier(), pAgent ) : StatusCode::FAILURE;
236  }
StatusCode traverseSubTree(std::string_view, IDataStoreAgent *) override
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
virtual const id_type & identifier() const =0
Full identifier (or key)
constexpr static const auto FAILURE
Definition: StatusCode.h:86
StatusCode EvtStoreSvc::traverseTree ( IDataStoreAgent pAgent)
inlineoverride

Definition at line 237 of file EvtStoreSvc.cpp.

237 { return traverseSubTree( std::string_view{}, pAgent ); }
StatusCode traverseSubTree(std::string_view, IDataStoreAgent *) override
StatusCode EvtStoreSvc::unlinkObject ( IRegistry ,
std::string_view   
)
inlineoverride

Definition at line 278 of file EvtStoreSvc.cpp.

278 { return dummy( __FUNCTION__ ); }
StatusCode EvtStoreSvc::unlinkObject ( DataObject ,
std::string_view   
)
inlineoverride

Definition at line 279 of file EvtStoreSvc.cpp.

279 { return dummy( __FUNCTION__ ); }
StatusCode EvtStoreSvc::unlinkObject ( std::string_view  )
inlineoverride

Definition at line 280 of file EvtStoreSvc.cpp.

280 { return dummy( __FUNCTION__ ); }
StatusCode EvtStoreSvc::unregisterAddress ( std::string_view  )
inlineoverride

Definition at line 242 of file EvtStoreSvc.cpp.

242 { return dummy( __FUNCTION__ ); };
StatusCode EvtStoreSvc::unregisterAddress ( IRegistry ,
std::string_view   
)
inlineoverride

Definition at line 243 of file EvtStoreSvc.cpp.

243 { return dummy( __FUNCTION__ ); };
StatusCode EvtStoreSvc::unregisterObject ( std::string_view  sr)
override

Definition at line 519 of file EvtStoreSvc.cpp.

519  {
520  return fwd( [&]( Partition& p ) { return p.store.erase( sr ) != 0 ? StatusCode::SUCCESS : StatusCode::FAILURE; } );
521 }
constexpr double sr
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
constexpr static const auto FAILURE
Definition: StatusCode.h:86
StatusCode EvtStoreSvc::unregisterObject ( DataObject obj)
inlineoverride

Definition at line 251 of file EvtStoreSvc.cpp.

251  {
252  return ( obj && obj->registry() ) ? unregisterObject( obj->registry()->identifier() ) : StatusCode::FAILURE;
253  }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
virtual const id_type & identifier() const =0
Full identifier (or key)
StatusCode unregisterObject(std::string_view) override
constexpr static const auto FAILURE
Definition: StatusCode.h:86
StatusCode EvtStoreSvc::unregisterObject ( DataObject obj,
std::string_view  sr 
)
inlineoverride

Definition at line 254 of file EvtStoreSvc.cpp.

254  {
255  return !obj ? unregisterObject( sr )
256  : obj->registry() ? unregisterObject( ( obj->registry()->identifier() + '/' ).append( sr ) )
257  : StatusCode::FAILURE;
258  };
constexpr double sr
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode unregisterObject(std::string_view) override
StatusCode EvtStoreSvc::updateObject ( IRegistry )
inlineoverride

Definition at line 265 of file EvtStoreSvc.cpp.

265 { return dummy( __FUNCTION__ ); }
StatusCode EvtStoreSvc::updateObject ( DataObject )
inlineoverride

Definition at line 266 of file EvtStoreSvc.cpp.

266 { return dummy( __FUNCTION__ ); }

Member Data Documentation

SmartIF<IConversionSvc> EvtStoreSvc::m_dataLoader
private

Definition at line 192 of file EvtStoreSvc.cpp.

Gaudi::Property<bool> EvtStoreSvc::m_forceLeaves {this, "ForceLeaves", false, "force creation of default leaves on registerObject"}
private

Definition at line 188 of file EvtStoreSvc.cpp.

tbb::concurrent_queue<size_t> EvtStoreSvc::m_freeSlots
private

Definition at line 200 of file EvtStoreSvc.cpp.

Gaudi::Property<std::string> EvtStoreSvc::m_loader {this, "DataLoader", "EventPersistencySvc"}
private

Definition at line 189 of file EvtStoreSvc.cpp.

std::vector<Synced<Partition> > EvtStoreSvc::m_partitions
private

The actual store(s)

Definition at line 198 of file EvtStoreSvc.cpp.

std::vector<DataStoreItem> EvtStoreSvc::m_preLoads
private

Items to be pre-loaded.

Definition at line 195 of file EvtStoreSvc.cpp.

Gaudi::Property<CLID> EvtStoreSvc::m_rootCLID {this, "RootCLID", 110 , "CLID of root entry"}
private

Definition at line 186 of file EvtStoreSvc.cpp.

Gaudi::Property<std::string> EvtStoreSvc::m_rootName {this, "RootName", "/Event", "name of root entry"}
private

Definition at line 187 of file EvtStoreSvc.cpp.

Gaudi::Property<size_t> EvtStoreSvc::m_slots {this, "EventSlots", 1, "number of event slots"}
private

Definition at line 190 of file EvtStoreSvc.cpp.


The documentation for this class was generated from the following file: