Line data Source code
1 : /**
2 : * @file detid.cpp
3 : *
4 : * This is part of the DUNE DAQ Software Suite, copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 :
9 : #include "detdataformats/DAQHeader.hpp"
10 :
11 : #include <pybind11/operators.h>
12 : #include <pybind11/pybind11.h>
13 : #include <pybind11/stl.h>
14 :
15 : #include <sstream>
16 :
17 : namespace py = pybind11;
18 :
19 : namespace dunedaq::detdataformats::python {
20 :
21 0 : void register_daqheader(py::module& m) {
22 :
23 0 : py::class_<DAQHeader>(m, "DAQHeader", py::buffer_protocol())
24 0 : .def_property("version",
25 0 : [](DAQHeader& self) -> uint32_t { return self.version; },
26 0 : [](DAQHeader& self, uint32_t version) { self.version = version; }
27 : )
28 0 : .def_property("det_id",
29 0 : [](DAQHeader& self) -> uint32_t { return self.det_id; },
30 0 : [](DAQHeader& self, uint32_t det_id) { self.det_id = det_id; }
31 : )
32 0 : .def_property("crate_id",
33 0 : [](DAQHeader& self) -> uint32_t { return self.crate_id; },
34 0 : [](DAQHeader& self, uint32_t crate_id) { self.crate_id = crate_id; }
35 : )
36 0 : .def_property("slot_id",
37 0 : [](DAQHeader& self) -> uint32_t { return self.slot_id; },
38 0 : [](DAQHeader& self, uint32_t slot_id) { self.slot_id = slot_id; }
39 : )
40 0 : .def_property("link_id",
41 0 : [](DAQHeader& self) -> uint32_t { return self.link_id; },
42 0 : [](DAQHeader& self, uint32_t link_id) { self.link_id = link_id; }
43 : )
44 0 : .def("get_timestamp", &DAQHeader::get_timestamp)
45 : ;
46 0 : }
47 :
48 : } // namespace dunedaq::detdataformats::python
|