The Gaudi Framework  v33r0 (d5ea422b)
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, " 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 207 of file EvtStoreSvc.cpp.

Member Function Documentation

◆ addPreLoadItem()

StatusCode EvtStoreSvc::addPreLoadItem ( const DataStoreItem item)
override

Definition at line 547 of file EvtStoreSvc.cpp.

547  {
548  auto i = std::find( m_preLoads.begin(), m_preLoads.begin(), item );
549  if ( i == m_preLoads.end() ) m_preLoads.push_back( item );
550  return StatusCode::SUCCESS;
551 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
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)

◆ allocateStore()

size_t EvtStoreSvc::allocateStore ( int  evtnumber)
override

Allocate a store partition for a given event number.

Definition at line 340 of file EvtStoreSvc.cpp.

340  {
341  // take next free slot in the list
342  size_t slot = std::string::npos;
343  if ( m_freeSlots.try_pop( slot ) ) {
344  assert( slot != std::string::npos );
345  assert( slot < m_partitions.size() );
346  [[maybe_unused]] auto prev = m_partitions[slot].with_lock(
347  [evtnumber]( Partition& p ) { return std::exchange( p.eventNumber, evtnumber ); } );
348  assert( prev == -1 ); // or whatever value represents 'free'
349  }
350  return slot;
351 }
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)

◆ clearStore() [1/2]

StatusCode EvtStoreSvc::clearStore ( )
override

Definition at line 399 of file EvtStoreSvc.cpp.

