classPiiSwitch
#include <PiiSwitch.h>
An operation that passes objects conditionally depending on a trigger input.
Inherits PiiDefaultOperation
Description
Inputs
AsynchronousMode, and the
input can even be left unconnected. In
SynchronousMode, the trigger must be a boolean value
or a number.
inputX will
be emitted to outputX when triggered. X ranges from 0
to inputCount - 1. input0 can also be accessed as
input.
Outputs
output0 can also be accessed as
output.
Properties
|
int
|
The number of dynamic inputs (in addition to |
|
Operation mode. |
|
|
bool
|
Turns the trigger input to "always on". |
Public types
|
enum
|
{ SynchronousMode, AsynchronousMode }
Operation modes. |
Constructors and destructor
|
( )
|
Public member functions
|
virtual void
|
(
Checks the operation for execution. |
|
virtual PiiInputSocket *
|
Aliases |
|
virtual PiiOutputSocket *
|
Aliases |
Protected member functions
|
virtual void
|
Called by setState() just before the operation changes to a new state. |
|
(
|
|
|
int
|
|
|
( )
|
|
|
bool
|
( )
|
|
virtual void
|
( )
Executes one round of processing. |
|
void
|
(
|
|
void
|
|
|
void
|
(
|
Property details
-
int dynamicInputCount
[read, write]The number of dynamic inputs (in addition to
trigger).The default is one.
-
OperationMode operationMode
[read, write]Operation mode.
The default mode is
SynchronousMode. -
bool passThrough
[read, write]Turns the trigger input to "always on".
This property only affects AsynchronousMode. Setting its value to
truemakes the operation pass all incoming objects directly and ignore thetriggerinput. If thetriggerinput is not connected (inAsynchronousMode), this property controls can be used to block and release the object flow through this operation. The default value isfalse.
Enumeration details
-
enum OperationMode
Operation modes.
-
AsynchronousMode- trigger and the other inputs are not synchronized to each other. The trigger can come from any unrelated source. If passThrough isfalse, exactly one set of input objects will be passed for each object received from the trigger input. If there are no incoming objects when the trigger arrives, the next incoming objects will be emitted. If passThrough istrue, the trigger input will have no effect and all input objects will be passed. Note that the same objects may be sent many times if the trigger input has a higher data rate than the other inputs. -
SynchronousMode- the trigger signal is used as a "filter". All inputs work in sync: there must be a trigger signal for each set of input objects. If a non-zero number ortrueis received, the input objects will be passed. Otherwise, the input objects will be ignored.
-
Function details
-
PiiSwitch
() -
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.
-
Aliases
inputtoinput0.Reimplemented from PiiBasicOperation.
-
Aliases
outputtooutput0.Reimplemented from PiiBasicOperation.
-
Called by setState() just before the operation changes to a new state.
The function will be called independent of the cause of the state change (internal or external). Derived classes may implement this function to perform whatever functionality is needed when a state changes. The default implementation does nothing.
Reimplemented from PiiBasicOperation.
-
-
int dynamicInputCount
()[protected] -
-
bool passThrough
()[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 setDynamicInputCount
(- int inputCount
[protected] -
-
void setPassThrough
(- bool passThrough
[protected]
Add a note
Not a single note added yet. Be the first, add yours.