EventAnalysis
1.0.0
|
A base class for data providers. More...
#include <DataProvider.h>
Public Member Functions | |
DataProvider (const std::string &name, const std::string &dataSource) | |
Constructor. More... | |
virtual | ~DataProvider () |
Destructor. More... | |
virtual bool | Connect () |
Opens the connection to the data source. More... | |
virtual bool | Disconnect () |
Closes the connection to the data source. More... | |
virtual RetrievalResult | GetObject (const std::string &name, ObjectCategory category, ObjectWrapper &wrapper, std::string &actualName) |
Retrieve the requested data object for current event. More... | |
virtual RetrievalResult | GetObject (const std::string &name, ObjectCategory category, ObjectWrapper &wrapper) |
Retrieve the requested data object for current event. More... | |
virtual bool | SetCurrentEvent (unsigned int event, std::vector< std::string > ¬ValidGlobalObjects) |
Set the current event. More... | |
virtual bool | SetCurrentEvent (unsigned int event) |
Set the current event. More... | |
virtual bool | SetCurrentPass (unsigned int pass, unsigned int iteration) |
Set the current processing pass. More... | |
const std::string & | GetDataSource () |
Getter for data source string. More... | |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
ObjectProducer () | |
Constructor. More... | |
virtual | ~ObjectProducer () |
Destructor. More... | |
void | DeclareProducedObject (std::string name, ObjectCategory category, std::string alias, std::string store) |
Declare a produced objects. More... | |
const ProducedObjects & | GetProducedObjects () const |
Getter method for produced objects. More... | |
virtual std::vector< std::string > | FreeObjects (const std::vector< std::string > &objs, Memory::Status memStatus) |
Free the memory for given objects. More... | |
Private Attributes | |
std::string | _dataSource |
Additional Inherited Members | |
![]() | |
using | ProducedObjects = std::vector< ProducedObject > |
Type for container of produced objects. More... | |
![]() | |
Info (const std::shared_ptr< Representation > &impl) | |
std::shared_ptr< Representation > & | GetRepresentation () |
![]() | |
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 () |
![]() | |
ObjectProducer (const std::shared_ptr< Representation > &impl) | |
std::shared_ptr< Representation > & | GetRepresentation () |
A base class for data providers.
This abstract class declares the interface for classes that provide event informations.
|
inline |
Constructor.
The #dataSource parameter specifies the data source. It can be anything that identifies how to connect to a data source, like a file name, a glob expression, a database connection string etc. The data source string can be retrieved with the GetDataSource protected method.
name | The name of the data provider. |
dataSource | Reference to the data source. |
|
inlinevirtual |
Destructor.
|
inlinevirtual |
Opens the connection to the data source.
This method opens the connection to the data source specified when calling the constructor.
Reimplemented in EA::RootDataProvider.
|
inlinevirtual |
Closes the connection to the data source.
This method closes the connection to the data source opened by Connect.
Reimplemented in EA::RootDataProvider.
|
inline |
Getter for data source string.
|
inlinevirtual |
Retrieve the requested data object for current event.
The possible return values are:
In case of RetrievalResult::SUCCESS, the requested object is returned to the caller by means of the wrapper
parameter; if the data provider recognizes the name
of the requested parameter as an alias then it can return the actual object name by setting the actualName
parameter. In any other case wrapper
must be set equal to nullptr and actualName
to "".
In case the data provider does not support aliases then it is sufficient (although not necessary) to override the GetObject(const std::string &, ObjectCategory, ObjectWrapper &) overload and not this method.
Technical note: this is the GetObject overload called by the framework.
name | The name of the object. |
category | The category of the object to be retrieved (ObjectCategory::EVENT, ObjectCategory::PASS or ObjectCategory::GLOBAL). |
wrapper | Return wrapper for the desired object (wraps nothing if the object is non-existent or not available for the current event). |
actualName | the actual object name, in case name has been recognized as an alias. |
Reimplemented in EA::RootDataProvider.
|
inlinevirtual |
Retrieve the requested data object for current event.
Data providers that do not support aliases can override just this method instead of GetObject(const std::string &, ObjectCategory, ObjectWrapper &, std::string &).
It is provided mainly for backwards compatibility.
Technical note: this overload of GetObject is not called by the framework; the framework call will be automatically forwarded to this method by GetObject(const std::string &, ObjectCategory, ObjectWrapper &, std::string &) if the latter is not overridden.
name | The name of the object. |
category | The category of the object to be retrieved (ObjectCategory::EVENT, ObjectCategory::PASS or ObjectCategory::GLOBAL). |
wrapper | Return wrapper for the desired object (wraps nothing if the object is non-existent or not available for the current event). |
|
inlinevirtual |
Set the current event.
This method can be used to communicate to the data provider the number of the current event. Subsequent calls to the GetObject method will load the data objects for the given event. In case the requested event is not available (e.g. there are less events than required) then the returned value will be false.
A list of global objects that were already provided by the provider in previous events, and that will need to be provided again for the current event, can be passed to the caller by filling the notValidGlobalObjects
vector parameter. This can be useful to inform the caller about those global objects that needs to be re-read from the data source for the current event (e.g. the caller can remove them from the data store and thus a subsequent request from an algorithm will be passed to the data provider that could in turn provide the new version). Providers encompassing this possibility should override this method.
event | The number of the current event. |
notValidGlobalObjects | A list of global objects which are not valid and will be removed from data stores. |
Reimplemented in EA::RootDataProvider.
|
inlinevirtual |
Set the current event.
This overload of SetCurrentEvent can be overridden by those providers that does not encompass the possibility to invalidate global objects.
event | The number of the current event. |
|
inlinevirtual |
Set the current processing pass.
This method can be used to communicate to the data provider the number of the current processing pass and of the current iteration for current pass. Subsequent calls to the GetObject method will load the data objects for the given pass.
pass | The number of the current processing pass. |
|
private |