libtcspc C++ API
Streaming TCSPC and time tag data processing
Loading...
Searching...
No Matches
time_tagged_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 "numeric_traits.hpp"
10
11#include <array>
12#include <ostream>
13#include <type_traits>
14
15namespace tcspc {
16
41template <typename NumericTraits = default_numeric_traits>
44 NumericTraits::abstime_type abstime;
45 static_assert(std::is_integral_v<decltype(abstime)>);
46
48 friend auto operator==(time_reached_event const &lhs,
49 time_reached_event const &rhs) noexcept
50 -> bool = default;
51
53 friend auto operator<<(std::ostream &s, time_reached_event const &e)
54 -> std::ostream & {
55 return s << "time_reached(" << e.abstime << ')';
56 }
57};
58
77template <typename NumericTraits = default_numeric_traits>
80 NumericTraits::abstime_type abstime;
81 static_assert(std::is_integral_v<decltype(abstime)>);
82
84 friend auto operator==(data_lost_event const &lhs,
85 data_lost_event const &rhs) noexcept
86 -> bool = default;
87
89 friend auto operator<<(std::ostream &s, data_lost_event const &e)
90 -> std::ostream & {
91 return s << "data_lost(" << e.abstime << ')';
92 }
93};
94
111template <typename NumericTraits = default_numeric_traits>
114 NumericTraits::abstime_type abstime;
115 static_assert(std::is_integral_v<decltype(abstime)>);
116
118 friend auto operator==(begin_lost_interval_event const &lhs,
119 begin_lost_interval_event const &rhs) noexcept
120 -> bool = default;
121
123 friend auto operator<<(std::ostream &s, begin_lost_interval_event const &e)
124 -> std::ostream & {
125 (void)e;
126 return s << "begin_lost_interval()";
127 }
128};
129
137template <typename NumericTraits = default_numeric_traits>
140 NumericTraits::abstime_type abstime;
141 static_assert(std::is_integral_v<decltype(abstime)>);
142
144 friend auto operator==(end_lost_interval_event const &lhs,
145 end_lost_interval_event const &rhs) noexcept
146 -> bool = default;
147
149 friend auto operator<<(std::ostream &s, end_lost_interval_event const &e)
150 -> std::ostream & {
151 (void)e;
152 return s << "end_lost_interval()";
153 }
154};
155
167template <typename NumericTraits = default_numeric_traits>
170 NumericTraits::abstime_type abstime;
171 static_assert(std::is_integral_v<decltype(abstime)>);
172
174 NumericTraits::channel_type channel;
175 static_assert(std::is_integral_v<decltype(channel)>);
176
180 NumericTraits::count_type count;
181 static_assert(std::is_integral_v<decltype(count)>);
182
184 friend auto operator==(lost_counts_event const &lhs,
185 lost_counts_event const &rhs) noexcept
186 -> bool = default;
187
189 friend auto operator<<(std::ostream &s, lost_counts_event const &e)
190 -> std::ostream & {
191 return s << "lost_counts(" << e.abstime << ", " << e.channel << ", "
192 << e.count << ')';
193 }
194};
195
208template <typename NumericTraits = default_numeric_traits>
211 NumericTraits::abstime_type abstime;
212 static_assert(std::is_integral_v<decltype(abstime)>);
213
215 NumericTraits::channel_type channel;
216 static_assert(std::is_integral_v<decltype(channel)>);
217
219 NumericTraits::count_type count;
220 static_assert(std::is_integral_v<decltype(count)>);
221
223 friend auto operator==(bulk_counts_event const &lhs,
224 bulk_counts_event const &rhs) noexcept
225 -> bool = default;
226
228 friend auto operator<<(std::ostream &s, bulk_counts_event const &e)
229 -> std::ostream & {
230 return s << "bulk_counts(" << e.abstime << ", " << e.channel << ", "
231 << e.count << ')';
232 }
233};
234
243template <typename NumericTraits = default_numeric_traits>
246 NumericTraits::abstime_type abstime;
247 static_assert(std::is_integral_v<decltype(abstime)>);
248
250 NumericTraits::channel_type channel;
251 static_assert(std::is_integral_v<decltype(channel)>);
252
254 friend auto operator==(detection_event const &lhs,
255 detection_event const &rhs) noexcept
256 -> bool = default;
257
259 friend auto operator<<(std::ostream &s, detection_event const &e)
260 -> std::ostream & {
261 return s << "detection(" << e.abstime << ", " << e.channel << ')';
262 }
263};
264
274template <typename NumericTraits = default_numeric_traits>
277 NumericTraits::abstime_type abstime;
278 static_assert(std::is_integral_v<decltype(abstime)>);
279
281 NumericTraits::channel_type channel;
282 static_assert(std::is_integral_v<decltype(channel)>);
283
288 NumericTraits::difftime_type difftime;
289 static_assert(std::is_integral_v<decltype(difftime)>);
290
293 time_correlated_detection_event const &rhs) noexcept
294 -> bool = default;
295
297 friend auto operator<<(std::ostream &s,
299 -> std::ostream & {
300 return s << "time_correlated_detection(" << e.abstime << ", "
301 << e.channel << ", " << e.difftime << ')';
302 }
303};
304
329template <typename NumericTraits = default_numeric_traits>
332 NumericTraits::abstime_type abstime;
333 static_assert(std::is_integral_v<decltype(abstime)>);
334
336 NumericTraits::channel_type channel;
337 static_assert(std::is_integral_v<decltype(channel)>);
338
340 friend auto operator==(marker_event const &lhs,
341 marker_event const &rhs) noexcept -> bool = default;
342
344 friend auto operator<<(std::ostream &s, marker_event const &e)
345 -> std::ostream & {
346 return s << "marker(" << e.abstime << ", " << e.channel << ')';
347 }
348};
349
358template <typename NumericTraits>
359auto operator<<(std::ostream &s,
360 std::array<detection_event<NumericTraits>, 2> const &e)
361 -> std::ostream & {
362 return s << "[" << e[0] << ", " << e[1] << ']';
363}
364
365} // namespace tcspc
libtcspc namespace.
Definition acquire.hpp:30
Event indicating beginning of interval in which counts were lost.
Definition time_tagged_events.hpp:112
NumericTraits::abstime_type abstime
The absolute time (a.k.a. macrotime) of this event.
Definition time_tagged_events.hpp:114
friend auto operator<<(std::ostream &s, begin_lost_interval_event const &e) -> std::ostream &
Stream insertion operator.
Definition time_tagged_events.hpp:123
friend auto operator==(begin_lost_interval_event const &lhs, begin_lost_interval_event const &rhs) noexcept -> bool=default
Equality comparison operator.
Event indicating number of detections from a non-time-tagging device.
Definition time_tagged_events.hpp:209
NumericTraits::abstime_type abstime
The absolute time (a.k.a. macrotime) of this event.
Definition time_tagged_events.hpp:211
NumericTraits::count_type count
Number of non-time-tagged counts detected.
Definition time_tagged_events.hpp:219
NumericTraits::channel_type channel
The channel on which this event occurred.
Definition time_tagged_events.hpp:215
friend auto operator==(bulk_counts_event const &lhs, bulk_counts_event const &rhs) noexcept -> bool=default
Equality comparison operator.
friend auto operator<<(std::ostream &s, bulk_counts_event const &e) -> std::ostream &
Stream insertion operator.
Definition time_tagged_events.hpp:228
Event indicating loss of data due to buffer overflow.
Definition time_tagged_events.hpp:78
NumericTraits::abstime_type abstime
The absolute time (a.k.a. macrotime) of this event.
Definition time_tagged_events.hpp:80
friend auto operator==(data_lost_event const &lhs, data_lost_event const &rhs) noexcept -> bool=default
Equality comparison operator.
friend auto operator<<(std::ostream &s, data_lost_event const &e) -> std::ostream &
Stream insertion operator.
Definition time_tagged_events.hpp:89
Event indicating a detected count.
Definition time_tagged_events.hpp:244
friend auto operator==(detection_event const &lhs, detection_event const &rhs) noexcept -> bool=default
Equality comparison operator.
NumericTraits::channel_type channel
The channel on which this event occurred.
Definition time_tagged_events.hpp:250
NumericTraits::abstime_type abstime
The absolute time (a.k.a. macrotime) of this event.
Definition time_tagged_events.hpp:246
friend auto operator<<(std::ostream &s, detection_event const &e) -> std::ostream &
Stream insertion operator.
Definition time_tagged_events.hpp:259
Event indicating end of interval in which counts were lost.
Definition time_tagged_events.hpp:138
friend auto operator<<(std::ostream &s, end_lost_interval_event const &e) -> std::ostream &
Stream insertion operator.
Definition time_tagged_events.hpp:149
NumericTraits::abstime_type abstime
The absolute time (a.k.a. macrotime) of this event.
Definition time_tagged_events.hpp:140
friend auto operator==(end_lost_interval_event const &lhs, end_lost_interval_event const &rhs) noexcept -> bool=default
Equality comparison operator.
Event indicating number of counts that could not be time-tagged.
Definition time_tagged_events.hpp:168
NumericTraits::abstime_type abstime
The absolute time (a.k.a. macrotime) of this event.
Definition time_tagged_events.hpp:170
NumericTraits::count_type count
Number of counts that were detected but could not be time-tagged.
Definition time_tagged_events.hpp:180
friend auto operator<<(std::ostream &s, lost_counts_event const &e) -> std::ostream &
Stream insertion operator.
Definition time_tagged_events.hpp:189
friend auto operator==(lost_counts_event const &lhs, lost_counts_event const &rhs) noexcept -> bool=default
Equality comparison operator.
NumericTraits::channel_type channel
The channel on which this event occurred.
Definition time_tagged_events.hpp:174
Event indicating a timing marker.
Definition time_tagged_events.hpp:330
friend auto operator==(marker_event const &lhs, marker_event const &rhs) noexcept -> bool=default
Equality comparison operator.
NumericTraits::channel_type channel
The channel on which this event occurred.
Definition time_tagged_events.hpp:336
NumericTraits::abstime_type abstime
The absolute time (a.k.a. macrotime) of this event.
Definition time_tagged_events.hpp:332
friend auto operator<<(std::ostream &s, marker_event const &e) -> std::ostream &
Stream insertion operator.
Definition time_tagged_events.hpp:344
Event indicating a detected count (typically photon) with difference time.
Definition time_tagged_events.hpp:275
NumericTraits::channel_type channel
The channel on which this event occurred.
Definition time_tagged_events.hpp:281
NumericTraits::abstime_type abstime
The absolute time (a.k.a. macrotime) of this event.
Definition time_tagged_events.hpp:277
friend auto operator<<(std::ostream &s, time_correlated_detection_event const &e) -> std::ostream &
Stream insertion operator.
Definition time_tagged_events.hpp:297
friend auto operator==(time_correlated_detection_event const &lhs, time_correlated_detection_event const &rhs) noexcept -> bool=default
Equality comparison operator.
NumericTraits::difftime_type difftime
Difference time (a.k.a. microtime, nanotime) associated with the detected event.
Definition time_tagged_events.hpp:288
Event indicating latest abstime reached.
Definition time_tagged_events.hpp:42
NumericTraits::abstime_type abstime
The absolute time (a.k.a. macrotime) of this event.
Definition time_tagged_events.hpp:44
friend auto operator<<(std::ostream &s, time_reached_event const &e) -> std::ostream &
Stream insertion operator.
Definition time_tagged_events.hpp:53
friend auto operator==(time_reached_event const &lhs, time_reached_event const &rhs) noexcept -> bool=default
Equality comparison operator.