libtcspc.VariantEvent¶
- final class libtcspc.VariantEvent(*event_types)[source]¶
Bases:
EventTypeEvent 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.
Multiplexwraps the listed event types into aVariantEvent;Demultiplexunwraps 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
MultiplexandDemultiplexpreserve it.
Notes
The corresponding C++ event is
tcspc::variant_event<tcspc::type_list<...>>.A
VariantEventis a type tag only: it cannot be constructed as a value (novalue()) and cannot be delivered to a Python sink. To inspect the carried events from Python, restore the individual event types withDemultiplexfirst.See also
- tcspc::variant_event
The underlying C++ event type.
MultiplexWrap the listed event types into a
VariantEvent.DemultiplexRestore the individual event types from a
VariantEvent.