libtcspc.CountDownTo¶
- final class libtcspc.CountDownTo(tick_event_type, fire_event_type, reset_event_type, threshold, limit, initial_count, *, fire_after_tick=False)[source]¶
Bases:
NodeProcessor that counts down on a tick event and fires when a threshold is reached.
The mirror of
CountUpTo. The internal counter starts atinitial_countand is decremented each time aTickEventis received.limitmust be less thaninitial_count. SeeCountUpTofor full semantics.- Parameters:
tick_event_type (EventType) – Event type that increments (here, decrements) the counter.
fire_event_type (EventType) – Event type to emit when the count reaches
threshold. Must be brace-initializable with anabstime.reset_event_type (EventType) – Event type that resets the counter to
initial_count.threshold (int or Param[int]) – Count value at which
FireEventis emitted.limit (int or Param[int]) – Count value at which the counter is reset to
initial_count. Must be less thaninitial_count.initial_count (int or Param[int]) – Starting and reset value of the counter.
fire_after_tick (bool) – If
True, the fire event is emitted after the tick event is passed through (after the count is decremented); otherwise it is emitted before. Defaults toFalse.
Notes
Events handled:
tick_event_type: pass through and decrement; emitfire_event_type(before or after, perfire_after_tick) on threshold; reset on limit.reset_event_type: reset counter; pass through.All other event types: pass through unchanged.
End of input: pass through.
See also
- tcspc::count_down_to()
The underlying C++ factory function.
CountUpToThe counterpart that counts up to a threshold.