Into

Modules

Documentation

classPiiFrequencyCounter

#include <PiiFrequencyCounter.h>

Limits object rate based on frequency.

Inherits PiiDefaultOperation

Description

This operation can be used to limit the rate of objects to a certain maximum frequency. It works by just passing objects until the maximum rate is exceeded. No objects will be passed until the object rate comes back to an allowable level. The operation can handle any number of synchronized object streams in parallel.

Inputs

inputXany number of input sockets.

Outputs

outputXnumbered outputs corresponding to the inputs.

Classes

class

Properties

int

Number of inputs.

double

Defines the maximum output frequency of the output sockets, which are connected to the corresponding intputs.

double

Defines the frequency, how often the frequency is measured and sent through the frequency ouput.

Constructors and destructor

Public member functions

virtual void
(
  • bool reset
)

Checks the operation for execution.

int
double
double
void
(
  • int dynamicInputCount
)
void
(
  • double frequency
)
void
(
  • double frequency
)
virtual void
( )

Starts the processor.

Protected member functions

virtual void

Executes one round of processing.

Property details

  • int dynamicInputCount

    [read, write]

    Number of inputs.

    When the property is set, new input are created, or extra inputs are removed so that the amount of input sockets matches with the property value. For each input a corresponding output is created, or removed, depending the amount of inputs and outputs before setting the property. It should be taken into account, that there is always frequency output, independent the amount of inputs and other outputs. The default value is one.

  • double maxFrequency

    [read, write]

    Defines the maximum output frequency of the output sockets, which are connected to the corresponding intputs.

    With the zero value no filtering is done, but all incoming objects are let gone through.

  • double measurementFrequency

    [read, write]

    Defines the frequency, how often the frequency is measured and sent through the frequency ouput.

Function details

  • PiiFrequencyCounter

    ()
  • ~PiiFrequencyCounter

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

    ()
  • double maxFrequency

    ()
  • double measurementFrequency

    ()
  • void setDynamicInputCount

    (
    • int dynamicInputCount
    )
  • void setMaxFrequency

    (
    • double frequency
    )
  • void setMeasurementFrequency

    (
    • double frequency
    )
  • virtual void start

    ()
    [virtual]

    Starts the processor.

    If check() has not been called, this function writes out a warning and returns.

    Reimplemented from PiiDefaultOperation.

  • 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 stateChangeOccured

    ()
    [slot]
Notes (0)

Add a note

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