DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
daqethheader.cpp
Go to the documentation of this file.
1
8
10
11#include <pybind11/operators.h>
12#include <pybind11/pybind11.h>
13#include <pybind11/stl.h>
14
15#include <sstream>
16
17namespace py = pybind11;
18
20
21// Quiet the linter about use of unsigned ints in the file
22// NOLINTBEGIN(build/unsigned)
23
24void
26{
27
28 py::class_<DAQEthHeader>(m, "DAQEthHeader", py::buffer_protocol())
29 .def(py::init([](py::capsule capsule) {
30 auto hsfp = *static_cast<DAQEthHeader*>(capsule.get_pointer());
31 return hsfp;
32 }))
33 .def(py::init([](py::bytes bytes) {
34 py::buffer_info info(py::buffer(bytes).request());
35 auto wfp = *static_cast<DAQEthHeader*>(info.ptr);
36 return wfp;
37 }))
38 .def_property(
39 "version",
40 [](DAQEthHeader& self) -> uint32_t { return self.version; },
41 [](DAQEthHeader& self, uint32_t version) { self.version = version; })
42 .def_property(
43 "det_id",
44 [](DAQEthHeader& self) -> uint32_t { return self.det_id; },
45 [](DAQEthHeader& self, uint32_t det_id) { self.det_id = det_id; })
46 .def_property(
47 "crate_id",
48 [](DAQEthHeader& self) -> uint32_t { return self.crate_id; },
49 [](DAQEthHeader& self, uint32_t crate_id) { self.crate_id = crate_id; })
50 .def_property(
51 "slot_id",
52 [](DAQEthHeader& self) -> uint32_t { return self.slot_id; },
53 [](DAQEthHeader& self, uint32_t slot_id) { self.slot_id = slot_id; })
54 .def_property(
55 "stream_id",
56 [](DAQEthHeader& self) -> uint32_t { return self.stream_id; },
57 [](DAQEthHeader& self, uint32_t stream_id) { self.stream_id = stream_id; })
58 .def_property(
59 "reserved",
60 [](DAQEthHeader& self) -> uint32_t { return self.reserved; },
61 [](DAQEthHeader& self, uint32_t reserved) { self.reserved = reserved; })
62 .def_property(
63 "seq_id",
64 [](DAQEthHeader& self) -> uint32_t { return self.seq_id; },
65 [](DAQEthHeader& self, uint32_t seq_id) { self.seq_id = seq_id; })
66 .def_property(
67 "block_length",
68 [](DAQEthHeader& self) -> uint32_t { return self.block_length; },
69 [](DAQEthHeader& self, uint32_t block_length) { self.block_length = block_length; })
70 .def_property(
71 "timestamp",
72 [](DAQEthHeader& self) -> uint64_t { return self.timestamp; },
73 [](DAQEthHeader& self, uint64_t timestamp) { self.timestamp = timestamp; })
74 .def("get_timestamp", &DAQEthHeader::get_timestamp)
75 .def_static("sizeof", []() { return sizeof(DAQEthHeader); });
76}
77
78} // namespace dunedaq::detdataformats::python
79
80// NOLINTEND(build/unsigned)
void register_daqethheader(py::module &m)
DAQEthHeader is a versioned and unified structure for every FE electronics.