399  {
400  return fwd( []( Partition& p ) {
401  p.store.clear();
402  return StatusCode::SUCCESS;
403  } );
404 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:96

◆ clearStore() [2/2]

StatusCode EvtStoreSvc::clearStore ( size_t  partition)
override

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

Definition at line 386 of file EvtStoreSvc.cpp.

386  {
387  return m_partitions[partition].with_lock( []( Partition& p ) {
388  p.store.clear();
389  return StatusCode::SUCCESS;
390  } );
391 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
T partition(T... args)
std::vector< Synced< Partition > > m_partitions
The actual store(s)

◆ clearSubTree() [1/2]

StatusCode EvtStoreSvc::clearSubTree ( std::string_view  top)
override

Definition at line 392 of file EvtStoreSvc.cpp.

392  {
393  top = normalize_path( top, rootName() );
394  return fwd( [&]( Partition& p ) {
395  p.store.erase_if( [top]( const auto& value ) { return boost::algorithm::starts_with( value.first, top ); } );
396  return StatusCode::SUCCESS;
397  } );
398 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
const std::string & rootName() const override

◆ clearSubTree() [2/2]

StatusCode EvtStoreSvc::clearSubTree ( DataObject obj)
inlineoverride

Definition at line 251 of file EvtStoreSvc.cpp.

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

◆ exists()

bool EvtStoreSvc::exists ( const DataObjID id)
inlineoverride

Definition at line 240 of file EvtStoreSvc.cpp.

240  {
241  DataObject* pObject{nullptr};
242  return findObject( id.fullKey(), pObject ).isSuccess();
243  }
bool isSuccess() const
Definition: StatusCode.h:361
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:40
StatusCode findObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override

◆ finalize()

StatusCode EvtStoreSvc::finalize ( )
inlineoverride

Definition at line 322 of file EvtStoreSvc.cpp.

322  {
323  setDataLoader( nullptr, nullptr ).ignore(); // release
324  return extends::finalize();
325  }
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc) override
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:164

◆ findObject() [1/2]

StatusCode EvtStoreSvc::findObject ( IRegistry pDirectory,
std::string_view  path,
DataObject *&  pObject 
)
override

Definition at line 538 of file EvtStoreSvc.cpp.

538  {
539  return retrieveObject( pDirectory, path, pObject );
540 }
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override

◆ findObject() [2/2]

StatusCode EvtStoreSvc::findObject ( std::string_view  fullPath,
DataObject *&  pObject 
)
override

Definition at line 541 of file EvtStoreSvc.cpp.

541  {
542  return retrieveObject( nullptr, fullPath, pObject );
543 }
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override

◆ freeSlots()

size_t EvtStoreSvc::freeSlots ( )
inlineoverride

Definition at line 233 of file EvtStoreSvc.cpp.

233 { return m_freeSlots.unsafe_size(); }
tbb::concurrent_queue< size_t > m_freeSlots

◆ freeStore()

StatusCode EvtStoreSvc::freeStore ( size_t  partition)
override

Free a store partition.

Definition at line 378 of file EvtStoreSvc.cpp.

378  {
379  assert( partition < m_partitions.size() );
380  auto prev = m_partitions[partition].with_lock( []( Partition& p ) { return std::exchange( p.eventNumber, -1 ); } );
381  if ( UNLIKELY( prev == -1 ) ) return StatusCode::FAILURE; // double free -- should never happen!
382  m_freeSlots.push( partition );
383  return StatusCode::SUCCESS;
384 }
#define UNLIKELY(x)
Definition: Kernel.h:106
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
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:97

◆ getNumberOfStores()

size_t EvtStoreSvc::getNumberOfStores ( ) const
inlineoverride

Definition at line 238 of file EvtStoreSvc.cpp.

238 { return m_slots; }
Gaudi::Property< size_t > m_slots

◆ getPartitionNumber()

size_t EvtStoreSvc::getPartitionNumber ( int  eventnumber) const
override

Get the partition number corresponding to a given event.

Definition at line 367 of file EvtStoreSvc.cpp.

367  {
369  with_lock( [eventnumber]( const Partition& p ) { return p.eventNumber == eventnumber; } ) );
370  return i != end( m_partitions ) ? std::distance( begin( m_partitions ), i ) : std::string::npos;
371 }
T distance(T... args)
STL namespace.
std::vector< Synced< Partition > > m_partitions
The actual store(s)
def end
Definition: IOTest.py:123
T find_if(T... args)
AttribStringParser::Iterator begin(const AttribStringParser &parser)

◆ initialize()

StatusCode EvtStoreSvc::initialize ( )
inlineoverride

Definition at line 304 of file EvtStoreSvc.cpp.

304  {
305  Entry::setDataProviderSvc( this );
306  extends::initialize().ignore();
307  if ( !setNumberOfStores( m_slots ).isSuccess() ) {
308  error() << "Cannot set number of slots" << endmsg;
309  return StatusCode::FAILURE;
310  }
312  for ( size_t i = 0; i < m_slots; i++ ) { m_freeSlots.push( i ); }
313  selectStore( 0 ).ignore();
314 
316  if ( !loader ) {
317  error() << "Cannot get IConversionSvc " << m_loader.value() << endmsg;
318  return StatusCode::FAILURE;
319  }
320  return setDataLoader( loader, nullptr );
321  }
StatusCode setNumberOfStores(size_t slots) override
Set the number of event slots (copies of DataSvc objects).
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:287
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc) override
tbb::concurrent_queue< size_t > m_freeSlots
Gaudi::Property< std::string > m_loader
auto get(const Handle &handle, const Algo &, const EventContext &) -> decltype(details::deref(handle.get()))
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:86
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
std::vector< Synced< Partition > > m_partitions
The actual store(s)
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:164
StatusCode selectStore(size_t partition) override
Activate a partition object. The identifies the partition uniquely.
STL class.
constexpr static const auto FAILURE
Definition: StatusCode.h:97
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ linkObject() [1/2]

StatusCode EvtStoreSvc::linkObject ( IRegistry ,
std::string_view  ,
DataObject  
)
inlineoverride

Definition at line 298 of file EvtStoreSvc.cpp.

298 { return dummy( __FUNCTION__ ); }

◆ linkObject() [2/2]

StatusCode EvtStoreSvc::linkObject ( std::string_view  ,
DataObject  
)
inlineoverride

Definition at line 299 of file EvtStoreSvc.cpp.

299 { return dummy( __FUNCTION__ ); }

◆ objectLeaves() [1/2]

