libtcspc.MergeN¶
- final class libtcspc.MergeN(inputs, *event_types, max_buffered=65536, numeric_traits=None)[source]¶
Bases:
NodeMerges N sorted input streams into one, ordered by
abstime.Events arriving on the inputs are buffered and emitted in non-decreasing
abstimeorder. UnlikeMerge, the relative order of events with equalabstimeis not guaranteed.- Parameters:
inputs (int or Sequence[str]) – The input ports. An integer
NcreatesNports named"input-0"through"input-(N-1)". A sequence of names creates ports with those exact names. Must specify at least two inputs.*event_types (EventType) – The event types to merge. Every event handled must carry an
abstimemember; 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 another 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) usesNumericTraitsdefaults.
Notes
All inputs must be fed internally (for example by a
RouteorBroadcastthat fans out a single external input); a merge cannot serve as the executable graph’s external input.All inputs must be driven on the same thread (the underlying C++
merge_nshares unsynchronized state across its input ports). This is enforced when the graph is compiled: a merge fed from two threads — for example with aBufferon only one branch — is rejected.Events handled:
Events matching one of
event_types: buffered and emitted in non-decreasingabstimeorder.Events not in
event_types: rejected at graph build time.End of input: flushes any buffered events, then propagates.
See also
- tcspc::merge_n()
The underlying C++ factory function.
Merge2-way sorted merge that guarantees
input-0precedesinput-1on equalabstime.MergeNUnsortedN-way pass-through merge that does no sorting or buffering.