libtcspc.VariantEvent

final class libtcspc.VariantEvent(*event_types)[source]

Bases: EventType

Event holding one of several event types, as a variant (tagged union).

This is an advanced event type, used to carry events of more than one type through a stage that handles only a single type — most importantly to buffer a heterogeneous stream. Multiplex wraps the listed event types into a VariantEvent; Demultiplex unwraps them again.

Parameters:

*event_types (EventType) – The member event types of the variant. At least one is required. The order is significant: it is part of the type, and Multiplex and Demultiplex preserve it.

Notes

The corresponding C++ event is tcspc::variant_event<tcspc::type_list<...>>.

A VariantEvent is a type tag only: it cannot be constructed as a value (no value()) and cannot be delivered to a Python sink. To inspect the carried events from Python, restore the individual event types with Demultiplex first.

See also

tcspc::variant_event

The underlying C++ event type.

Multiplex

Wrap the listed event types into a VariantEvent.

Demultiplex

Restore the individual event types from a VariantEvent.