libtcspc.Route

final class libtcspc.Route(*routed_event_types, broadcast_event_types=(), router, outputs)[source]

Bases: Node

Routes events to one of several downstreams via a Router, broadcasting the rest.

Each routed event is delivered to the single downstream selected by the router (or discarded if the router selects no output). Each broadcast event is delivered to every downstream. End-of-input is propagated to every downstream.

Parameters:
  • *routed_event_types (EventType) – The event types to route. The router selects which output each such event is sent to.

  • broadcast_event_types (Sequence[EventType], keyword-only) – The event types to broadcast to every downstream. Must not overlap with the routed event types. Default: empty.

  • router (Router, keyword-only) – The router that maps each routed event to an output-port index.

  • outputs (int or Sequence[str], keyword-only) – The output ports. An integer N creates N ports named "output-0" through "output-(N-1)". A sequence of names creates ports with those exact names. Must specify at least one output.

Notes

Events handled:

  • Events matching one of routed_event_types: routed to one downstream.

  • Events matching one of broadcast_event_types: broadcast to every downstream.

  • Other events: rejected at graph build time.

  • End of input: broadcast to every downstream.

See also

tcspc::route()

The underlying C++ factory function.

Broadcast

Sends every event to every downstream.