libtcspc.UnbatchFromBytes

final class libtcspc.UnbatchFromBytes(event_type)[source]

Bases: Node

Processor that emits typed events one-at-a-time from batches of bytes.

Input is a BucketEvent of bytes. The incoming bytes are interpreted as a contiguous stream of event_type and emitted individually (after copying for alignment if needed). Trailing bytes that do not form a whole event_type are buffered and combined with subsequent input.

Parameters:

event_type (EventType) – Element type emitted. Must be a trivially-typed event.

Notes

Events handled:

  • BucketEvent of byte event type: each contained event is emitted one at a time.

  • All other event types: rejected at graph build time.

  • End of input: pass through. Raises an exception if any unconsumed bytes remain.

See also

tcspc::unbatch_from_bytes()

The underlying C++ factory function.

BatchFromBytes

The inverse: copy batches of bytes into batches of typed events.