StatusCode EvtStoreSvc::objectLeaves ( const DataObject ,
std::vector< IRegistry * > &   
)
inlineoverride

Definition at line 247 of file EvtStoreSvc.cpp.

247 { return dummy( __FUNCTION__ ); }

◆ objectLeaves() [2/2]

StatusCode EvtStoreSvc::objectLeaves ( const IRegistry ,
std::vector< IRegistry * > &   
)
inlineoverride

Definition at line 248 of file EvtStoreSvc.cpp.

248 { return dummy( __FUNCTION__ ); }

◆ objectParent() [1/2]

StatusCode EvtStoreSvc::objectParent ( const DataObject ,
IRegistry *&   
)
inlineoverride

Definition at line 245 of file EvtStoreSvc.cpp.

245 { return dummy( __FUNCTION__ ); }

◆ objectParent() [2/2]

StatusCode EvtStoreSvc::objectParent ( const IRegistry ,
IRegistry *&   
)
inlineoverride

Definition at line 246 of file EvtStoreSvc.cpp.

246 { return dummy( __FUNCTION__ ); }

◆ preLoad()

StatusCode EvtStoreSvc::preLoad ( )
override

Definition at line 557 of file EvtStoreSvc.cpp.

557  {
558  for ( const auto& i : m_preLoads ) {
559  DataObject* pObj;
560  if ( msgLevel( MSG::DEBUG ) ) debug() << "Preloading " << i.path() << endmsg;
561  retrieveObject( nullptr, i.path(), pObj ).ignore();
562  }
563  return StatusCode::SUCCESS;
564 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
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:40
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202

◆ registerAddress() [1/2]

StatusCode EvtStoreSvc::registerAddress ( std::string_view  fullPath,
IOpaqueAddress pAddress 
)
override

Definition at line 459 of file EvtStoreSvc.cpp.

459  {
460  return registerAddress( nullptr, path, pAddr );
461 }
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override

◆ registerAddress() [2/2]

StatusCode EvtStoreSvc::registerAddress ( IRegistry parentObj,
std::string_view  objectPath,
IOpaqueAddress pAddress 
)
override

Definition at line 462 of file EvtStoreSvc.cpp.

462  {
463  auto addr = std::unique_ptr<IOpaqueAddress>( pAddr );
464  if ( msgLevel( MSG::DEBUG ) ) {
465  debug() << "registerAddress( (IRegistry*)" << (void*)pReg << ", " << path << ", (IOpaqueAddress*)" << addr.get()
466  << "[ " << addr->par()[0] << ", " << addr->par()[1] << " ]"
467  << " )" << endmsg;
468  }
469  if ( !addr ) return Status::INVALID_OBJ_ADDR; // Precondition: Address must be valid
470  if ( path.empty() || path[0] != '/' ) return StatusCode::FAILURE;
471  auto object = createObj( *m_dataLoader, *addr ); // Call data loader
472  if ( !object ) return Status::INVALID_OBJECT;
473  auto fullpath = ( pReg ? pReg->identifier() : m_rootName.value() ) + std::string{path};
474  // the data loader expects the path _including_ the root
475  auto dummy = Entry{fullpath, {}, {}};
476  object->setRegistry( &dummy );
477  addr->setRegistry( &dummy );
478  auto status = m_dataLoader->fillObjRefs( addr.get(), object.get() );
479  if ( !status.isSuccess() ) return status;
480  // note: put will overwrite the registry in pObject to point at the
481  // one actually used -- so we do not dangle, pointing at dummy beyond its
482  // lifetime
483  if ( msgLevel( MSG::DEBUG ) ) {
484  auto ptr = object.get();
485  debug() << "registerAddress: " << std::quoted( normalize_path( fullpath, rootName() ) ) << " (DataObject*)"
486  << static_cast<void*>( ptr ) << ( ptr ? " -> " + System::typeinfoName( typeid( *ptr ) ) : std::string{} )
487  << endmsg;
488  }
489  fwd( [&]( Partition& p ) {
490  p.store.put( normalize_path( fullpath, rootName() ), std::move( object ), std::move( addr ) );
491  return StatusCode::SUCCESS;
492  } ).ignore();
493  return status;
494 }
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:308
SmartIF< IConversionSvc > m_dataLoader
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
STL namespace.
Gaudi::Property< std::string > m_rootName
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
STL class.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
T move(T... args)
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
STL class.
constexpr static const auto FAILURE
Definition: StatusCode.h:97
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
const std::string & rootName() const override

◆ registerObject() [1/2]

StatusCode EvtStoreSvc::registerObject ( std::string_view  parentPath,
std::string_view  objectPath,
DataObject pObject 
)
override

Definition at line 495 of file EvtStoreSvc.cpp.

496  {
497  return parentPath.empty()
498  ? registerObject( nullptr, objectPath, pObject )
499  : registerObject( nullptr, std::string{parentPath}.append( "/" ).append( objectPath ), pObject );
500 }
STL namespace.
StatusCode registerObject(std::string_view parentPath, std::string_view objectPath, DataObject *pObject) override

◆ registerObject() [2/2]

StatusCode EvtStoreSvc::registerObject ( DataObject parentObj,
std::string_view  objectPath,
DataObject pObject 
)
override

Definition at line 501 of file EvtStoreSvc.cpp.

501  {
502  if ( parentObj ) return StatusCode::FAILURE;
503  return fwd( [&, object = std::unique_ptr<DataObject>( pObject ),
504  path = normalize_path( path, rootName() )]( Partition& p ) mutable {
505  if ( m_forceLeaves ) {
506  auto dir = path;
507  for ( auto i = dir.rfind( '/' ); i != std::string_view::npos; i = dir.rfind( '/' ) ) {
508  dir = dir.substr( 0, i );
509  if ( !p.store.find( dir ) ) {
510  if ( msgLevel( MSG::DEBUG ) ) {
511  debug() << "registerObject: adding directory " << std::quoted( dir ) << endmsg;
512  }
513  p.store.put( dir, std::unique_ptr<DataObject>{} );
514  }
515  }
516  }
517  if ( msgLevel( MSG::DEBUG ) ) {
518  auto ptr = object.get();
519  debug() << "registerObject: " << std::quoted( path ) << " (DataObject*)" << static_cast<void*>( ptr )
520  << ( ptr ? " -> " + System::typeinfoName( typeid( *ptr ) ) : std::string{} ) << endmsg;
521  }
522  p.store.put( path, std::move( object ) );
523  return StatusCode::SUCCESS;
524  } );
525 }
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:308
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
STL namespace.
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Gaudi::Property< bool > m_forceLeaves
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
T move(T... args)
STL class.
constexpr static const auto FAILURE
Definition: StatusCode.h:97
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
const std::string & rootName() const override

◆ removePreLoadItem()

StatusCode EvtStoreSvc::removePreLoadItem ( const DataStoreItem item)
override

Definition at line 552 of file EvtStoreSvc.cpp.

552  {
553  auto i = std::remove( m_preLoads.begin(), m_preLoads.begin(), item );
554  m_preLoads.erase( i, m_preLoads.end() );
555  return StatusCode::SUCCESS;
556 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
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)

◆ resetPreLoad()

StatusCode EvtStoreSvc::resetPreLoad ( )
inlineoverride

Definition at line 292 of file EvtStoreSvc.cpp.

292  {
293  m_preLoads.clear();
294  return StatusCode::SUCCESS;
295  }
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
T clear(T... args)

◆ retrieveObject()

StatusCode EvtStoreSvc::retrieveObject ( IRegistry pDirectory,
std::string_view  path,
DataObject *&  pObject 
)
override

Definition at line 526 of file EvtStoreSvc.cpp.

526  {
527  if ( pDirectory ) return StatusCode::FAILURE;
528  return fwd( [&]( Partition& p ) {
529  path = normalize_path( path, rootName() );
530  pObject = const_cast<DataObject*>( p.store.get( path ) );
531  if ( msgLevel( MSG::DEBUG ) ) {
532  debug() << "retrieveObject: " << std::quoted( path ) << " (DataObject*)" << (void*)pObject
533  << ( pObject ? " -> " + System::typeinfoName( typeid( *pObject ) ) : std::string{} ) << endmsg;
534  }
535  return pObject ? StatusCode::SUCCESS : StatusCode::FAILURE;
536  } );
537 }
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:308
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
STL class.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
constexpr static const auto FAILURE
Definition: StatusCode.h:97
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
const std::string & rootName() const override

◆ rootCLID()

CLID EvtStoreSvc::rootCLID ( ) const
override

Definition at line 332 of file EvtStoreSvc.cpp.

332 { return m_rootCLID; }
Gaudi::Property< CLID > m_rootCLID

◆ rootName()

const std::string & EvtStoreSvc::rootName ( ) const
override

Definition at line 333 of file EvtStoreSvc.cpp.

333 { return m_rootName; }
Gaudi::Property< std::string > m_rootName

◆ selectStore()

StatusCode EvtStoreSvc::selectStore ( size_t  partition)
override

Activate a partition object. The identifies the partition uniquely.

Definition at line 373 of file EvtStoreSvc.cpp.

373  {
374  s_current = &m_partitions[partition];
375  return StatusCode::SUCCESS;
376 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
T partition(T... args)
std::vector< Synced< Partition > > m_partitions
The actual store(s)

◆ setDataLoader()

StatusCode EvtStoreSvc::setDataLoader ( IConversionSvc svc,
IDataProviderSvc dpsvc 
)
override

Definition at line 334 of file EvtStoreSvc.cpp.

334  {
335  m_dataLoader = pDataLoader;
336  if ( m_dataLoader ) m_dataLoader->setDataProvider( dpsvc ? dpsvc : this ).ignore();
337  return StatusCode::SUCCESS;
338 }
SmartIF< IConversionSvc > m_dataLoader
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:164

◆ setNumberOfStores()

StatusCode EvtStoreSvc::setNumberOfStores ( size_t  slots)
override

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

Definition at line 353 of file EvtStoreSvc.cpp.

353  {
354  if ( slots < size_t{1} ) {
355  error() << "Invalid number of slots (" << slots << ")" << endmsg;
356  return StatusCode::FAILURE;
357  }
359  error() << "Too late to change the number of slots!" << endmsg;
360  return StatusCode::FAILURE;
361  }
362  m_slots = slots;
364  return StatusCode::SUCCESS;
365 }
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:62
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
Gaudi::Property< size_t > m_slots
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
constexpr static const auto FAILURE
Definition: StatusCode.h:97
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)

