EventAnalysis
1.3.0
|
Interface for a class which produced data objects. More...
#include <ObjectProducer.h>
Classes | |
class | BadCategory |
Exception class for bad object category. More... | |
class | BadName |
Exception class for bad object name. More... | |
struct | ProducedObject |
Descriptor structure for a produced object. More... | |
class | Representation |
Public Types | |
using | ProducedObjects = std::vector< ProducedObject > |
Type for container of produced objects. More... | |
Public Member Functions | |
ObjectProducer () | |
Constructor. More... | |
virtual | ~ObjectProducer () |
Destructor. More... | |
template<typename C > | |
void | DeclareProducedObject (std::string name, ObjectCategory category, C aliases, std::string store) |
Declare a produced objects. More... | |
const ProducedObjects & | GetProducedObjects () const |
Getter method for produced objects. More... | |
bool | SetDisabled (bool disabled=true) |
Disables/enables the producer. More... | |
virtual std::vector< std::string > | FreeObjects (const std::vector< std::string > &objs, Memory::Status memStatus) |
Free the memory for given objects. More... | |
template<> | |
void | DeclareProducedObject (std::string name, ObjectCategory category, const char *alias, std::string store) |
Protected Member Functions | |
ObjectProducer (const std::shared_ptr< Representation > &impl) | |
std::shared_ptr< Representation > & | GetRepresentation () |
Private Attributes | |
std::shared_ptr< Representation > | _repr |
bool | _disabled = false |
Interface for a class which produced data objects.
This class provides the interface for declaring and retrieving the data objects produced by a derived class.
using EA::ObjectProducer::ProducedObjects = std::vector<ProducedObject> |
Type for container of produced objects.
EA::ObjectProducer::ObjectProducer | ( | ) |
Constructor.
|
inlinevirtual |
Destructor.
|
inlineprotected |
void EA::ObjectProducer::DeclareProducedObject | ( | std::string | name, |
ObjectCategory | category, | ||
const char * | alias, | ||
std::string | store | ||
) |
template void EA::ObjectProducer::DeclareProducedObject | ( | std::string | name, |
ObjectCategory | category, | ||
C | aliases, | ||
std::string | store | ||
) |
Declare a produced objects.
This method adds an object to the list of ones produced by the producer. The declaration fails if one argument has a bad value (e.g. "" for name
or NONE for category
). In this case an exception is thrown.
The aliases
argument can be either a string denoting a single alias of the object or a container of strings in case the object has more than one alias. Empty strings among aliases will be ignored. If the declared object matches an already declared one
name | The name of the object. |
category | The category of the object. |
aliases | The alias(es) of the object (either a string, even empty, or a container of strings). |
store | The store where the object is placed (can be ""). |
ObjectProducer::BadName | if the declaration fails due to a bad object name. |
ObjectProducer::BadCategory | if the declaration fails due to a bad object category. |
|
virtual |
Free the memory for given objects.
This method frees the memory occupied by the given objects, to deal with high memory pressure situations. The memStatus
parameter flags the urgency of the memory free operation; overrides can decide how to handle each case, but a Memory::Status::EXHAUSTED code should correspond to a complete release of object memory (as much as possible0.
objs | The list of objects whose memory can be freed. |
Reimplemented in EA::RootDataProvider, and EA::RootDataProviderV0.
|
inline |
Getter method for produced objects.
This method returns a container with descriptors for the objects that the class produces. The default implementation returns an empty container.
|
inlineprotected |
|
inline |
Disables/enables the producer.
A disabled producer returns an empty list of produced objects
disabled | If true the producer will be disabled, otherwise it will be enabled. |
|
private |
|
private |