classPiiArithmeticOperation
#include <PiiArithmeticOperation.h>
An operation that performs simple arithmetic like adding and subtracting values.
Inherits PiiDefaultOperation
Description
Inputs
input0
must also be a matrix.
Outputs
input0 is PiiMatrix<int> and
input1 is double, output type is PiiMatrix<double>. If both
types are the same, no type change will be made.
Properties
|
A constant value for the input1. |
|
|
The arithmetic operator to be used. |
Public types
|
enum
|
{ Plus, Minus, Division, Multiplication, ElementMultiplication,
ElementDivision }
Known arithmetic functions. |
Constructors and destructor
Public member functions
|
virtual void
|
(
Checks the operation for execution. |
|
( )
|
|
|
( )
|
|
|
void
|
|
|
void
|
|
Protected member functions
|
virtual void
|
( )
Executes one round of processing. |
Property details
-
PiiVariant constant
[read, write]A constant value for the input1.
If input1 is not connected, the second operand is this constant value.
-
Function function
[read, write]The arithmetic operator to be used.
Default value is
Plus.
Enumeration details
-
enum Function
Known arithmetic functions.
We can't use "operator", because it is reserved by C++.
-
Plus- addition -
Minus- subtraction -
Division- division -
Multiplication- multiplication -
ElementMultiplication- multiply matrices element-by-element (see Pii::multiply()). This operator applies only to two matrices. For other types, ordinary multiplication will be used. -
ElementDivision- divide matrices element-by-element (see Pii::divide()). This operator applies only to two matrices. For other types, ordinary division will be used.
-
Function details
-
PiiArithmeticOperation
() -
virtual void check
(- bool reset
[virtual]Checks the operation for execution.
This function creates a suitable flow controller by calling createFlowController(). It then sets the flow controller to the active processor and sets the processor as the input controller for all inputs.
If you change socket groupings in your overridden implementation, please call PiiDefaultOperation::check() after that. Otherwise, your new groupings will not be in effect.
Reimplemented from PiiDefaultOperation.
-
PiiVariant constant
() -
Function function
() -
void setConstant
-
void setFunction
-
virtual void process
()[protected, virtual]Executes one round of processing.
This function is invoked by the processor if the necessary preconditions for a new processing round are met. This function does all the necessary calculations to create output objects and sends them to output sockets.
Calls to process(), syncEvent(), and setProperty() are synchronized and cannot occur simultaneously. PiiDefaultOperation ensures this by locking processLock() for reading before calling process().
Note: With time-consuming operations, one should occasionally check that the operation hasn't been interrupted, i.e. that state() returns
Running.Exceptions
- PiiExecutionException
-
whenever an unrecoverable error occurs during a processing round, the operation is interrupted, or finishes execution due to end of input data.
Reimplemented from PiiDefaultOperation.
Add a note
Not a single note added yet. Be the first, add yours.