◆ setRoot() [1/2]

StatusCode EvtStoreSvc::setRoot ( std::string  root_name,
DataObject pObject 
)
override

Definition at line 426 of file EvtStoreSvc.cpp.

426  {
427  if ( msgLevel( MSG::DEBUG ) ) {
428  debug() << "setRoot( " << root_path << ", (DataObject*)" << (void*)pObject << " )" << endmsg;
429  }
430  clearStore().ignore();
431  return registerObject( nullptr, root_path, pObject );
432 }
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
StatusCode clearStore() override
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:164
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:202

◆ setRoot() [2/2]

StatusCode EvtStoreSvc::setRoot ( std::string  root_path,
IOpaqueAddress pRootAddr 
)
override

Definition at line 433 of file EvtStoreSvc.cpp.

433  {
434  auto rootAddr = std::unique_ptr<IOpaqueAddress>( pRootAddr );
435  if ( msgLevel( MSG::DEBUG ) ) {
436  debug() << "setRoot( " << root_path << ", (IOpaqueAddress*)" << (void*)rootAddr.get() << " )" << endmsg;
437  }
438  clearStore().ignore();
439  if ( !rootAddr ) return Status::INVALID_OBJ_ADDR; // Precondition: Address must be valid
440  if ( msgLevel( MSG::DEBUG ) ) {
441  const std::string* par = rootAddr->par();
442  debug() << "par[0]=" << par[0] << endmsg;
443  debug() << "par[1]=" << par[1] << endmsg;
444  }
445  auto object = createObj( *m_dataLoader, *rootAddr ); // Call data loader
446  if ( !object ) return Status::INVALID_OBJECT;
447  if ( msgLevel( MSG::DEBUG ) ) { debug() << "Root Object " << root_path << " created " << endmsg; }
448  auto dummy = Entry{root_path, {}, {}};
449  object->setRegistry( &dummy );
450  rootAddr->setRegistry( &dummy );
451  auto status = m_dataLoader->fillObjRefs( rootAddr.get(), object.get() );
452  if ( status.isSuccess() ) {
453  auto pObject = object.get();
454  status = registerObject( nullptr, root_path, object.release() );
455  if ( status.isSuccess() ) pObject->registry()->setAddress( rootAddr.release() );
456  }
457  return status;
458 }
SmartIF< IConversionSvc > m_dataLoader
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
STL class.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
StatusCode clearStore() override
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:164
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
STL class.
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:202

