libtcspc C++ API
Streaming TCSPC and time tag data processing
Loading...
Searching...
No Matches
Statistics processors

Description

Processors for collecting statistics.

Functions

template<typename Event, typename Downstream>
auto tcspc::count (access_tracker< count_accessor > &&tracker, Downstream downstream)
 Create a processor that counts events of a given type.
template<typename NumericTraits = default_numeric_traits, typename Downstream>
auto tcspc::record_abstime_range (access_tracker< record_abstime_range_accessor< typename NumericTraits::abstime_type > > &&tracker, Downstream downstream)
 Create a processor that records the range of abstime observed.
template<typename Event, typename Downstream>
auto tcspc::record_last (access_tracker< record_last_accessor< Event > > &&tracker, Downstream downstream)
 Create a processor that remembers the last event of a given type.

Function Documentation

◆ count()

template<typename Event, typename Downstream>
auto tcspc::count ( access_tracker< count_accessor > && tracker,
Downstream downstream )

Create a processor that counts events of a given type.

The count can be retrieved through a tcspc::count_accessor retrieved from the tcspc::context from which tracker was obtained.

Note that the count is incremented before the events of type Event are sent to the downstream processor. This means that the event will be counted even if it subsequently results in an error or end-of-stream in a downstream processor.

Template Parameters
Eventtype of event to count
Downstreamdownstream processor type (usually deduced)
Parameters
trackeraccess tracker for later access of the count result
downstreamdownstream processor
Returns
processor
Events handled
  • Event: increment the count; pass through
  • All other types: pass through with no action
  • Flush: pass through with no action

◆ record_abstime_range()

template<typename NumericTraits = default_numeric_traits, typename Downstream>
auto tcspc::record_abstime_range ( access_tracker< record_abstime_range_accessor< typename NumericTraits::abstime_type > > && tracker,
Downstream downstream )

Create a processor that records the range of abstime observed.

The processor passes through all events. It examines events that have an abstime field and tracks the minimum and maximum abstime observed. The event's abstime field type must match NumericTraits::abstime_type.

The minimum and maximum can be retrieved through a tcspc::record_abstime_range_accessor retrieved from the tcspc::context from which tracker was obtained. Each is empty (std::nullopt) until an abstime-stamped event has been observed.

Template Parameters
NumericTraitsnumeric traits specifying abstime_type
Downstreamdownstream processor type (usually deduced)
Parameters
trackeraccess tracker for later access of the abstime range result
downstreamdownstream processor
Returns
processor
Events handled
  • All types with abstime field: update running min/max; pass through
  • All other types: pass through with no action
  • Flush: pass through with no action

◆ record_last()

template<typename Event, typename Downstream>
auto tcspc::record_last ( access_tracker< record_last_accessor< Event > > && tracker,
Downstream downstream )

Create a processor that remembers the last event of a given type.

The processor passes through all events. It retains a copy of the last event of type Event that passed through.

The retained event can be retrieved through a tcspc::record_last_accessor obtained from the tcspc::context from which tracker was obtained. It is empty (std::nullopt) until an event of type Event has been observed.

Because the processor stores a copy of every event of the requested type that passes through (and retrieval via the accessor also returns a copy), it is best suited to events that are cheap to copy and that occur infrequently — most naturally a single result event such as a tcspc::concluding_histogram_event.

Template Parameters
Eventthe event type to remember (must be specified explicitly)
Downstreamdownstream processor type (usually deduced)
Parameters
trackeraccess tracker for later access of the recorded event
downstreamdownstream processor
Returns
processor
Events handled
  • Event: retain a copy; pass through
  • All other types: pass through with no action
  • Flush: pass through with no action