stromx  0.8.0
Public Types | Public Member Functions | List of all members
stromx::runtime::Operator Class Reference

Abstract operator. More...

#include <Operator.h>

Inheritance diagram for stromx::runtime::Operator:
stromx::runtime::OperatorTester

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 Positionposition () const
 
void setPosition (const Position &position)
 
const OperatorInfoinfo () 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 AbstractFactoryfactory () const
 
void setFactory (const AbstractFactory *const factory)
 

Detailed Description

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.

Member Enumeration Documentation

§ Status

The possible states of an operator.

Enumerator
NONE 

The default status of an operator after instantiation.

INITIALIZED 

The is initialized but not ready to process data.

ACTIVE 

The operator is ready to process data.

EXECUTING 

The operator is actively processing data.

Constructor & Destructor Documentation

§ Operator()

stromx::runtime::Operator::Operator ( OperatorKernel *const  kernel)
explicit

Constructs an operator from an operator kernel.

Parameters
kernelThe operator deletes kernel upon its destruction.

Member Function Documentation

§ addObserver()

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.

Parameters
observerA pointer to the observer is stored but not owned by the operator.
Exceptions
WrongArgumentIf observer is a null pointer.

§ clearOutputData()

void stromx::runtime::Operator::clearOutputData ( const unsigned int  id)

Removes any output data from the output id.

Exceptions
WrongOperatorState

§ factory()

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.

§ getOutputData()

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.

Parameters
idThe ID of the output.
Exceptions
Interrupt
WrongOperatorState

§ getParameter() [1/2]

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.

Parameters
idThe ID of the parameter to be set.
Exceptions
Interrupt
ParameterAccessViolation
WrongParameterId

§ getParameter() [2/2]

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.

Parameters
idThe ID of the parameter to be set.
timeoutThe maximal time to wait in milliseconds.
Exceptions
Interrupt
ParameterAccessViolation
TimeoutIf the parameter could not be set during the timeout.
WrongParameterId

§ info()

const OperatorInfo & stromx::runtime::Operator::info ( ) const

Returns information about the inputs, outputs and parameters of the operator.

§ name()

const std::string& stromx::runtime::Operator::name ( ) const
inline

Returns the name of the operator.

§ position()

const Position& stromx::runtime::Operator::position ( ) const
inline

Returns the position of the operator.

§ removeObserver()

void stromx::runtime::Operator::removeObserver ( const ConnectorObserver *const  observer)

Removes an observer from the set of current observers of this operator.

Parameters
observerThe observer to be removed.
Exceptions
WrongArgumentIf the observer has not been added to the operator before.

§ setFactory()

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.

Parameters
factoryA pointer to the factory is stored but not owned by the operator. Pass null to reset the factory of this operator.
Exceptions
WrongStateIf the operator is active or executing.

§ setInputData()

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.

Exceptions
Interrupt
WrongOperatorState

§ setName()

void stromx::runtime::Operator::setName ( const std::string &  name)
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.

§ setParameter() [1/2]

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.

Exceptions
Interrupt
WrongParameterType
ParameterAccessViolation
WrongParameterId

§ setParameter() [2/2]

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.

Parameters
idThe ID of the parameter to be set.
valueThe new parameter value.
timeoutThe maximal time to wait in milliseconds.
Exceptions
Interrupt
ParameterAccessViolation
TimeoutIf the parameter could not be set during the timeout.
WrongParameterId
WrongParameterType

§ setPosition()

void stromx::runtime::Operator::setPosition ( const Position position)
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.

§ status()

Operator::Status stromx::runtime::Operator::status ( ) const

Returns the current status of the operator.


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