◆ traverseSubTree() [1/2]

StatusCode EvtStoreSvc::traverseSubTree ( std::string_view  top,
IDataStoreAgent pAgent 
)
override

Definition at line 405 of file EvtStoreSvc.cpp.

405  {
406  return fwd( [&]( Partition& p ) {
407  top = normalize_path( top, rootName() );
408  auto cmp = []( const Entry* lhs, const Entry* rhs ) { return lhs->identifier() < rhs->identifier(); };
409  std::set<const Entry*, decltype( cmp )> keys{std::move( cmp )};
410  for ( const auto& v : p.store ) {
411  if ( boost::algorithm::starts_with( v.second.identifier(), top ) ) keys.insert( &v.second );
412  }
413  auto k = keys.begin();
414  while ( k != keys.end() ) {
415  const auto& id = ( *k )->identifier();
416  int level = std::count( id.begin(), id.end(), '/' );
417  bool accept = pAgent->analyse( const_cast<Entry*>( *( k++ ) ), level );
418  if ( !accept ) {
419  k = std::find_if_not( k, keys.end(),
420  [&id]( const auto& e ) { return boost::algorithm::starts_with( e->identifier(), id ); } );
421  }
422  }
423  return StatusCode::SUCCESS;
424  } );
425 }
virtual bool analyse(IRegistry *pObject, int level)=0
Analyse the data object.
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
def end
Definition: IOTest.py:123
T move(T... args)
T count(T... args)
T find_if_not(T... args)
STL class.
AttribStringParser::Iterator begin(const AttribStringParser &parser)
const std::string & rootName() const override

