The Gaudi Framework  v32r2 (46d42edc)
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 188 of file EvtStoreSvc.cpp.

Member Function Documentation

◆ addPreLoadItem()

StatusCode EvtStoreSvc::addPreLoadItem ( const DataStoreItem item)
override

Definition at line 528 of file EvtStoreSvc.cpp.

528  {
529  auto i = std::find( m_preLoads.begin(), m_preLoads.begin(), item );
530  if ( i == m_preLoads.end() ) m_preLoads.push_back( item );
531  return StatusCode::SUCCESS;
532 }
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)

◆ allocateStore()

size_t EvtStoreSvc::allocateStore ( int  evtnumber)
override

Allocate a store partition for a given event number.

Definition at line 321 of file EvtStoreSvc.cpp.

321  {
322  // take next free slot in the list
323  size_t slot = std::string::npos;
324  if ( m_freeSlots.try_pop( slot ) ) {
325  assert( slot != std::string::npos );
326  assert( slot < m_partitions.size() );
327  [[maybe_unused]] auto prev = m_partitions[slot].with_lock(
328  [evtnumber]( Partition& p ) { return std::exchange( p.eventNumber, evtnumber ); } );
329  assert( prev == -1 ); // or whatever value represents 'free'
330  }
331  return slot;
332 }
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 380 of file EvtStoreSvc.cpp.

