MarlinMT  0.1.0
marlinmt::EventStore Class Reference

EventStore class. More...

#include <EventStore.h>

Public Member Functions

 EventStore ()=default
 
 ~EventStore ()=default
 
 EventStore (const EventStore &)=delete
 
EventStoreoperator= (const EventStore &)=delete
 
 EventStore (EventStore &&)=default
 
EventStoreoperator= (EventStore &&)=default
 
void setUID (std::size_t uid)
 Set the event unique id. More...
 
std::size_t uid () const
 Get the event unique id. More...
 
template<typename T >
std::shared_ptr< T > event () const
 Get the underlying event to a specific type. More...
 
template<typename T >
std::shared_ptr< T > takeEvent ()
 Get the underlying event to a specific type. More...
 
template<typename T >
bool isType () const
 Check whether the stored event is of a given type. More...
 
const std::type_index & type () const
 Get the event type. More...
 
template<typename T >
void setEvent (std::shared_ptr< T > evt)
 Set the event pointer using a shared pointer. More...
 
template<typename T >
void setBareEvent (T *evt, bool owner)
 Set the event pointer using a bare pointer and an ownership flag. More...
 
template<typename T , typename ... Args>
std::shared_ptr< T > allocate (Args &&...args)
 Allocate a new event in the event store and return it. More...
 
void reset ()
 Reset the internal pointer. More...
 
Extensionsextensions ()
 Access the event extensions. More...
 
const Extensionsextensions () const
 Access the event extensions. More...
 

Private Attributes

std::size_t _uid {0}
 
std::shared_ptr< void > _event {nullptr}
 The underlying event store implementation. More...
 
std::type_index _eventType {typeid(nullptr)}
 The event implementtion type. More...
 
Extensions _extensions {}
 The event extensions. More...
 

Detailed Description

EventStore class.

Provide an interface to a user defined event object.

Definition at line 17 of file EventStore.h.

Constructor & Destructor Documentation

◆ EventStore() [1/3]

marlinmt::EventStore::EventStore ( )
default

◆ ~EventStore()

marlinmt::EventStore::~EventStore ( )
default

◆ EventStore() [2/3]

marlinmt::EventStore::EventStore ( const EventStore )
delete

◆ EventStore() [3/3]

marlinmt::EventStore::EventStore ( EventStore &&  )
default

Member Function Documentation

◆ allocate()

template<typename T , typename ... Args>
std::shared_ptr< T > marlinmt::EventStore::allocate ( Args &&...  args)
inline

Allocate a new event in the event store and return it.

As the current event is replaced the old one might be deleted via the shared_ptr mechanism.

Definition at line 180 of file EventStore.h.

References setEvent().

◆ event()

template<typename T >
std::shared_ptr< T > marlinmt::EventStore::event ( ) const
inline

Get the underlying event to a specific type.

Definition at line 130 of file EventStore.h.

References _event.

Referenced by marlinmt::DumpEventProcessor::processEvent(), marlinmt::EventSelectorProcessor::processEvent(), and marlinmt::LCIOOutputProcessor::processEvent().

◆ extensions() [1/2]

Extensions & marlinmt::EventStore::extensions ( )
inline

Access the event extensions.

Definition at line 195 of file EventStore.h.

References _extensions.

◆ extensions() [2/2]

const Extensions & marlinmt::EventStore::extensions ( ) const
inline

Access the event extensions.

Definition at line 201 of file EventStore.h.

References _extensions.

◆ isType()

template<typename T >
bool marlinmt::EventStore::isType ( ) const
inline

Check whether the stored event is of a given type.

Definition at line 145 of file EventStore.h.

References _eventType.

◆ operator=() [1/2]

EventStore& marlinmt::EventStore::operator= ( const EventStore )
delete

◆ operator=() [2/2]

EventStore& marlinmt::EventStore::operator= ( EventStore &&  )
default

◆ reset()

void marlinmt::EventStore::reset ( )
inline

Reset the internal pointer.

Definition at line 188 of file EventStore.h.

References _event, and _eventType.

◆ setBareEvent()

template<typename T >
void marlinmt::EventStore::setBareEvent ( T *  evt,
bool  owner 
)
inline

Set the event pointer using a bare pointer and an ownership flag.

Parameters
eventa bare pointer to the event to store
ownerwhether to own the pointer

Definition at line 167 of file EventStore.h.

References _event, and _eventType.

◆ setEvent()

template<typename T >
void marlinmt::EventStore::setEvent ( std::shared_ptr< T >  evt)
inline

Set the event pointer using a shared pointer.

Parameters
eventthe event to store

Definition at line 159 of file EventStore.h.

References _event, and _eventType.

Referenced by allocate().

◆ setUID()

void marlinmt::EventStore::setUID ( std::size_t  uid)
inline

Set the event unique id.

uid the unique id

Definition at line 117 of file EventStore.h.

References _uid.

◆ takeEvent()

template<typename T >
std::shared_ptr< T > marlinmt::EventStore::takeEvent ( )
inline

Get the underlying event to a specific type.

The event in the store is invalidated.

Definition at line 137 of file EventStore.h.

References _event, and _eventType.

◆ type()

const std::type_index & marlinmt::EventStore::type ( ) const
inline

Get the event type.

Definition at line 152 of file EventStore.h.

References _eventType.

◆ uid()

std::size_t marlinmt::EventStore::uid ( ) const
inline

Get the event unique id.

Definition at line 123 of file EventStore.h.

References _uid.

Referenced by marlinmt::RandomSeedManager::generateRandomSeeds(), and marlinmt::TestProcessor::processEvent().

Member Data Documentation

◆ _event

std::shared_ptr<void> marlinmt::EventStore::_event {nullptr}
private

The underlying event store implementation.

Definition at line 107 of file EventStore.h.

Referenced by event(), reset(), setBareEvent(), setEvent(), and takeEvent().

◆ _eventType

std::type_index marlinmt::EventStore::_eventType {typeid(nullptr)}
private

The event implementtion type.

Definition at line 109 of file EventStore.h.

Referenced by isType(), reset(), setBareEvent(), setEvent(), takeEvent(), and type().

◆ _extensions

Extensions marlinmt::EventStore::_extensions {}
private

The event extensions.

Definition at line 111 of file EventStore.h.

Referenced by extensions().

◆ _uid

std::size_t marlinmt::EventStore::_uid {0}
private

Definition at line 105 of file EventStore.h.

Referenced by setUID(), and uid().


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