DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
daqheader.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
25register_daqheader(py::module& m)
26{
27
28 py::class_<DAQHeader>(m, "DAQHeader", py::buffer_protocol())
29 .def(py::init<>())
30 .def_property(
31 "version",
32 [](DAQHeader& self) -> uint32_t { return self.version; },
33 [](DAQHeader& self, uint32_t version) { self.version = version; })
34 .def_property(
35 "det_id",
36 [](DAQHeader& self) -> uint32_t { return self.det_id; },
37 [](DAQHeader& self, uint32_t det_id) { self.det_id = det_id; })
38 .def_property(
39 "crate_id",
40 [](DAQHeader& self) -> uint32_t { return self.crate_id; },
41 [](DAQHeader& self, uint32_t crate_id) { self.crate_id = crate_id; })
42 .def_property(
43 "slot_id",
44 [](DAQHeader& self) -> uint32_t { return self.slot_id; },
45 [](DAQHeader& self, uint32_t slot_id) { self.slot_id = slot_id; })
46 .def_property(
47 "link_id",
48 [](DAQHeader& self) -> uint32_t { return self.link_id; },
49 [](DAQHeader& self, uint32_t link_id) { self.link_id = link_id; })
50 .def_property(
51 "timestamp_1",
52 [](DAQHeader&) -> uint32_t {
53 throw std::runtime_error("Cannot directly read timestamp_1; use get_timestamp() instead");
54 },
55 [](DAQHeader& self, uint32_t timestamp_1) { self.timestamp_1 = timestamp_1; })
56 .def_property(
57 "timestamp_2",
58 [](DAQHeader&) -> uint32_t {
59 throw std::runtime_error("Cannot directly read timestamp_2; use get_timestamp() instead");
60 },
61 [](DAQHeader& self, uint32_t timestamp_2) { self.timestamp_2 = timestamp_2; })
62 .def("get_timestamp", &DAQHeader::get_timestamp);
63}
64
65} // namespace dunedaq::detdataformats::python
66
67// NOLINTEND(build/unsigned)
void register_daqheader(py::module &m)
Definition daqheader.cpp:25
DAQHeader is a versioned and unified structure for every FE electronics.
Definition DAQHeader.hpp:23