libtcspc.Merge

final class libtcspc.Merge(*event_types, max_buffered=65536, numeric_traits=None)[source]

Bases: Node

Merges two sorted input streams into one, ordered by abstime.

Events arriving on the two inputs are buffered and emitted in non-decreasing abstime order. For events with equal abstime, those from input-0 are emitted before those from input-1 (a guaranteed tie-breaking order).

Parameters:
  • *event_types (EventType) – The event types to merge. Every event handled must carry an abstime member; the merge buffers and sorts by it.

  • max_buffered (int or Param[int]) – The maximum number of events to buffer from a single input before the other input must produce an event. Default: 65536.

  • numeric_traits (NumericTraits or None) – Set of integer types parameterising the merge (in particular the abstime_type). None (the default) uses NumericTraits defaults.

Notes

The node has two input ports, "input-0" and "input-1", and a single output port. Both inputs must be fed internally (for example by a Route or Broadcast that fans out a single external input); a merge cannot serve as the executable graph’s external input.

Both inputs must be driven on the same thread (the underlying C++ merge shares unsynchronized state across its input ports). This is enforced when the graph is compiled: a merge fed from two threads — for example with a Buffer on only one branch — is rejected.

Events handled:

  • Events matching one of event_types: buffered and emitted in non-decreasing abstime order.

  • Events not in event_types: rejected at graph build time.

  • End of input: flushes any buffered events, then propagates.

See also

tcspc::merge()

The underlying C++ factory function.

MergeN

N-way sorted merge without the equal-abstime tie-breaking guarantee.

MergeNUnsorted

N-way pass-through merge that does no sorting or buffering.