Skip to content
Nicholas Corgan edited this page Jul 28, 2020 · 22 revisions

Pothos Blocks Toolkit

The Pothos blocks toolkit is a component of the Pothos data-flow framework. The toolkit contains general blocks used for testing and demonstrative purposes.

Blocks table of contents

Event

Event blocks provide utilities to interface with the the signal and slots system.

  • Message to signal - convert an input message to a signal provider.
  • Slot to message - convert a slot acceptor into a message producer.
  • Periodic trigger - generate a well-timed signal event.
  • Evaluator - evaluates an expression, input from slots, output signal

File

The binary file blocks create an interface between a stream and a file resource.

  • Binary file sink - write an input data stream to a file.
  • Binary file source - read a file into an output stream.

Network

Network blocks are automatically inserted into the topology when blocks cross process and host boundaries. The network blocks support flow control, binary streams, as well as serializing arbitrary messages.

  • Network sink - send a stream over a network socket.
  • Network source - recv a stream from a network socket.

Packet

The packet blocks provide a conversion between packet objects and label-annotated streams.

  • Packet to stream - convert packet messages to a byte stream with labels
  • Stream to packet - convert a byte stream with labels to packet messages

Serialize

The serialize blocks can transform an aribitrary stream containing messages and buffers into an mVRL stream and back. The mVRL encoding allows arbitrary stream data to be passed through mediums like network sockets and files and recovered -- even in the event of data loss.

  • Serializer - convert an input stream of messages and buffers into a mVRL stream.
  • Deserializer - convert an mVRL stream into a stream of messages and buffers.

Stream

The stream blocks are misc blocks that operate on continuous streams of elements.

  • Clamp - constrain all elements between provided lower and higher bounds
  • Converter - convert input element stream to specified output type
  • Copier - copy input buffers to output buffers -- used for domain crossing.
  • Deinterleaver - deinterleave a stream into N channels
  • Delay - introduce runtime-configurable delay into a stream of elements.
  • Dynamic Router - passively forward inputs to outputs based on a configurable mapping.
  • Gateway - passively forward input to output, drop input, or backup.
  • Interleaver - interleave N channels into a single stream
  • Is Finite? - for each input, outputs 0 or 1, corresponding to if the element is finite
  • Is NaN? - for each input, outputs 0 or 1, corresponding to if the element is NaN
  • Is Negative? - for each input, outputs 0 or 1, corresponding to if the element is negative
  • Is Normal? - for each input, outputs 0 or 1, corresponding to if the element is normal
  • Min/Max - for N channels, outputs 2 channels with the min and max per element
  • Mute - when a "mute" parameter is set, output zeros rather than forwarding the stream
  • Pacer - pace the flow rate of a stream of elements or messages.
  • Relabeler - copied labels from one stream and applies it to another
  • Repeat - repeat each element N times in the output stream

Testers

The test blocks are used for unit testing, by allowing the user to feed an input stream with arbitrary data via funtion calls on the feeder source; and by allowing the user to read back the data collected from the collector sink. The data from the collector sink can be compared to the expected result in a unit test. Also, the feeder source can generate pseudorandom test plans that can be validated by the collector sink; thus automating the generation and validation steps in some test cases.

  • Abort - test PothosFlow's handling of a topology crash
  • Feeder source - feed arbitrary data into an output stream.
  • Collector sink - collect arbitrary data from an input stream.
  • Constant source - set all outputs to a given constant value
  • Black Hole - consumes all input data -- for testing purposes.
  • Finite release - stop forwarding after specified number of elements
  • Vector source - repeat a user specified numeric array for testing
  • Infinite source - infinite supply of objects for performance testing
  • Sporadic dropper - randomly drop objects for redundancy testing
  • Sporadic labeler - apply random labels to a stream for label testing
  • Sporadic NaN - set random elements to NaN to test handling in downstream blocks
  • Sporadic Infinities - set random elements to Infinity to test handling in downstream blocks