DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
TimeSliceHeader.hpp
Go to the documentation of this file.
1
9#ifndef DAQDATAFORMATS_INCLUDE_DAQDATAFORMATS_TIMESLICEHEADER_HPP_
10#define DAQDATAFORMATS_INCLUDE_DAQDATAFORMATS_TIMESLICEHEADER_HPP_
11
15
16#include <cstddef>
17#include <limits>
18#include <ostream>
19#include <string>
20#include <vector>
21
23
28{
32 static constexpr uint32_t s_timeslice_header_marker = 0x55556666; // NOLINT(build/unsigned)
33
37 static constexpr uint32_t s_timeslice_header_version = 2; // NOLINT(build/unsigned)
38
42 uint32_t timeslice_header_marker = s_timeslice_header_marker; // NOLINT(build/unsigned)
43
47 uint32_t version = s_timeslice_header_version; // NOLINT(build/unsigned)
48
53
58
62 uint32_t unused{ 0xFFFFFFFF }; // NOLINT(build/unsigned)
63
65};
66static_assert(sizeof(TimeSliceHeader) == 32, "TimeSliceHeader struct size different than expected!");
67static_assert(offsetof(TimeSliceHeader, timeslice_header_marker) == 0,
68 "TimeSliceHeader timeslice_header_marker field not at expected offset!");
69static_assert(offsetof(TimeSliceHeader, version) == 4, "TimeSliceHeader version field not at expected offset!");
70static_assert(offsetof(TimeSliceHeader, timeslice_number) == 8,
71 "TimeSliceHeader timeslice_number field not at expected offset!");
72static_assert(offsetof(TimeSliceHeader, run_number) == 16, "TimeSliceHeader run_number field not at expected offset!");
73static_assert(offsetof(TimeSliceHeader, unused) == 20, "TimeSliceHeader unused field not at expected offset!");
74static_assert(offsetof(TimeSliceHeader, element_id) == 24, "TimeSliceHeader source_id field not at expected offset!");
75
82inline std::ostream&
83operator<<(std::ostream& o, TimeSliceHeader const& hdr)
84{
85 return o << "check_word: " << std::hex << hdr.timeslice_header_marker << std::dec << ", "
86 << "version: " << hdr.version << ", "
87
88 << "timeslice_number: " << hdr.timeslice_number << ", "
89 << "run_number: " << hdr.run_number << ", "
90 << "element_id: { " << hdr.element_id << " }";
91}
92
99inline std::istream&
100operator>>(std::istream& o, TimeSliceHeader& hdr)
101{
102 std::string tmp;
103 return o >> tmp >> std::hex >> hdr.timeslice_header_marker >> std::dec >> tmp >> tmp >> hdr.version >> tmp >> tmp >>
104 hdr.timeslice_number >> tmp >> tmp >> hdr.run_number >> tmp >> tmp >> tmp >> hdr.element_id;
105}
106
107} // namespace dunedaq::daqdataformats
108
109#endif // DAQDATAFORMATS_INCLUDE_DAQDATAFORMATS_TIMESLICEHEADER_HPP_
static constexpr timeslice_number_t s_invalid_timeslice_number
An invalid timeslice number.
Definition Types.hpp:73
static constexpr run_number_t s_invalid_run_number
An invalid run number.
Definition Types.hpp:57
uint32_t run_number_t
Type used to represent run number.
Definition Types.hpp:20
std::ostream & operator<<(std::ostream &o, ComponentRequest const &cr)
Write out a ComponentRequest in human-readable form.
std::istream & operator>>(std::istream &is, ComponentRequest &cr)
Read a ComponentRequest from a string stream.
uint64_t timeslice_number_t
Type used to represent timeslice number.
Definition Types.hpp:49
SourceID is a generalized representation of the source of a piece of data in the DAQ....
Definition SourceID.hpp:32
Additional data fields associated with a TimeSliceHeader.
uint32_t unused
Padding to ensure 64-bit alignment.
static constexpr uint32_t s_timeslice_header_marker
Marker bytes to identify a TimeSliceHeader entry in a raw data stream.
run_number_t run_number
Run Number for the TimeSlice.
uint32_t version
Version of the TimeSliceHeader structure.
uint32_t timeslice_header_marker
Marker bytes used to identify a TimeSliceHeader struct in a raw data stream.
static constexpr uint32_t s_timeslice_header_version
The current version of the TimeSliceHeader.
timeslice_number_t timeslice_number
Slice number of this TimeSlice within the stream.