380  {
381  return fwd( []( Partition& p ) {
382  p.store.clear();
383  return StatusCode::SUCCESS;
384  } );
385 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85

◆ clearStore() [2/2]

StatusCode EvtStoreSvc::clearStore ( size_t  partition)
override

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

Definition at line 367 of file EvtStoreSvc.cpp.

367  {
368  return m_partitions[partition].with_lock( []( Partition& p ) {
369  p.store.clear();
370  return StatusCode::SUCCESS;
371  } );
372 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
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 373 of file EvtStoreSvc.cpp.

373  {
374  top = normalize_path( top, rootName() );
375  return fwd( [&]( Partition& p ) {
376  p.store.erase_if( [top]( const auto& value ) { return boost::algorithm::starts_with( value.first, top ); } );
377  return StatusCode::SUCCESS;
378  } );
379 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
const std::string & rootName() const override

◆ clearSubTree() [2/2]

StatusCode EvtStoreSvc::clearSubTree ( DataObject obj)
inlineoverride

Definition at line 232 of file EvtStoreSvc.cpp.

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

◆ exists()

bool EvtStoreSvc::exists ( const DataObjID id)
inlineoverride

Definition at line 221 of file EvtStoreSvc.cpp.

221  {
222  DataObject* pObject{nullptr};
223  return findObject( id.fullKey(), pObject ).isSuccess();
224  }
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

◆ finalize()

StatusCode EvtStoreSvc::finalize ( )
inlineoverride

Definition at line 303 of file EvtStoreSvc.cpp.

303  {
304  setDataLoader( nullptr, nullptr ).ignore(); // release
305  return extends::finalize();
306  }
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc) override
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153

◆ findObject() [1/2]

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

Definition at line 519 of file EvtStoreSvc.cpp.

519  {
520  return retrieveObject( pDirectory, path, pObject );
521 }
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 522 of file EvtStoreSvc.cpp.

522  {
523  return retrieveObject( nullptr, fullPath, pObject );
524 }
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override

◆ freeSlots()

size_t EvtStoreSvc::freeSlots ( )
inlineoverride

Definition at line 214 of file EvtStoreSvc.cpp.

214 { 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 359 of file EvtStoreSvc.cpp.

359  {
360  assert( partition < m_partitions.size() );
361  auto prev = m_partitions[partition].with_lock( []( Partition& p ) { return std::exchange( p.eventNumber, -1 ); } );
362  if ( UNLIKELY( prev == -1 ) ) return StatusCode::FAILURE; // double free -- should never happen!
363  m_freeSlots.push( partition );
364  return StatusCode::SUCCESS;
365 }
#define UNLIKELY(x)
Definition: Kernel.h:96
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

◆ getNumberOfStores()

size_t EvtStoreSvc::getNumberOfStores ( ) const
inlineoverride

Definition at line 219 of file EvtStoreSvc.cpp.

219 { 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 348 of file EvtStoreSvc.cpp.

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

◆ initialize()

StatusCode EvtStoreSvc::initialize ( )
inlineoverride

Definition at line 285 of file EvtStoreSvc.cpp.

285  {
286  Entry::setDataProviderSvc( this );
287  extends::initialize().ignore();
288  if ( !setNumberOfStores( m_slots ).isSuccess() ) {
289  error() << "Cannot set number of slots" << endmsg;
290  return StatusCode::FAILURE;
291  }
293  for ( size_t i = 0; i < m_slots; i++ ) { m_freeSlots.push( i ); }
294  selectStore( 0 ).ignore();
295 
297  if ( !loader ) {
298  error() << "Cannot get IConversionSvc " << m_loader.value() << endmsg;
299  return StatusCode::FAILURE;
300  }
301  return setDataLoader( loader, nullptr );
302  }
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:277
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:76
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:153
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:86
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

◆ linkObject() [1/2]

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

Definition at line 279 of file EvtStoreSvc.cpp.

279 { return dummy( __FUNCTION__ ); }

◆ linkObject() [2/2]

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

Definition at line 280 of file EvtStoreSvc.cpp.

280 { return dummy( __FUNCTION__ ); }

◆ objectLeaves() [1/2]

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

Definition at line 228 of file EvtStoreSvc.cpp.

228 { return dummy( __FUNCTION__ ); }

◆ objectLeaves() [2/2]

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

Definition at line 229 of file EvtStoreSvc.cpp.

229 { return dummy( __FUNCTION__ ); }

◆ objectParent() [1/2]

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

Definition at line 226 of file EvtStoreSvc.cpp.

226 { return dummy( __FUNCTION__ ); }

◆ objectParent() [2/2]

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

Definition at line 227 of file EvtStoreSvc.cpp.

227 { return dummy( __FUNCTION__ ); }

◆ preLoad()

StatusCode EvtStoreSvc::preLoad ( )
override

Definition at line 538 of file EvtStoreSvc.cpp.

538  {
539  for ( const auto& i : m_preLoads ) {
540  DataObject* pObj;
541  if ( msgLevel( MSG::DEBUG ) ) debug() << "Preloading " << i.path() << endmsg;
542  retrieveObject( nullptr, i.path(), pObj ).ignore();
543  }
544  return StatusCode::SUCCESS;
545 }
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
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:30
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

◆ registerAddress() [1/2]

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

Definition at line 440 of file EvtStoreSvc.cpp.

440  {
441  return registerAddress( nullptr, path, pAddr );
442 }
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 443 of file EvtStoreSvc.cpp.

443  {
444  auto addr = std::unique_ptr<IOpaqueAddress>( pAddr );
445  if ( msgLevel( MSG::DEBUG ) ) {
446  debug() << "registerAddress( (IRegistry*)" << (void*)pReg << ", " << path << ", (IOpaqueAddress*)" << addr.get()
447  << "[ " << addr->par()[0] << ", " << addr->par()[1] << " ]"
448  << " )" << endmsg;
449  }
450  if ( !addr ) return Status::INVALID_OBJ_ADDR; // Precondition: Address must be valid
451  if ( path.empty() || path[0] != '/' ) return StatusCode::FAILURE;
452  auto object = createObj( *m_dataLoader, *addr ); // Call data loader
453  if ( !object ) return Status::INVALID_OBJECT;
454  auto fullpath = ( pReg ? pReg->identifier() : m_rootName.value() ) + std::string{path};
455  // the data loader expects the path _including_ the root
456  auto dummy = Entry{fullpath, {}, {}};
457  object->setRegistry( &dummy );
458  addr->setRegistry( &dummy );
459  auto status = m_dataLoader->fillObjRefs( addr.get(), object.get() );
460  if ( !status.isSuccess() ) return status;
461  // note: put will overwrite the registry in pObject to point at the
462  // one actually used -- so we do not dangle, pointing at dummy beyond its
463  // lifetime
464  if ( msgLevel( MSG::DEBUG ) ) {
465  auto ptr = object.get();
466  debug() << "registerAddress: " << std::quoted( normalize_path( fullpath, rootName() ) ) << " (DataObject*)"
467  << static_cast<void*>( ptr ) << ( ptr ? " -> " + System::typeinfoName( typeid( *ptr ) ) : std::string{} )
468  << endmsg;
469  }
470  fwd( [&]( Partition& p ) {
471  p.store.put( normalize_path( fullpath, rootName() ), std::move( object ), std::move( addr ) );
472  return StatusCode::SUCCESS;
473  } ).ignore();
474  return status;
475 }
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
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:86
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
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 476 of file EvtStoreSvc.cpp.

477  {
478  return parentPath.empty()
479  ? registerObject( nullptr, objectPath, pObject )
480  : registerObject( nullptr, std::string{parentPath}.append( "/" ).append( objectPath ), pObject );
481 }
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 482 of file EvtStoreSvc.cpp.

482  {
483  if ( parentObj ) return StatusCode::FAILURE;
484  return fwd( [&, object = std::unique_ptr<DataObject>( pObject ),
485  path = normalize_path( path, rootName() )]( Partition& p ) mutable {
486  if ( m_forceLeaves ) {
487  auto dir = path;
488  for ( auto i = dir.rfind( '/' ); i != std::string_view::npos; i = dir.rfind( '/' ) ) {
489  dir = dir.substr( 0, i );
490  if ( !p.store.find( dir ) ) {
491  if ( msgLevel( MSG::DEBUG ) ) {
492  debug() << "registerObject: adding directory " << std::quoted( dir ) << endmsg;
493  }
494  p.store.put( dir, std::unique_ptr<DataObject>{} );
495  }
496  }
497  }
498  if ( msgLevel( MSG::DEBUG ) ) {
499  auto ptr = object.get();
500  debug() << "registerObject: " << std::quoted( path ) << " (DataObject*)" << static_cast<void*>( ptr )
501  << ( ptr ? " -> " + System::typeinfoName( typeid( *ptr ) ) : std::string{} ) << endmsg;
502  }
503  p.store.put( path, std::move( object ) );
504  return StatusCode::SUCCESS;
505  } );
506 }
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 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:86
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
const std::string & rootName() const override

◆ removePreLoadItem()

StatusCode EvtStoreSvc::removePreLoadItem ( const DataStoreItem item)
override

Definition at line 533 of file EvtStoreSvc.cpp.

533  {
534  auto i = std::remove( m_preLoads.begin(), m_preLoads.begin(), item );
535  m_preLoads.erase( i, m_preLoads.end() );
536  return StatusCode::SUCCESS;
537 }
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)

◆ resetPreLoad()

StatusCode EvtStoreSvc::resetPreLoad ( )
inlineoverride

Definition at line 273 of file EvtStoreSvc.cpp.

273  {
274  m_preLoads.clear();
275  return StatusCode::SUCCESS;
276  }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
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 507 of file EvtStoreSvc.cpp.

507  {
508  if ( pDirectory ) return StatusCode::FAILURE;
509  return fwd( [&]( Partition& p ) {
510  path = normalize_path( path, rootName() );
511  pObject = const_cast<DataObject*>( p.store.get( path ) );
512  if ( msgLevel( MSG::DEBUG ) ) {
513  debug() << "retrieveObject: " << std::quoted( path ) << " (DataObject*)" << (void*)pObject
514  << ( pObject ? " -> " + System::typeinfoName( typeid( *pObject ) ) : std::string{} ) << endmsg;
515  }
516  return pObject ? StatusCode::SUCCESS : StatusCode::FAILURE;
517  } );
518 }
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
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:86
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
const std::string & rootName() const override

◆ rootCLID()

CLID EvtStoreSvc::rootCLID ( ) const
override

Definition at line 313 of file EvtStoreSvc.cpp.

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

◆ rootName()

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

Definition at line 314 of file EvtStoreSvc.cpp.

314 { 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 354 of file EvtStoreSvc.cpp.

354  {
355  s_current = &m_partitions[partition];
356  return StatusCode::SUCCESS;
357 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
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 315 of file EvtStoreSvc.cpp.

315  {
316  m_dataLoader = pDataLoader;
317  if ( m_dataLoader ) m_dataLoader->setDataProvider( dpsvc ? dpsvc : this ).ignore();
318  return StatusCode::SUCCESS;
319 }
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

◆ setNumberOfStores()

StatusCode EvtStoreSvc::setNumberOfStores ( size_t  slots)
override

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

Definition at line 334 of file EvtStoreSvc.cpp.

334  {
335  if ( slots < size_t{1} ) {
336  error() << "Invalid number of slots (" << slots << ")" << endmsg;
337  return StatusCode::FAILURE;
338  }
340  error() << "Too late to change the number of slots!" << endmsg;
341  return StatusCode::FAILURE;
342  }
343  m_slots = slots;
345  return StatusCode::SUCCESS;
346 }
Gaudi::StateMachine::State FSMState() const override
Definition: Service.h:52
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)
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)

◆ setRoot() [1/2]

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 }
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: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

◆ setRoot() [2/2]

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, {}, {}};
430  object->setRegistry( &dummy );
431  rootAddr->setRegistry( &dummy );
432  auto status = m_dataLoader->fillObjRefs( rootAddr.get(), object.get() );
433  if ( status.isSuccess() ) {
434  auto pObject = object.get();
435  status = registerObject( nullptr, root_path, object.release() );
436  if ( status.isSuccess() ) pObject->registry()->setAddress( rootAddr.release() );
437  }
438  return status;
439 }
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:153
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:192

