classPiiMatrixComposer
#include <PiiMatrixComposer.h>
Composes an output matrix from N inputs of primitive data types.
Inherits PiiDefaultOperation
Description
The amount of inputs is set with dynamicInputCount.
At least one dynamic input must be connected. The output matrix
will be generated once all the connected inputs have received an
object. If the sync input is connected, the output
will be emitted after all data has been received.
The type of the output matrix is determined by the type of the object in the first connected input.
Inputs
Outputs
T is read, a PiiMatrix<T> will be
emitted.
Properties
|
QVariantList
|
A default value for each input as a |
|
The direction of the composition. |
|
|
int
|
The number of inputs. |
Constructors and destructor
Public member functions
|
virtual void
|
(
Checks the operation for execution. |
Protected member functions
|
QVariantList
|
( )
|
|
( )
|
|
|
int
|
|
|
virtual void
|
( )
Executes one round of processing. |
|
void
|
(
|
|
void
|
|
|
void
|
(
|
|
virtual void
|
Informs the operation about synchronization events. |
Property details
-
QVariantList defaultValues
[read, write]A default value for each input as a
double.The default value will be used if the corresponding input is not connected. Default values will be casted to the type of the output matrix. For exampe if the type of the output matrix is PiiMatrix<int> and the default value for an output is 1.1, the value is rounded to value 1 in the matrix.
If the number of default values is smaller than dynamicInputCount, extra zeroes will be automatically added at the end of the list when the operation is started.
composer->setProperty("dynamicInputCount", 4); composer->setProperty("defaultValues", QVariantList() << 1.0 << 2.0); // ... engine.execute(); // defaultValues is now (1.0, 2.0, 0.0, 0.0)
-
Pii::MatrixDirection direction
[read, write]The direction of the composition.
Pii::Horizontally(the default) creates dynamicInputCount columns,Pii::Verticallycreates the same number of rows. -
int dynamicInputCount
[read, write]The number of inputs.
Defines also the amount of columns (or rows, if direction =
Pii::Vertically) in the output matrix. The default is one.
Function details
-
PiiMatrixComposer
() -
~PiiMatrixComposer
() -
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.
-
QVariantList defaultValues
()[protected] -
-
int dynamicInputCount
()[protected] -
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.
-
void setDefaultValues
(- const QVariantList & defaultValues
[protected] -
-
void setDynamicInputCount
(- int cnt
[protected] -
Informs the operation about synchronization events.
The most typical use of this function is to see when all objects in an input group and all of its child groups have been received. For example, if the operation reads large images from one input and a number of sub-images for each large image from another input, a sync event is sent whenever all the small images that correspond to one large image have been processed. Your implementation may then either just record the synchronized state or to send any buffered data. The default implementation does nothing.
Calls to process(), syncEvent(), and setProperty() are synchronized and cannot occur simultaneously. PiiDefaultOperation ensures this by locking processLock() for reading before calling syncEvent().
void MyOperation::syncEvent(SyncEvent* event) { if (event->type() == SyncEvent::EndInput && event->groupId() == _pLargeImageInput->groupId()) doWhateverNeededNow(); }
Reimplemented from PiiDefaultOperation.
Add a note
Not a single note added yet. Be the first, add yours.