libtcspc C++ API
Streaming TCSPC and time tag data processing
Loading...
Searching...
No Matches
histogram_events.hpp
1/*
2 * This file is part of libtcspc
3 * Copyright 2019-2026 Board of Regents of the University of Wisconsin System
4 * SPDX-License-Identifier: MIT
5 */
6
7#pragma once
8
9#include "bucket.hpp"
10#include "data_types.hpp"
11
12#include <cstddef>
13#include <ostream>
14
15namespace tcspc {
16
24template <typename DataTypes = default_data_types> struct datapoint_event {
28 using datapoint_type = typename DataTypes::datapoint_type;
29
34
36 friend constexpr auto operator==(datapoint_event const &lhs,
37 datapoint_event const &rhs) noexcept
38 -> bool = default;
39
41 friend auto operator<<(std::ostream &s, datapoint_event const &e)
42 -> std::ostream & {
43 return s << "datapoint(" << e.value << ')';
44 }
45};
46
54template <typename DataTypes = default_data_types> struct bin_increment_event {
58 typename DataTypes::bin_index_type bin_index;
59
61 friend constexpr auto operator==(bin_increment_event const &lhs,
62 bin_increment_event const &rhs) noexcept
63 -> bool = default;
64
66 friend auto operator<<(std::ostream &s, bin_increment_event const &e)
67 -> std::ostream & {
68 return s << "bin_increment(" << e.bin_index << ')';
69 }
70};
71
82template <typename DataTypes = default_data_types>
88
91 bin_increment_cluster_event const &rhs) noexcept
92 -> bool = default;
93
95 friend auto operator<<(std::ostream &s,
97 -> std::ostream & {
98 return s << "bin_increment_cluster(" << e.bin_indices << ')';
99 }
100};
101
112template <typename DataTypes = default_data_types> struct histogram_event {
117
119 friend auto operator==(histogram_event const &lhs,
120 histogram_event const &rhs) noexcept
121 -> bool = default;
122
124 friend auto operator<<(std::ostream &s, histogram_event const &e)
125 -> std::ostream & {
126 return s << "histogram(" << e.data_bucket << ')';
127 }
128};
129
142template <typename DataTypes = default_data_types>
148
151 concluding_histogram_event const &rhs) noexcept
152 -> bool = default;
153
155 friend auto operator<<(std::ostream &s,
157 -> std::ostream & {
158 return s << "concluding_histogram(" << e.data_bucket << ')';
159 }
160};
161
169template <typename DataTypes = default_data_types>
175
177 friend auto operator==(histogram_array_event const &lhs,
178 histogram_array_event const &rhs) noexcept
179 -> bool = default;
180
182 friend auto operator<<(std::ostream &s, histogram_array_event const &e)
183 -> std::ostream & {
184 return s << "histogram_array(" << e.data_bucket << ')';
185 }
186};
187
198template <typename DataTypes = default_data_types>
203 std::size_t valid_size;
204
213
216 histogram_array_progress_event const &rhs) noexcept
217 -> bool = default;
218
220 friend auto operator<<(std::ostream &s,
222 -> std::ostream & {
223 return s << "histogram_array_progress(" << e.valid_size << ", "
224 << e.data_bucket << ')';
225 }
226};
227
241template <typename DataTypes = default_data_types>
247
249 friend auto
251 concluding_histogram_array_event const &rhs) noexcept
252 -> bool = default;
253
255 friend auto operator<<(std::ostream &s,
257 -> std::ostream & {
258 return s << "concluding_histogram_array(" << e.data_bucket << ')';
259 }
260};
261
262} // namespace tcspc
Value-semantic container for array data allowing use of custom storage.
Definition bucket.hpp:110
libtcspc namespace.
Definition acquire.hpp:29
Event representing a cluster of data points binned for histogramming.
Definition histogram_events.hpp:83
friend auto operator<<(std::ostream &s, bin_increment_cluster_event const &e) -> std::ostream &
Stream insertion operator for bin_increment_cluster_event.
Definition histogram_events.hpp:95
bucket< typename DataTypes::bin_index_type > bin_indices
The bin indices for the datapoints in the cluster.
Definition histogram_events.hpp:87
friend auto operator==(bin_increment_cluster_event const &lhs, bin_increment_cluster_event const &rhs) noexcept -> bool=default
Equality comparison operator.
Event representing data binned for histogramming.
Definition histogram_events.hpp:54
friend auto operator<<(std::ostream &s, bin_increment_event const &e) -> std::ostream &
Stream insertion operator.
Definition histogram_events.hpp:66
friend constexpr auto operator==(bin_increment_event const &lhs, bin_increment_event const &rhs) noexcept -> bool=default
Equality comparison operator.
DataTypes::bin_index_type bin_index
The histogram bin index to which the data value was mapped.
Definition histogram_events.hpp:58
Event representing the final result of accumulation of a histogram array.
Definition histogram_events.hpp:242
bucket< typename DataTypes::bin_type > data_bucket
View of the histogram array.
Definition histogram_events.hpp:246
friend auto operator==(concluding_histogram_array_event const &lhs, concluding_histogram_array_event const &rhs) noexcept -> bool=default
Equality comparison operator.
friend auto operator<<(std::ostream &s, concluding_histogram_array_event const &e) -> std::ostream &
Stream insertion operator.
Definition histogram_events.hpp:255
Event representing the final result of histogramming.
Definition histogram_events.hpp:143
friend auto operator<<(std::ostream &s, concluding_histogram_event const &e) -> std::ostream &
Stream insertion operator.
Definition histogram_events.hpp:155
bucket< typename DataTypes::bin_type > data_bucket
The accumulated histogram.
Definition histogram_events.hpp:147
friend auto operator==(concluding_histogram_event const &lhs, concluding_histogram_event const &rhs) noexcept -> bool=default
Equality comparison operator.
Event representing a datapoint for histogramming.
Definition histogram_events.hpp:24
friend auto operator<<(std::ostream &s, datapoint_event const &e) -> std::ostream &
Stream insertion operator.
Definition histogram_events.hpp:41
friend constexpr auto operator==(datapoint_event const &lhs, datapoint_event const &rhs) noexcept -> bool=default
Equality comparison operator.
typename DataTypes::datapoint_type datapoint_type
The data type.
Definition histogram_events.hpp:28
datapoint_type value
The datapoint value.
Definition histogram_events.hpp:33
Event representing an array of histograms.
Definition histogram_events.hpp:170
friend auto operator==(histogram_array_event const &lhs, histogram_array_event const &rhs) noexcept -> bool=default
Equality comparison operator.
bucket< typename DataTypes::bin_type > data_bucket
Histogram array, or view thereof.
Definition histogram_events.hpp:174
friend auto operator<<(std::ostream &s, histogram_array_event const &e) -> std::ostream &
Stream insertion operator.
Definition histogram_events.hpp:182
Event representing a progress update of a histogram array.
Definition histogram_events.hpp:199
bucket< typename DataTypes::bin_type > data_bucket
View of the histogram array.
Definition histogram_events.hpp:212
friend auto operator<<(std::ostream &s, histogram_array_progress_event const &e) -> std::ostream &
Stream insertion operator.
Definition histogram_events.hpp:220
std::size_t valid_size
Size of the updated part of the histogram array.
Definition histogram_events.hpp:203
friend auto operator==(histogram_array_progress_event const &lhs, histogram_array_progress_event const &rhs) noexcept -> bool=default
Equality comparison operator.
Event representing a single histogram.
Definition histogram_events.hpp:112
friend auto operator==(histogram_event const &lhs, histogram_event const &rhs) noexcept -> bool=default
Equality comparison operator.
friend auto operator<<(std::ostream &s, histogram_event const &e) -> std::ostream &
Stream insertion operator.
Definition histogram_events.hpp:124
bucket< typename DataTypes::bin_type > data_bucket
The histogram.
Definition histogram_events.hpp:116