DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ComponentRequest.hpp
Go to the documentation of this file.
1
9#ifndef DAQDATAFORMATS_INCLUDE_DAQDATAFORMATS_COMPONENTREQUEST_HPP_
10#define DAQDATAFORMATS_INCLUDE_DAQDATAFORMATS_COMPONENTREQUEST_HPP_
11
14
15#include <cstddef>
16#include <iostream>
17#include <ostream>
18#include <string>
19
21
26{
30 static constexpr uint32_t s_component_request_version = 2; // NOLINT(build/unsigned)
31
35 uint32_t version{ s_component_request_version }; // NOLINT(build/unsigned)
36 uint32_t unused{ 0xFFFFFFFF };
37
39
44
49
50 ComponentRequest() = default;
51 inline ComponentRequest(SourceID const& comp, timestamp_t const& wbegin, timestamp_t const& wend);
52};
53
54 static_assert(ComponentRequest::s_component_request_version == 2, "This is intentionally designed to tell the developer to update the static_assert checks (including this one) when the version is bumped");
55
56static_assert(sizeof(ComponentRequest) == 32, "ComponentRequest struct size different than expected!");
57static_assert(offsetof(ComponentRequest, version) == 0, "ComponentRequest version field not at expected offset");
58static_assert(offsetof(ComponentRequest, unused) == 4, "ComponentRequest unused field not at expected offset");
59static_assert(offsetof(ComponentRequest, component) == 8, "ComponentRequest component field not at expected offset");
60static_assert(offsetof(ComponentRequest, window_begin) == 16,
61 "ComponentRequest window_begin field not at expected offset");
62static_assert(offsetof(ComponentRequest, window_end) == 24, "ComponentRequest window_end field not at expected offset");
63
70inline std::ostream&
71operator<<(std::ostream& o, ComponentRequest const& cr)
72{
73 return o << cr.component << ", begin: " << cr.window_begin << ", end: " << cr.window_end;
74}
75
82inline std::istream&
83operator>>(std::istream& is, ComponentRequest& cr)
84{
85 std::string tmp;
86 return is >> cr.component >> tmp >> tmp >> cr.window_begin >> tmp >> tmp >> cr.window_end;
87}
88
90 : version(s_component_request_version)
91 , component(comp)
92 , window_begin(wbegin)
93 , window_end(wend)
94{}
95} // namespace dunedaq::daqdataformats
96
97#endif // DAQDATAFORMATS_INCLUDE_DAQDATAFORMATS_COMPONENTREQUEST_HPP_
static constexpr timestamp_t s_invalid_timestamp
An invalid timestamp.
Definition Types.hpp:65
uint64_t timestamp_t
Type used to represent DUNE timing system timestamps.
Definition Types.hpp:36
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.
A request sent to a Component, including the SourceID of the component and the window offset and widt...
uint32_t unused
Padding to ensure 64b alignment // NOLINT(build/unsigned)
timestamp_t window_end
End of the data collection window.
static constexpr uint32_t s_component_request_version
The current version of the ComponentRequest.
uint32_t version
The version number of this ComponentRequest.
SourceID component
The Requested Component.
timestamp_t window_begin
Start of the data collection window.
SourceID is a generalized representation of the source of a piece of data in the DAQ....
Definition SourceID.hpp:32