Into

Modules

Documentation

classPiiObjectCounter

#include <PiiObjectCounter.h>

Counts received objects.

Inherits PiiDefaultOperation

Description

Inputs

inputany object

Outputs

countthe number of objects received so far.

Properties

bool

If this flag is true, the value of the counter will be reset to zero when the operation is restarted after stopping.

int

The number of objects received.

Constructors and destructor

Public member functions

bool
virtual void
(
  • bool reset
)

Checks the operation for execution.

int
( )
void
(
  • bool autoReset
)
void
(
  • int count
)

Protected member functions

virtual void

Executes one round of processing.

Property details

  • bool autoReset

    [read, write]

    If this flag is true, the value of the counter will be reset to zero when the operation is restarted after stopping.

    If the flag is false, the previous count will be retained. The default value is true.

  • int count

    [read, write]

    The number of objects received.

    If you want zero-based indices instead of object count, set the count to -1 before starting the operation.

Function details

  • PiiObjectCounter

    ()
  • bool autoReset

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

  • int count

    ()
  • void setAutoReset

    (
    • bool autoReset
    )
  • void setCount

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