LCOV - code coverage report
Current view: top level - detdataformats/pybindsrc - daqheader.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 28 0
Test Date: 2026-05-24 15:29:04 Functions: 0.0 % 15 0

            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              : // Quiet the linter about use of unsigned ints in the file
      22              : // NOLINTBEGIN(build/unsigned)
      23              : 
      24              : void
      25            0 : register_daqheader(py::module& m)
      26              : {
      27              : 
      28            0 :   py::class_<DAQHeader>(m, "DAQHeader", py::buffer_protocol())
      29            0 :     .def(py::init<>())
      30            0 :     .def_property(
      31              :       "version",
      32            0 :       [](DAQHeader& self) -> uint32_t { return self.version; },
      33            0 :       [](DAQHeader& self, uint32_t version) { self.version = version; })
      34            0 :     .def_property(
      35              :       "det_id",
      36            0 :       [](DAQHeader& self) -> uint32_t { return self.det_id; },
      37            0 :       [](DAQHeader& self, uint32_t det_id) { self.det_id = det_id; })
      38            0 :     .def_property(
      39              :       "crate_id",
      40            0 :       [](DAQHeader& self) -> uint32_t { return self.crate_id; },
      41            0 :       [](DAQHeader& self, uint32_t crate_id) { self.crate_id = crate_id; })
      42            0 :     .def_property(
      43              :       "slot_id",
      44            0 :       [](DAQHeader& self) -> uint32_t { return self.slot_id; },
      45            0 :       [](DAQHeader& self, uint32_t slot_id) { self.slot_id = slot_id; })
      46            0 :     .def_property(
      47              :       "link_id",
      48            0 :       [](DAQHeader& self) -> uint32_t { return self.link_id; },
      49            0 :       [](DAQHeader& self, uint32_t link_id) { self.link_id = link_id; })
      50            0 :     .def_property(
      51              :       "timestamp_1",
      52            0 :       [](DAQHeader&) -> uint32_t {
      53            0 :         throw std::runtime_error("Cannot directly read timestamp_1; use get_timestamp() instead");
      54              :       },
      55            0 :       [](DAQHeader& self, uint32_t timestamp_1) { self.timestamp_1 = timestamp_1; })
      56            0 :     .def_property(
      57              :       "timestamp_2",
      58            0 :       [](DAQHeader&) -> uint32_t {
      59            0 :         throw std::runtime_error("Cannot directly read timestamp_2; use get_timestamp() instead");
      60              :       },
      61            0 :       [](DAQHeader& self, uint32_t timestamp_2) { self.timestamp_2 = timestamp_2; })
      62            0 :     .def("get_timestamp", &DAQHeader::get_timestamp);
      63            0 : }
      64              : 
      65              : } // namespace dunedaq::detdataformats::python
      66              : 
      67              : // NOLINTEND(build/unsigned)
        

Generated by: LCOV version 2.0-1