te::process::Task Class Referenceabstract

This class represents the description of a parameter. More...

#include <Task.h>

Inheritance diagram for te::process::Task:
te::process::DataAccessTask te::process::DataStoreTask

Public Types

enum class  State {
  NOT_INITIALIZED , MISSING_PARAMETERS , READY_TO_RUN , RUNNING ,
  FINISHED , FINISHED_WITH_ERRORS
}
 

Public Member Functions

void addConnector (Connector *connector)
 Removes a parameter connector to this class. More...
 
const TaskCapabilitiesgetCapabilities () const
 Gets the current execution state of the task. More...
 
const std::string & getId () const
 
std::vector< Connector * > getInputConnectors () const
 Gets all the output connectors. More...
 
std::vector< Connector * > getOutputConnectors () const
 Checks if the task is valid, that is, if all the required input parameters have values OR connectors associated to them. More...
 
const te::process::ParameterValuegetParameter (std::size_t index) const
 Sets the index-th parameter. This object will optionally take the ownership of the value pointer. More...
 
State getState () const
 Gets the index-th parameter. More...
 
const TaskParametersgetTaskParameters () const
 Sets the task paramters. This class will take the ownership of the given pointer. More...
 
const std::string & getType () const
 Gets the capabilities of the task. More...
 
bool isValid (std::string &errorMessage) const
 Runs the task. More...
 
void removeConnector (Connector *connector)
 Gets all the input connectors. More...
 
void run ()
 
void setId (const std::string &id)
 Gets the type of the task. More...
 
void setParameter (std::size_t index, te::process::ParameterValue *value, bool takeOwnership)
 Gets the task paramters. More...
 
void setTaskParameters (TaskParameters *taskParameters)
 Adds a parameter connector to this class. More...
 
 Task (const std::string &taskType)
 It initializes the Task. More...
 
virtual ~Task ()
 Virtual destructor. More...
 

Protected Member Functions

bool checkConnectorsAreReady ()
 Pushes the parameters into the output connectors. More...
 
void checkForReadyToRun ()
 Runs the task. More...
 
void init (TaskCapabilities *capabilities)
 < Initializes the task. This function must be called by any class that extends this abstraction. The abstraction will take the ownership of the pointer More...
 
void pushParametersToConnectors ()
 This function is called whenever the parameters are changed and is responsible for checking the parameters are valid. If they are, change the task state to Ready to Run. More...
 
virtual void runImpl ()=0
 

Protected Attributes

std::unique_ptr< TaskCapabilitiesm_capabilities
 
std::vector< Connector * > m_connectors
 
std::string m_id
 The ID of the task. More...
 
std::unique_ptr< TaskParametersm_parameters
 
State m_state
 
std::string m_taskType
 The type of the task. Used by the factory. More...
 

Detailed Description

This class represents the description of a parameter.

This class is a holder for all the task input and output parameters.

Abstraction that represents a Task that can be executed.

This class represents the value of a parameter.

Definition at line 53 of file Task.h.

Member Enumeration Documentation

◆ State

Enumerator
NOT_INITIALIZED 
MISSING_PARAMETERS 
READY_TO_RUN 
RUNNING 
FINISHED 
FINISHED_WITH_ERRORS 

Definition at line 57 of file Task.h.

Constructor & Destructor Documentation

◆ Task()

te::process::Task::Task ( const std::string &  taskType)

It initializes the Task.

◆ ~Task()

virtual te::process::Task::~Task ( )
virtual

Virtual destructor.

Gets the id of the task

Member Function Documentation

◆ addConnector()

void te::process::Task::addConnector ( Connector connector)

Removes a parameter connector to this class.

◆ checkConnectorsAreReady()

bool te::process::Task::checkConnectorsAreReady ( )
protected

Pushes the parameters into the output connectors.

◆ checkForReadyToRun()

void te::process::Task::checkForReadyToRun ( )
protected

Runs the task.

◆ getCapabilities()

const TaskCapabilities* te::process::Task::getCapabilities ( ) const

Gets the current execution state of the task.

◆ getId()

const std::string& te::process::Task::getId ( ) const

◆ getInputConnectors()

std::vector<Connector*> te::process::Task::getInputConnectors ( ) const

Gets all the output connectors.

◆ getOutputConnectors()

std::vector<Connector*> te::process::Task::getOutputConnectors ( ) const

Checks if the task is valid, that is, if all the required input parameters have values OR connectors associated to them.

◆ getParameter()

const te::process::ParameterValue* te::process::Task::getParameter ( std::size_t  index) const

Sets the index-th parameter. This object will optionally take the ownership of the value pointer.

◆ getState()

State te::process::Task::getState ( ) const

Gets the index-th parameter.

◆ getTaskParameters()

const TaskParameters* te::process::Task::getTaskParameters ( ) const

Sets the task paramters. This class will take the ownership of the given pointer.

◆ getType()

const std::string& te::process::Task::getType ( ) const

Gets the capabilities of the task.

◆ init()

void te::process::Task::init ( TaskCapabilities capabilities)
protected

< Initializes the task. This function must be called by any class that extends this abstraction. The abstraction will take the ownership of the pointer

Checks if all the input connectors are ready. If at least one connector is not ready, it returns FALSE.

◆ isValid()

bool te::process::Task::isValid ( std::string &  errorMessage) const

Runs the task.

◆ pushParametersToConnectors()

void te::process::Task::pushParametersToConnectors ( )
protected

This function is called whenever the parameters are changed and is responsible for checking the parameters are valid. If they are, change the task state to Ready to Run.

◆ removeConnector()

void te::process::Task::removeConnector ( Connector connector)

Gets all the input connectors.

◆ run()

void te::process::Task::run ( )

◆ runImpl()

virtual void te::process::Task::runImpl ( )
protectedpure virtual

◆ setId()

void te::process::Task::setId ( const std::string &  id)

Gets the type of the task.

◆ setParameter()

void te::process::Task::setParameter ( std::size_t  index,
te::process::ParameterValue value,
bool  takeOwnership 
)

Gets the task paramters.

◆ setTaskParameters()

void te::process::Task::setTaskParameters ( TaskParameters taskParameters)

Adds a parameter connector to this class.

Member Data Documentation

◆ m_capabilities

std::unique_ptr<TaskCapabilities> te::process::Task::m_capabilities
protected

Definition at line 136 of file Task.h.

◆ m_connectors

std::vector<Connector*> te::process::Task::m_connectors
protected

Definition at line 138 of file Task.h.

◆ m_id

std::string te::process::Task::m_id
protected

The ID of the task.

Definition at line 134 of file Task.h.

◆ m_parameters

std::unique_ptr<TaskParameters> te::process::Task::m_parameters
protected

Definition at line 137 of file Task.h.

◆ m_state

State te::process::Task::m_state
protected

Definition at line 135 of file Task.h.

◆ m_taskType

std::string te::process::Task::m_taskType
protected

The type of the task. Used by the factory.

Definition at line 133 of file Task.h.


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