◆ traverseSubTree() [1/2]

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

Definition at line 386 of file EvtStoreSvc.cpp.

386  {
387  return fwd( [&]( Partition& p ) {
388  top = normalize_path( top, rootName() );
389  auto cmp = []( const Entry* lhs, const Entry* rhs ) { return lhs->identifier() < rhs->identifier(); };
390  std::set<const Entry*, decltype( cmp )> keys{std::move( cmp )};
391  for ( const auto& v : p.store ) {
392  if ( boost::algorithm::starts_with( v.second.identifier(), top ) ) keys.insert( &v.second );
393  }
394  auto k = keys.begin();
395  while ( k != keys.end() ) {
396  const auto& id = ( *k )->identifier();
397  int level = std::count( id.begin(), id.end(), '/' );
398  bool accept = pAgent->analyse( const_cast<Entry*>( *( k++ ) ), level );
399  if ( !accept ) {
400  k = std::find_if_not( k, keys.end(),
401  [&id]( const auto& e ) { return boost::algorithm::starts_with( e->identifier(), id ); } );
402  }
403  }
404  return StatusCode::SUCCESS;
405  } );
406 }
virtual bool analyse(IRegistry *pObject, int level)=0
Analyse the data object.
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
def end
Definition: IOTest.py:113
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 237 of file EvtStoreSvc.cpp.

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

