EventAnalysis  1.3.0
Classes | Public Member Functions | Private Attributes | List of all members
EA::PersistenceService Class Reference

#include <PersistenceService.h>

Inheritance diagram for EA::PersistenceService:
EA::Info EA::Configurable EA::DataStoreUser EA::ObjectConsumer EA::RootPersistenceService

Classes

struct  BookedObject
 
struct  CopyNotOverridden
 Exception class for missing override of Copy. More...
 

Public Member Functions

 PersistenceService (const std::string &name, const std::string &output)
 
virtual ~PersistenceService ()
 
const std::string & GetOutput ()
 
virtual bool Connect ()
 
virtual bool Disconnect ()
 
virtual bool BookEventObject (const std::string &objName, const std::string &objStore)
 Books an event object for persistence. More...
 
virtual bool BookPassObject (const std::string &objName, const std::string &objStore)
 
virtual bool BookGlobalObject (const std::string &objName, const std::string &objStore)
 
virtual std::vector< BookedObjectGetBookedEventObjects ()
 Gets the list of booked event objects. More...
 
virtual std::vector< BookedObjectGetBookedPassObjects ()
 Gets the list of booked pass objects. More...
 
virtual std::vector< BookedObjectGetBookedGlobalObjects ()
 Gets the list of booked global objects. More...
 
virtual bool BeginOfEvent ()
 
virtual bool EndOfEvent ()
 Save event objects on persistence medium. More...
 
virtual bool BeginOfPass ()
 
virtual bool EndOfPass ()
 
virtual bool BeginOfProcessing ()
 
virtual bool EndOfProcessing ()
 
virtual std::unique_ptr< PersistenceServiceCopy (const std::string &name, const std::string &output)
 Creates a copy of the persistence service. More...
 
- Public Member Functions inherited from EA::Info
 Info (const std::string &name)
 Constructor. More...
 
virtual ~Info ()
 Destructor. More...
 
virtual const std::string GetType () const
 
virtual const std::string GetName () const
 The type (i.e. class) of the object. More...
 
virtual const std::string GetVersion () const
 The name of the object. More...
 
- Public Member Functions inherited from EA::Configurable
 Configurable ()
 Constructor. More...
 
template<typename T >
bool SetParameter (const std::string &name, const T &value)
 Set the value of a parameter. More...
 
bool SetParameter (const std::string &name, const char *value)
 Set the value of a string parameter using a string literal. More...
 
std::vector< std::string > GetParameters ()
 Get the names of the parameters. More...
 
- Public Member Functions inherited from EA::DataStoreUser
 DataStoreUser ()
 
virtual ~DataStoreUser ()
 Destructor. More...
 
virtual bool SetDataStoreManager (observer_ptr< DataStoreManager > dsManager)
 Injector for dependency on DataStoreManager. More...
 
observer_ptr< DataStoreManagerGetDataStoreManager ()
 Getter for the Data store manager. More...
 
- Public Member Functions inherited from EA::ObjectConsumer
 ObjectConsumer ()
 Constructor. More...
 
void DeclareConsumedObject (std::string name, ObjectCategory category, std::string store, bool optional=false)
 Declare a consumed objects. More...
 
void DeclareAlternative (const std::string &name, ObjectCategory category, std::string store, const std::string &alternativeName, ObjectCategory alternativeCategory, std::string alternativeStore)
 Declares two already declared objects as alternatives. More...
 
const ConsumedObjectsGetConsumedObjects () const
 Getter method for consumed objects. More...
 

Private Attributes

std::string _output
 

Additional Inherited Members

- Public Types inherited from EA::ObjectConsumer
using ConsumedObjects = std::vector< ConsumedObject >
 Type for container of produced objects. More...
 
- Protected Member Functions inherited from EA::Info
 Info (const std::shared_ptr< Representation > &impl)
 
std::shared_ptr< Representation > & GetRepresentation ()
 
- Protected Member Functions inherited from EA::Configurable
template<typename T >
bool DefineParameter (const std::string &name, T &variable)
 Set a parameter. More...
 
 Configurable (const std::shared_ptr< Representation > &impl)
 
std::shared_ptr< Representation > & GetRepresentation ()
 
- Protected Member Functions inherited from EA::DataStoreUser
 DataStoreUser (const std::shared_ptr< Representation > &impl)
 
std::shared_ptr< Representation > & GetRepresentation ()
 
- Protected Member Functions inherited from EA::ObjectConsumer
 ObjectConsumer (const std::shared_ptr< Representation > &impl)
 
std::shared_ptr< Representation > & GetRepresentation ()
 

Constructor & Destructor Documentation

◆ PersistenceService()

