libtcspc.CountUpTo¶
- final class libtcspc.CountUpTo(tick_event_type, fire_event_type, reset_event_type, threshold, limit, initial_count, *, fire_after_tick=False)[source]¶
Bases:
NodeProcessor that counts up on a tick event and fires when a threshold is reached.
The internal counter starts at
initial_countand is incremented each time aTickEventis received and passed through. When the counter equalsthreshold,fire_event_typeis emitted (just before or just after the tick, controlled byfire_after_tick) with itsabstimeset to that of the triggering tick. When the counter equalslimit, it is reset toinitial_count. AResetEventresets the counter explicitly.- Parameters:
tick_event_type (EventType) – Event type that increments the counter. Must have an
abstimefield.fire_event_type (EventType) – Event type to emit on threshold. Must be brace-initializable with an
abstime.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 greater 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 incremented); otherwise it is emitted before. Defaults toFalse.
Notes
Events handled:
tick_event_type: pass through and increment; 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_up_to()
The underlying C++ factory function.
CountDownToThe counterpart that counts down to a threshold.