![]() |
stromx
0.8.0
|
Abstract operator. More...
#include <Operator.h>
Public Types | |
| enum | Status { NONE, INITIALIZED, ACTIVE, EXECUTING } |
Public Member Functions | |
| Operator (OperatorKernel *const kernel) | |
| const std::string & | name () const |
| void | setName (const std::string &name) |
| const Position & | position () const |
| void | setPosition (const Position &position) |
| const OperatorInfo & | info () const |
| Status | status () const |
| void | setParameter (const unsigned int id, const Data &value) |
| void | setParameter (const unsigned int id, const Data &value, const unsigned int timeout) |
| DataRef | getParameter (const unsigned int id) const |
| DataRef | getParameter (const unsigned int id, const unsigned int timeout) const |
| const DataContainer | getOutputData (const unsigned int id) const |
| void | setInputData (const unsigned int id, const DataContainer &data) |
| void | clearOutputData (const unsigned int id) |
| void | addObserver (const ConnectorObserver *const observer) |
| void | removeObserver (const ConnectorObserver *const observer) |
| const AbstractFactory * | factory () const |
| void | setFactory (const AbstractFactory *const factory) |
Abstract operator.
Operators are the core elements of a stream. The have inputs and outputs which can be connected to other operators of the same stream. Moreover, it is possible to access these inputs and outputs from outside to pass data to the stream or obtain data from it.
Moreover, each operator has a current status and a number of parameters. If the value of a specific parameter can be read or written depends on the current status of the operators.
|
explicit |
Constructs an operator from an operator kernel.
| kernel | The operator deletes kernel upon its destruction. |
| void stromx::runtime::Operator::addObserver | ( | const ConnectorObserver *const | observer | ) |
Adds an observer which is called whenever the data at an input or output connector changes.
| observer | A pointer to the observer is stored but not owned by the operator. |
| WrongArgument | If observer is a null pointer. |
| void stromx::runtime::Operator::clearOutputData | ( | const unsigned int | id | ) |
Removes any output data from the output id.
| WrongOperatorState |
| const AbstractFactory * stromx::runtime::Operator::factory | ( | ) | const |
Returns the current factory of the operator. The factory is passed to the operator kernel during the execution and can be used by the operator kernel to instantiate new data objects or operators. Returns null if no current factory is set.
| const DataContainer stromx::runtime::Operator::getOutputData | ( | const unsigned int | id | ) | const |
Waits for data at the output ID and returns it. The data is not removed by this function and will still be available and block the output. Use clearOutputData() to remove the output data.
| id | The ID of the output. |
| Interrupt | |
| WrongOperatorState |
| DataRef stromx::runtime::Operator::getParameter | ( | const unsigned int | id | ) | const |
Gets the current value of the parameter id. The functions waits until obtaining the parameter value is possible, i.e. the operator is not executed or accessed by another thread.
| id | The ID of the parameter to be set. |
| Interrupt | |
| ParameterAccessViolation | |
| WrongParameterId |
| DataRef stromx::runtime::Operator::getParameter | ( | const unsigned int | id, |
| const unsigned int | timeout | ||
| ) | const |
Gets the current value of the parameter id. The functions waits until obtaining the parameter value is possible, i.e. the operator is not executed or accessed by another thread. If the function is not successful within the specified timeout the functions throws an exception and returns.
| id | The ID of the parameter to be set. |
| timeout | The maximal time to wait in milliseconds. |
| Interrupt | |
| ParameterAccessViolation | |
| Timeout | If the parameter could not be set during the timeout. |
| WrongParameterId |
| const OperatorInfo & stromx::runtime::Operator::info | ( | ) | const |
Returns information about the inputs, outputs and parameters of the operator.
|
inline |
Returns the name of the operator.
|
inline |
Returns the position of the operator.
| void stromx::runtime::Operator::removeObserver | ( | const ConnectorObserver *const | observer | ) |
Removes an observer from the set of current observers of this operator.
| observer | The observer to be removed. |
| WrongArgument | If the observer has not been added to the operator before. |
| void stromx::runtime::Operator::setFactory | ( | const AbstractFactory *const | factory | ) |
Sets the factory of the operator. The factory is passed to the operator kernel during the execution and can be used by the operator kernel to instantiate new data objects or operators.
| factory | A pointer to the factory is stored but not owned by the operator. Pass null to reset the factory of this operator. |
| WrongState | If the operator is active or executing. |
| void stromx::runtime::Operator::setInputData | ( | const unsigned int | id, |
| const DataContainer & | data | ||
| ) |
Waits for the input to to become empty and then places data at the input.
| Interrupt | |
| WrongOperatorState |
|
inline |
Sets the name of the operator. The name is for informal use only and does not have any effect on the functionality of the operator.
| void stromx::runtime::Operator::setParameter | ( | const unsigned int | id, |
| const Data & | value | ||
| ) |
Sets the parameter id to value. The functions waits until setting the parameter value is possible, i.e. the operator is not executed or accessed by another thread.
| void stromx::runtime::Operator::setParameter | ( | const unsigned int | id, |
| const Data & | value, | ||
| const unsigned int | timeout | ||
| ) |
Sets the parameter id to value. The functions waits until setting the parameter value is possible, i.e. the operator is not executed or accessed by another thread. If the function is not successful within the specified timeout the functions throws an exception and returns.
| id | The ID of the parameter to be set. |
| value | The new parameter value. |
| timeout | The maximal time to wait in milliseconds. |
| Interrupt | |
| ParameterAccessViolation | |
| Timeout | If the parameter could not be set during the timeout. |
| WrongParameterId | |
| WrongParameterType |
|
inline |
Sets the position of the operator. The position is used only for visualizing the stream and does not have any effect on the functionality of the operator.
| Operator::Status stromx::runtime::Operator::status | ( | ) | const |
Returns the current status of the operator.
1.8.12