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

Interface for a class which produced data objects. More...

#include <ObjectProducer.h>

Inheritance diagram for EA::ObjectProducer:
EA::Algorithm EA::DataProvider EA::AlgoSequence EA::PersistenceAlgo EA::RootDataProvider EA::RootDataProviderV0 EA::AlgoSequenceDecorator EA::GarbageCollectorDecorator

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 ProducedObjectsGetProducedObjects () 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
 

Detailed Description

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.

Member Typedef Documentation

◆ ProducedObjects

Type for container of produced objects.

Constructor & Destructor Documentation

◆ ObjectProducer() [1/2]

EA::ObjectProducer::ObjectProducer ( )

Constructor.

◆ ~ObjectProducer()

virtual EA::ObjectProducer::~ObjectProducer ( )
inlinevirtual

Destructor.

◆ ObjectProducer() [2/2]

EA::ObjectProducer::ObjectProducer ( const std::shared_ptr< Representation > &  impl)
inlineprotected

Member Function Documentation

◆ DeclareProducedObject() [1/2]

template<>
void EA::ObjectProducer::DeclareProducedObject ( std::string  name,
ObjectCategory  category,
const char *  alias,
std::string  store 
)

◆ DeclareProducedObject() [2/2]

template<typename C >
template void EA::ObjectProducer::DeclareProducedObject ( std::string  name,
ObjectCategory  category,
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

Parameters
nameThe name of the object.
categoryThe category of the object.
aliasesThe alias(es) of the object (either a string, even empty, or a container of strings).
storeThe store where the object is placed (can be "").
Exceptions
ObjectProducer::BadNameif the declaration fails due to a bad object name.
ObjectProducer::BadCategoryif the declaration fails due to a bad object category.

◆ FreeObjects()

std::vector< std::string > EA::ObjectProducer::FreeObjects ( const std::vector< std::string > &  objs,
Memory::Status  memStatus 
)
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.

Parameters
objsThe list of objects whose memory can be freed.
Returns
A list of objects whose memory has been released.
See also
#Memory::GetState

Reimplemented in EA::RootDataProvider, and EA::RootDataProviderV0.

◆ GetProducedObjects()

const ProducedObjects& EA::ObjectProducer::GetProducedObjects ( ) const
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.

Returns
The descriptors for the produced objects.

◆ GetRepresentation()

std::shared_ptr<Representation>& EA::ObjectProducer::GetRepresentation ( )
inlineprotected

◆ SetDisabled()

bool EA::ObjectProducer::SetDisabled ( bool  disabled = true)
inline

Disables/enables the producer.

A disabled producer returns an empty list of produced objects

Parameters
disabledIf true the producer will be disabled, otherwise it will be enabled.
Returns
true if the producer has been successfully disabled/enabled.

Member Data Documentation

◆ _disabled

bool EA::ObjectProducer::_disabled = false
private

◆ _repr

std::shared_ptr<Representation> EA::ObjectProducer::_repr
private

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