◆ traverseSubTree() [2/2]

StatusCode EvtStoreSvc::traverseSubTree ( DataObject obj,
IDataStoreAgent pAgent 
)
inlineoverride

Definition at line 256 of file EvtStoreSvc.cpp.

256  {
257  return ( obj && obj->registry() ) ? traverseSubTree( obj->registry()->identifier(), pAgent ) : StatusCode::FAILURE;
258  }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:82
StatusCode traverseSubTree(std::string_view, IDataStoreAgent *) override
constexpr static const auto FAILURE
Definition: StatusCode.h:97
virtual const id_type & identifier() const =0
Full identifier (or key)

◆ traverseTree()

StatusCode EvtStoreSvc::traverseTree ( IDataStoreAgent pAgent)
inlineoverride

Definition at line 259 of file EvtStoreSvc.cpp.

259 { return traverseSubTree( std::string_view{}, pAgent ); }
StatusCode traverseSubTree(std::string_view, IDataStoreAgent *) override

◆ unlinkObject() [1/3]

StatusCode EvtStoreSvc::unlinkObject ( IRegistry ,
std::string_view   
)
inlineoverride

Definition at line 300 of file EvtStoreSvc.cpp.

300 { return dummy( __FUNCTION__ ); }

◆ unlinkObject() [2/3]

