LCOV - code coverage report
Current view: top level - fddetdataformats/pybindsrc - daphneeth.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 59 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 30 0

            Line data    Source code
       1              : /**
       2              :  * @file wibeth.cpp Python bindings for the DAPHNEEthFrame format
       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 "fddetdataformats/DAPHNEEthFrame.hpp"
      10              : 
      11              : #include <pybind11/pybind11.h>
      12              : #include <pybind11/stl.h>
      13              : 
      14              : namespace py = pybind11;
      15              : 
      16              : namespace dunedaq::fddetdataformats::python {
      17              : 
      18              : void
      19            0 : register_daphneeth(py::module& m)
      20              : {
      21              : 
      22              : 
      23            0 :   py::class_<DAPHNEEthFrame::Header>(m, "DAPHNEEthHeader")
      24              :     // .def_property("w0",
      25              :     //   [](DAPHNEEthFrame::Header& self) -> uint32_t {return self.w0;},
      26              :     //   [](DAPHNEEthFrame::Header& self, uint32_t w0) {self.w0 = w0;}
      27              :     //   )      
      28            0 :     .def_property("w1",
      29            0 :       [](DAPHNEEthFrame::Header& self) -> uint32_t {return self.w1;},
      30            0 :       [](DAPHNEEthFrame::Header& self, uint32_t w1) {self.w1 = w1;}
      31              :       )
      32            0 :     .def_property("w2",
      33            0 :       [](DAPHNEEthFrame::Header& self) -> uint32_t {return self.w2;},
      34            0 :       [](DAPHNEEthFrame::Header& self, uint32_t w2) {self.w2 = w2;}
      35              :       )
      36            0 :     .def_property("w3",
      37            0 :       [](DAPHNEEthFrame::Header& self) -> uint32_t {return self.w3;},
      38            0 :       [](DAPHNEEthFrame::Header& self, uint32_t w3) {self.w3 = w3;}
      39              :       )
      40            0 :     .def_property("w4",
      41            0 :       [](DAPHNEEthFrame::Header& self) -> uint32_t {return self.w4;},
      42            0 :       [](DAPHNEEthFrame::Header& self, uint32_t w4) {self.w4 = w4;}
      43              :       )
      44            0 :     .def_property("w5",
      45            0 :       [](DAPHNEEthFrame::Header& self) -> uint32_t {return self.w5;},
      46            0 :       [](DAPHNEEthFrame::Header& self, uint32_t w5) {self.w5 = w5;}
      47              :       )
      48            0 :     .def_property("w6",
      49            0 :       [](DAPHNEEthFrame::Header& self) -> uint32_t {return self.w6;},
      50            0 :       [](DAPHNEEthFrame::Header& self, uint32_t w6) {self.w6 = w6;}
      51              :       )
      52            0 :     .def_property("channel",
      53            0 :       [](DAPHNEEthFrame::Header& self) -> uint32_t {return self.channel;},
      54            0 :       [](DAPHNEEthFrame::Header& self, uint32_t channel) {self.channel = channel;}
      55              :       )
      56            0 :     .def_property("version",
      57            0 :       [](DAPHNEEthFrame::Header& self) -> uint32_t {return self.version;},
      58            0 :       [](DAPHNEEthFrame::Header& self, uint32_t version) {self.version = version;}
      59              :       )
      60            0 :     .def_property("trigger_sample_value",
      61            0 :       [](DAPHNEEthFrame::Header& self) -> uint32_t {return self.trig_sample;},
      62            0 :       [](DAPHNEEthFrame::Header& self, uint32_t trig_sample) {self.trig_sample = trig_sample;}
      63              :       )
      64            0 :     .def_property("threshold",
      65            0 :       [](DAPHNEEthFrame::Header& self) -> uint32_t {return self.threshold;},
      66            0 :       [](DAPHNEEthFrame::Header& self, uint32_t threshold) {self.threshold = threshold;}
      67              :       )
      68            0 :     .def_property("baseline",
      69            0 :       [](DAPHNEEthFrame::Header& self) -> uint32_t {return self.baseline;},
      70            0 :       [](DAPHNEEthFrame::Header& self, uint32_t baseline) {self.baseline = baseline;}
      71              :       )
      72              :     ;
      73              : 
      74            0 :   py::class_<DAPHNEEthFrame>(m, "DAPHNEEthFrame", py::buffer_protocol())
      75            0 :     .def(py::init())
      76            0 :     .def(py::init([](py::capsule capsule) {
      77            0 :         auto wfp = *static_cast<DAPHNEEthFrame*>(capsule.get_pointer());
      78            0 :         return wfp;
      79              :     } ))
      80            0 :     .def(py::init([](py::bytes bytes){
      81            0 :         py::buffer_info info(py::buffer(bytes).request());
      82            0 :         auto wfp = *static_cast<DAPHNEEthFrame*>(info.ptr);
      83            0 :         return wfp;
      84            0 :     }))
      85            0 :     .def("get_daqheader", [](DAPHNEEthFrame& self) -> const detdataformats::DAQEthHeader& {return self.daq_header;}, py::return_value_policy::reference_internal)
      86            0 :     .def("get_daphneheader", [](DAPHNEEthFrame& self) -> const DAPHNEEthFrame::Header& {return self.header;}, py::return_value_policy::reference_internal)
      87            0 :     .def("get_header", [](DAPHNEEthFrame& self) -> const DAPHNEEthFrame::Header& {return self.header;}, py::return_value_policy::reference_internal)
      88            0 :     .def("get_adc", &DAPHNEEthFrame::get_adc)
      89            0 :     .def("set_adc", &DAPHNEEthFrame::set_adc)
      90            0 :     .def("get_timestamp", &DAPHNEEthFrame::get_timestamp)
      91            0 :     .def("set_timestamp", &DAPHNEEthFrame::set_timestamp)
      92            0 :     .def("get_channel", &DAPHNEEthFrame::get_channel)
      93            0 :     .def("set_channel", &DAPHNEEthFrame::set_channel)
      94            0 :     .def_static("sizeof", [](){ return sizeof(DAPHNEEthFrame); })
      95            0 :     .def("get_bytes",
      96            0 :          [](DAPHNEEthFrame* fr) -> py::bytes {
      97            0 :            return py::bytes(reinterpret_cast<char*>(fr), sizeof(DAPHNEEthFrame));
      98              :         })
      99              :   ;
     100            0 : }
     101              : 
     102              : } // namespace dunedaq::fddetdataformats::python
        

Generated by: LCOV version 2.0-1