Into

Modules

Documentation

classPiiComparisonOperation

#include <PiiComparisonOperation.h>

Compare two values and output a binary outcome.

Inherits PiiDefaultOperation

Description

Two inputs are compared with a predefined comparison operator. The object read from input0 is always used as the left-hand operand. The right-hand operand is either a constant or the object read from input1, if it is connected.

Inputs

input0first input object. Any number or numeric matrix.
input1second (optional) input object. Any number or numeric matrix. If input0 contains a scalar, this must be a scalar. If input0 contains a matrix, this must be either a scalar or a matrix with the same size.

Outputs

outputThe comparison result, bool or PiiMatrix<bool>.

Properties

double

A constant value that is used instead of input1 if it is not connected.

The comparison function.

Public types

enum
{ Equal, LessThan, GreaterThan, LessEqual, GreaterEqual, NotEqual }

Constructors and destructor

Public member functions

virtual void
(
  • bool reset
)

Checks the operation for execution.

double
void
(
  • double constant
)
void

Protected member functions

virtual void

Executes one round of processing.

Property details

  • double constant

    [read, write]

    A constant value that is used instead of input1 if it is not connected.

  • Function function

    [read, write]

    The comparison function.

Enumeration details

  • enum Function

    • Equal - left == right

    • LessThan - left < right

    • GreaterThan - left > right

    • LessEqual - left <= right

    • GreaterEqual - left >= right

    • NotEqual - left != right

Function details

  • PiiComparisonOperation

    ()
  • 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.

  • double constant

    ()
  • Function function

    ()
  • void setConstant

    (
    • double constant
    )
  • 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.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.