Into

Modules

Documentation

classPiiDebugOperation

#include <PiiDebugOperation.h>

An operation that prints all objects passing through it to the debug console.

Inherits PiiDefaultOperation

Description

It is useful in debugging connections.

Inputs

inputany object
outputthe object read from input

Properties

Output format.

Where to write the debug output? The default is StdOut.

bool

Enables/disables printing of control objects.

Public types

enum
{ StdOut, StdErr, Debug }

Output streams.

Constructors and destructor

Public member functions

virtual void
(
  • bool reset
)

Checks the operation for execution.

Protected member functions

virtual PiiFlowController *

Creates a flow controller for this operation.

( )
virtual void

Executes one round of processing.

void
( )
void
( )
void
(
  • bool showControlObjects
)
bool

Property details

  • QString format

    [read, write]

    Output format.

    The format may contain one or more variables. Recognized variables are:

    • $count - the number of objects received since reset

    • $type - the type ID of the object in hexadecimal

    • $objectName - the objectName of the operation

    • $value - the value of the object. The operation recognizes primitive types, strings and matrices.

    • $symbol - a one-character symbol for the object. Normal, processable objects are denoted with a dot (.), and synchronization primitives with the following symbols: < = start, > = end, S = stop, P = pause, R = resume.

    The default format is "$objectName: 0x$type received ($count since reset) ".
  • OutputStream outputStream

    [read, write]

    Where to write the debug output? The default is StdOut.

  • bool showControlObjects

    [read, write]

    Enables/disables printing of control objects.

    The default is false.

Enumeration details

  • enum OutputStream

    Output streams.

    • StdOut - standard output

    • StdErr - standard error

    • Debug - piiDebug() output. Note that in this mode newlines will be automatically appended and you may need to change format accordingly.

Function details

  • PiiDebugOperation

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

  • virtual PiiFlowController * createFlowController

    ()
    [protected, virtual]

    Creates a flow controller for this operation.

    This function is called by the default implementation of check(). A new flow controller will be always be created when the check() function is called. The old controller will be deleted.

    The default implementation tries to find an optimal flow controller for the active input configuration:

    • If there are no connected inputs, a null pointer will be returned.

    • If the operation has only one connected input, PiiOneInputFlowController will be used.

    • If there are many inputs, but all are in the same group, PiiOneGroupFlowController will be used.

    • Otherwise, PiiDefaultFlowController will be used. The flow controller will be configured with loose parent-child relationships between groups with a non-negative group id and at least one connected socket. The relationships will be assigned in the order of increasing magnitude. For example, if there are sockets in groups 0, 1, and -1, 0 will be set as the (loose) parent of 1. Group -1 will be independent of the others.

    Subclasses may override the default behavior by installing a custom flow controller. You need to do this if your operation has, for example, sibling groups that share a common parent group, or if you need to assign strict relationships between input groups. If you override this function, make sure the flow controller takes the control of all connected inputs.
    Returns

    a pointer to a flow controller. PiiDefaultOperation will take the ownership of the pointer. If you don't want inputs to be controlled, return 0.

    See also

    Reimplemented from PiiDefaultOperation.

  • QString format

    ()
    [protected]
  • OutputStream outputStream

    ()
    [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 setFormat

    ( )
    [protected]
  • void setOutputStream

    ( )
    [protected]
  • void setShowControlObjects

    (
    • bool showControlObjects
    )
    [protected]
  • bool showControlObjects

    ()
    [protected]
Notes (0)

Add a note

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