◆ traverseTree()

StatusCode EvtStoreSvc::traverseTree ( IDataStoreAgent pAgent)
inlineoverride

Definition at line 240 of file EvtStoreSvc.cpp.

240 { 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 281 of file EvtStoreSvc.cpp.

281 { return dummy( __FUNCTION__ ); }

◆ unlinkObject() [2/3]

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

Definition at line 282 of file EvtStoreSvc.cpp.

282 { return dummy( __FUNCTION__ ); }

◆ unlinkObject() [3/3]

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

Definition at line 283 of file EvtStoreSvc.cpp.

283 { return dummy( __FUNCTION__ ); }

◆ unregisterAddress() [1/2]

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

Definition at line 245 of file EvtStoreSvc.cpp.

245 { return dummy( __FUNCTION__ ); };

◆ unregisterAddress() [2/2]

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

Definition at line 246 of file EvtStoreSvc.cpp.

246 { return dummy( __FUNCTION__ ); };

◆ unregisterObject() [1/3]

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

Definition at line 525 of file EvtStoreSvc.cpp.

525  {
526  return fwd( [&]( Partition& p ) { return p.store.erase( sr ) != 0 ? StatusCode::SUCCESS : StatusCode::FAILURE; } );
527 }
constexpr double sr
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
constexpr static const auto FAILURE
Definition: StatusCode.h:86

◆ unregisterObject() [2/3]

StatusCode EvtStoreSvc::unregisterObject ( DataObject obj)
inlineoverride

Definition at line 254 of file EvtStoreSvc.cpp.

254  {
255  return ( obj && obj->registry() ) ? unregisterObject( obj->registry()->identifier() ) : StatusCode::FAILURE;
256  }
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
StatusCode unregisterObject(std::string_view) override
constexpr static const auto FAILURE
Definition: StatusCode.h:86
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 257 of file EvtStoreSvc.cpp.

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

◆ updateObject() [1/2]

StatusCode EvtStoreSvc::updateObject ( IRegistry )
inlineoverride

Definition at line 268 of file EvtStoreSvc.cpp.

268 { return dummy( __FUNCTION__ ); }

◆ updateObject() [2/2]

StatusCode EvtStoreSvc::updateObject ( DataObject )
inlineoverride

Definition at line 269 of file EvtStoreSvc.cpp.

269 { return dummy( __FUNCTION__ ); }

Member Data Documentation

◆ m_dataLoader

SmartIF<IConversionSvc> EvtStoreSvc::m_dataLoader
private

Definition at line 195 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 191 of file EvtStoreSvc.cpp.

◆ m_freeSlots

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

Definition at line 203 of file EvtStoreSvc.cpp.

◆ m_loader

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

Definition at line 192 of file EvtStoreSvc.cpp.

◆ m_partitions

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

The actual store(s)

Definition at line 201 of file EvtStoreSvc.cpp.

◆ m_preLoads

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

Items to be pre-loaded.

Definition at line 198 of file EvtStoreSvc.cpp.

◆ m_rootCLID

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

Definition at line 189 of file EvtStoreSvc.cpp.

◆ m_rootName

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

Definition at line 190 of file EvtStoreSvc.cpp.

◆ m_slots

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

Definition at line 193 of file EvtStoreSvc.cpp.


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