EA::PersistenceService::PersistenceService ( const std::string &  name,
const std::string &  output 
)
inline

◆ ~PersistenceService()

virtual EA::PersistenceService::~PersistenceService ( )
inlinevirtual

Member Function Documentation

◆ BeginOfEvent()

virtual bool EA::PersistenceService::BeginOfEvent ( )
inlinevirtual

Reimplemented in EA::RootPersistenceService.

◆ BeginOfPass()

virtual bool EA::PersistenceService::BeginOfPass ( )
inlinevirtual

Reimplemented in EA::RootPersistenceService.

◆ BeginOfProcessing()

virtual bool EA::PersistenceService::BeginOfProcessing ( )
inlinevirtual

Reimplemented in EA::RootPersistenceService.

◆ BookEventObject()

virtual bool EA::PersistenceService::BookEventObject ( const std::string &  objName,
const std::string &  objStore 
)
inlinevirtual

Books an event object for persistence.

The given object from the given event data store will be saved in the persistence medium at the end of each event. The object can be booked even if it or its data store do not exist yet. The actual check about the existence of the given object in the given store is done at the end of the event.

Parameters
objNameThe name of the object.
objStoreThe name of the event store containing the object.
Returns
false if the object cannot be booked (e.g. another event object with the same name has already been booked), true otherwise
See also
EndOfEvent

Reimplemented in EA::RootPersistenceService.

◆ BookGlobalObject()

virtual bool EA::PersistenceService::BookGlobalObject ( const std::string &  objName,
const std::string &  objStore 
)
inlinevirtual

Reimplemented in EA::RootPersistenceService.

◆ BookPassObject()

virtual bool EA::PersistenceService::BookPassObject ( const std::string &  objName,
const std::string &  objStore 
)
inlinevirtual

Reimplemented in EA::RootPersistenceService.

◆ Connect()

virtual bool EA::PersistenceService::Connect ( )
inlinevirtual

Reimplemented in EA::RootPersistenceService.

◆ Copy()

virtual std::unique_ptr<PersistenceService> EA::PersistenceService::Copy ( const std::string &  name,
const std::string &  output 
)
inlinevirtual

Creates a copy of the persistence service.

This method returns a copy of the persistence service, with different name and output. This method should be overridden in derived classes if the copy of the persistence is foreseen; the default implementation simply throws an exception for avoiding a silent misuse.

Overrides of this method in derived classes must return a copied service configured exactly as the original one (e.g. with the same booked objects and parameter values) but not connected to the output, i.e. a configured and ready-to-use but pristine service. The user should then take care of calling Connect etc.

Parameters
nameThe name of the copied persistence service.
outputThe output of the copied persistence service.
Returns
a pointer to the copied persistence service.
Exceptions
CopyNotOverridden

Reimplemented in EA::RootPersistenceService.

◆ Disconnect()

virtual bool EA::PersistenceService::Disconnect ( )
inlinevirtual

Reimplemented in EA::RootPersistenceService.

◆ EndOfEvent()

virtual bool EA::PersistenceService::EndOfEvent ( )
inlinevirtual

Save event objects on persistence medium.

This method transfers all the booked event objects to the persistence medium. It fails if an object does not exist in its data store, or if the data store supposed to contain such an object does not exist.

Returns
true if the object has been successfully saved.

Reimplemented in EA::RootPersistenceService.

◆ EndOfPass()

virtual bool EA::PersistenceService::EndOfPass ( )
inlinevirtual

Reimplemented in EA::RootPersistenceService.

◆ EndOfProcessing()

virtual bool EA::PersistenceService::EndOfProcessing ( )
inlinevirtual

Reimplemented in EA::RootPersistenceService.

◆ GetBookedEventObjects()

virtual std::vector<BookedObject> EA::PersistenceService::GetBookedEventObjects ( )
inlinevirtual

Gets the list of booked event objects.

Returns
a vector with the booked event objects.

Reimplemented in EA::RootPersistenceService.

◆ GetBookedGlobalObjects()

virtual std::vector<BookedObject> EA::PersistenceService::GetBookedGlobalObjects ( )
inlinevirtual

Gets the list of booked global objects.

Returns
a vector with the booked global objects.

Reimplemented in EA::RootPersistenceService.

◆ GetBookedPassObjects()

virtual std::vector<BookedObject> EA::PersistenceService::GetBookedPassObjects ( )
inlinevirtual

Gets the list of booked pass objects.

Returns
a vector with the booked pass objects.

Reimplemented in EA::RootPersistenceService.

◆ GetOutput()

const std::string& EA::PersistenceService::GetOutput ( )
inline

Member Data Documentation

◆ _output

std::string EA::PersistenceService::_output
private

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