StatusCode EvtStoreSvc::unlinkObject ( DataObject ,
std::string_view   
)
inlineoverride

Definition at line 301 of file EvtStoreSvc.cpp.

301 { return dummy( __FUNCTION__ ); }

◆ unlinkObject() [3/3]

StatusCode EvtStoreSvc::unlinkObject ( std::string_view  )
inlineoverride

Definition at line 302 of file EvtStoreSvc.cpp.

302 { return dummy( __FUNCTION__ ); }

◆ unregisterAddress() [1/2]

StatusCode EvtStoreSvc::unregisterAddress ( std::string_view  )
inlineoverride

Definition at line 264 of file EvtStoreSvc.cpp.

264 { return dummy( __FUNCTION__ ); };

◆ unregisterAddress() [2/2]

StatusCode EvtStoreSvc::unregisterAddress ( IRegistry ,
std::string_view   
)
inlineoverride

Definition at line 265 of file EvtStoreSvc.cpp.

265 { return dummy( __FUNCTION__ ); };

◆ unregisterObject() [1/3]

StatusCode EvtStoreSvc::unregisterObject ( std::string_view  sr)
override

Definition at line 544 of file EvtStoreSvc.cpp.

544  {
545  return fwd( [&]( Partition& p ) { return p.store.erase( sr ) != 0 ? StatusCode::SUCCESS : StatusCode::FAILURE; } );
546 }
constexpr double sr
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
constexpr static const auto FAILURE
Definition: StatusCode.h:97

◆ unregisterObject() [2/3]

StatusCode EvtStoreSvc::unregisterObject ( DataObject obj)
inlineoverride

Definition at line 273 of file EvtStoreSvc.cpp.

273  {
274  return ( obj && obj->registry() ) ? unregisterObject( obj->registry()->identifier() ) : StatusCode::FAILURE;
275  }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:82
StatusCode unregisterObject(std::string_view) override
constexpr static const auto FAILURE
Definition: StatusCode.h:97
virtual const id_type & identifier() const =0
Full identifier (or key)

◆ unregisterObject() [3/3]

StatusCode EvtStoreSvc::unregisterObject ( DataObject obj,
std::string_view  sr 
)
inlineoverride

Definition at line 276 of file EvtStoreSvc.cpp.

276  {
277  return !obj ? unregisterObject( sr )
278  : obj->registry() ? unregisterObject( ( obj->registry()->identifier() + '/' ).append( sr ) )
279  : StatusCode::FAILURE;
280  };
constexpr double sr
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
StatusCode unregisterObject(std::string_view) override

◆ updateObject() [1/2]

StatusCode EvtStoreSvc::updateObject ( IRegistry )
inlineoverride

Definition at line 287 of file EvtStoreSvc.cpp.

287 { return dummy( __FUNCTION__ ); }

◆ updateObject() [2/2]

StatusCode EvtStoreSvc::updateObject ( DataObject )
inlineoverride

Definition at line 288 of file EvtStoreSvc.cpp.

288 { return dummy( __FUNCTION__ ); }

Member Data Documentation

◆ m_dataLoader

SmartIF<IConversionSvc> EvtStoreSvc::m_dataLoader
private

Definition at line 214 of file EvtStoreSvc.cpp.

◆ m_forceLeaves

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

Definition at line 210 of file EvtStoreSvc.cpp.

◆ m_freeSlots

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

Definition at line 222 of file EvtStoreSvc.cpp.

◆ m_loader

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

Definition at line 211 of file EvtStoreSvc.cpp.

◆ m_partitions

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

The actual store(s)

Definition at line 220 of file EvtStoreSvc.cpp.

◆ m_preLoads

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

Items to be pre-loaded.

Definition at line 217 of file EvtStoreSvc.cpp.

◆ m_rootCLID

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

Definition at line 208 of file EvtStoreSvc.cpp.

◆ m_rootName

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

Definition at line 209 of file EvtStoreSvc.cpp.

◆ m_slots

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

Definition at line 212 of file EvtStoreSvc.cpp.


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