libtcspc C++ API
Streaming TCSPC and time tag data processing
Loading...
Searching...
No Matches
tcspc::linear_bin_mapper< NumericTraits > Class Template Reference

Description

template<typename NumericTraits = default_numeric_traits>
class tcspc::linear_bin_mapper< NumericTraits >

Bin mapper for linear histograms of arbitrary size.

Template Parameters
NumericTraitsnumeric traits specifying datapoint_type and bin_index_type

Public Member Functions

 linear_bin_mapper (arg::offset< typename NumericTraits::datapoint_type > offset, arg::bin_width< typename NumericTraits::datapoint_type > bin_width, arg::max_bin_index< typename NumericTraits::bin_index_type > max_bin_index, arg::clamp< bool > clamp=arg::clamp{false})
 Construct with parameters.
auto n_bins () const -> std::size_t
 Implements bin mapper requirement.
auto operator() (NumericTraits::datapoint_type datapoint) const -> std::optional< typename NumericTraits::bin_index_type >
 Implements bin mapper requirement.

Constructor & Destructor Documentation

◆ linear_bin_mapper()

template<typename NumericTraits = default_numeric_traits>
tcspc::linear_bin_mapper< NumericTraits >::linear_bin_mapper ( arg::offset< typename NumericTraits::datapoint_type > offset,
arg::bin_width< typename NumericTraits::datapoint_type > bin_width,
arg::max_bin_index< typename NumericTraits::bin_index_type > max_bin_index,
arg::clamp< bool > clamp = arg::clamp{false} )
inlineexplicit

Construct with parameters.

max_bin_index must be in the range of bin_index_type.

A negative bin_width value (together with a positive offset value) can be used to flip the histogram, provided that datapoint_type is a signed type with sufficient range.

Parameters
offsetminimum value mapped to the first bin
bin_widthwidth of each bin (in datapoint units); must not be 0
max_bin_indexnumber of bins minus one (must not be negative)
clampif true, include datapoints outside of the mapped range in the first and last bins

The documentation for this class was generated from the following file: