DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
fddetdataformats
include
fddetdataformats
FrameConcepts.hpp
Go to the documentation of this file.
1
23
24
#ifndef FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_FRAMECONCEPTS_HPP_
25
#define FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_FRAMECONCEPTS_HPP_
26
27
#include "
detdataformats/DAQHeader.hpp
"
28
#include "
detdataformats/DAQEthHeader.hpp
"
29
30
#include <concepts>
31
#include <cstdint>
32
33
namespace
dunedaq::fddetdataformats
{
34
35
36
template
<
typename
T>
37
concept
HasGetADC
= std::is_member_function_pointer_v<
decltype
(&T::get_adc)>;
38
39
template
<
typename
T>
40
concept
HasSetADC
= std::is_member_function_pointer_v<
decltype
(&T::set_adc)>;
41
42
template
<
typename
T>
43
concept
HasDAQHeader
=
44
requires
(
const
T t) {
45
t.daq_header;
46
} &&
47
(
48
std::same_as<decltype(std::declval<T>().daq_header),
dunedaq::detdataformats::DAQEthHeader
> ||
49
std::same_as<
decltype
(std::declval<T>().daq_header),
dunedaq::detdataformats::DAQHeader
>
50
);
51
52
template
<
typename
T>
53
concept
HasFrameHeader
=
54
requires
(
const
T t) {
55
t.header;
56
};
// NOLINT(readability/braces)
57
58
// Instead of std::totally_ordered, this just literally only requires the "<" operator
59
template
<
typename
T>
60
concept
HasLessThan
=
requires
(
const
T a,
const
T b) {
61
{ a < b } -> std::convertible_to<bool>;
62
};
// NOLINT(readability/braces)
63
64
template
<
typename
T>
65
concept
HasNoCompilerPadding
=
66
requires
{
67
// "convertible_to" is used rather than "same_as" because s_expected_bytes is typically constexpr
68
{ T::s_expected_bytes } -> std::convertible_to<std::size_t>;
69
}
70
&&
71
(T::s_expected_bytes ==
sizeof
(T));
72
73
template
<
typename
T>
74
concept
HasGetTimestamp
=
75
requires
(
const
T ct)
76
{
77
{ ct.get_timestamp() } -> std::same_as<uint64_t>;
// NOLINT(build/unsigned)
78
};
79
80
template
<
typename
T>
81
concept
HasSetTimestamp
=
82
requires
(T t, uint64_t ts)
// NOLINT(build/unsigned)
83
{
84
{ t.set_timestamp(ts) } -> std::same_as<void>;
85
};
86
87
// TODO: John Freeman (jcfree@fnal.gov), Jun-17-2026
88
89
// In the next two months, figure out a concept parallel to
90
// AdaptableFrameConcept which can be made specific to the type
91
// adapters in fdreadoutlibs (as opposed to, e.g.,
92
// TriggerPrimitiveTypeAdapter.hpp in trigger). This can include
93
// concepts commented out below like "has an ADC getter", etc.)
94
95
template
<
typename
T>
96
concept
AdaptableFrameConcept
=
97
HasNoCompilerPadding<T>
&&
98
HasLessThan<T>
&&
99
// HasGetADC<T> &&
100
// HasSetADC<T> &&
101
// HasDAQHeader<T> &&
102
// HasFrameHeader<T> &&
103
HasGetTimestamp<T>
&&
104
HasSetTimestamp<T>
&&
105
std::is_standard_layout_v<T> &&
106
std::is_trivially_copyable_v<T>;
107
108
}
// namespace dunedaq::fddetdataformats
109
110
#endif
// FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_FRAMECONCEPTS_HPP_
DAQEthHeader.hpp
DAQHeader.hpp
dunedaq::fddetdataformats::AdaptableFrameConcept
Definition
FrameConcepts.hpp:96
dunedaq::fddetdataformats::HasDAQHeader
Definition
FrameConcepts.hpp:43
dunedaq::fddetdataformats::HasFrameHeader
Definition
FrameConcepts.hpp:53
dunedaq::fddetdataformats::HasGetADC
Definition
FrameConcepts.hpp:37
dunedaq::fddetdataformats::HasGetTimestamp
Definition
FrameConcepts.hpp:74
dunedaq::fddetdataformats::HasLessThan
Definition
FrameConcepts.hpp:60
dunedaq::fddetdataformats::HasNoCompilerPadding
Definition
FrameConcepts.hpp:65
dunedaq::fddetdataformats::HasSetADC
Definition
FrameConcepts.hpp:40
dunedaq::fddetdataformats::HasSetTimestamp
Definition
FrameConcepts.hpp:81
dunedaq::fddetdataformats
Definition
CRTBernFrame.hpp:29
dunedaq::detdataformats::DAQEthHeader
DAQEthHeader is a versioned and unified structure for every FE electronics.
Definition
DAQEthHeader.hpp:23
dunedaq::detdataformats::DAQHeader
DAQHeader is a versioned and unified structure for every FE electronics.
Definition
DAQHeader.hpp:23
Generated on
for DUNE-DAQ by
1.17.0