LCOV - code coverage report
Current view: top level - crtmodules/plugins - CRTBernReaderModule.hpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 2 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 2 0

            Line data    Source code
       1              : /**
       2              :  * @file CRTBernReaderModule.hpp
       3              :  *
       4              :  * Reads data from the HW then puts it in a queue
       5              :  *
       6              :  * This is part of the DUNE DAQ Software Suite, copyright 2020.
       7              :  * Licensing/copyright details are in the COPYING file that you should have
       8              :  * received with this code.
       9              :  */
      10              : 
      11              : #ifndef CRTMODULES_PLUGINS_CRTBERNREADERMODULE_HPP_
      12              : #define CRTMODULES_PLUGINS_CRTBERNREADERMODULE_HPP_
      13              : 
      14              : #include "appfwk/DAQModule.hpp"
      15              : #include "utilities/ReusableThread.hpp"
      16              : 
      17              : #include <memory>
      18              : #include <map>
      19              : 
      20              : namespace dunedaq {
      21              : namespace crtmodules {
      22              : 
      23              : class SourceConcept;
      24              : 
      25              : class CRTBernReaderModule : public dunedaq::appfwk::DAQModule
      26              : {
      27              : public:
      28              :   /**
      29              :    * @brief CRTBernReaderModule constructor
      30              :    * @param name DAQ module instance name
      31              :    */
      32              :   explicit CRTBernReaderModule(const std::string& name);
      33              : 
      34              :   CRTBernReaderModule(const CRTBernReaderModule&) = delete;            ///< CRTBernReaderModule is not copy-constructible
      35              :   CRTBernReaderModule& operator=(const CRTBernReaderModule&) = delete; ///< CRTBernReaderModule is not copy-assignable
      36              :   CRTBernReaderModule(CRTBernReaderModule&&) = delete;                 ///< CRTBernReaderModule is not move-constructible
      37              :   CRTBernReaderModule& operator=(CRTBernReaderModule&&) = delete;      ///< CRTBernReaderModule is not move-assignable
      38              : 
      39              :   /**
      40              :    * @brief Handles initialization on boot
      41              :    * @param mcfg DAQ configuration data
      42              :    */    
      43              :   void init(const std::shared_ptr<appfwk::ConfigurationManager> mfcg) override;
      44              : 
      45              : private:
      46              :   // Commands
      47              :   void do_conf(const CommandData_t& obj);
      48              :   void do_start(const CommandData_t& obj);
      49              :   void do_stop(const CommandData_t& obj);
      50              :   void do_scrap(const CommandData_t& obj);
      51              : 
      52              :   void generate_opmon_data() override;
      53              : 
      54              :   /**
      55              :    * @brief Raw data produce thread function
      56              :    */     
      57              :   void run_produce();
      58              : 
      59              :   /**
      60              :    * @brief Forwards the payload to get processed
      61              :    * @param payload Payload buffer
      62              :    * @param size Payload size
      63              :    */    
      64              :   void handle_eth_payload(char* payload, std::size_t size);
      65              : 
      66              :   /**
      67              :    * @brief Sets run marker
      68              :    * @param should_run Whether producer thread should continue
      69              :    */      
      70              :   void set_running(bool /*should_run*/);  
      71              :   
      72              :   /**
      73              :    * @brief Enables data taking
      74              :    */   
      75            0 :   void enable_flow() { m_enable_flow.store(true); }
      76              : 
      77              :   /**
      78              :    * @brief Disables data taking
      79              :    */   
      80            0 :   void disable_flow() { m_enable_flow.store(false); }  
      81              : 
      82              :   /**
      83              :    * @brief Whether producer thread should continue
      84              :    */      
      85              :   std::atomic<bool> m_run_marker{ false };
      86              : 
      87              :   /**
      88              :    * @brief Whether data taking should continue
      89              :    */        
      90              :   std::atomic<bool> m_enable_flow{ false }; // this is for queue ops
      91              : 
      92              :   // PRODUCER
      93              :   /**
      94              :    * @brief Raw data producer thread
      95              :    */       
      96              :   utilities::ReusableThread m_producer_thread;  
      97              : 
      98              :   // Sinks (SourceConcepts)
      99              :   /**
     100              :    * @brief Data sources
     101              :    */
     102              :   using sid_to_source_map_t = std::map<int, std::shared_ptr<SourceConcept>>;
     103              :   sid_to_source_map_t m_sources;
     104              :   uint32_t m_source_id; // NOLINT(build/unsigned)
     105              : 
     106              :   /**
     107              :    * @brief Configured packet transmission rate in kHz
     108              :    */
     109              :   double m_configured_packet_rate_khz{ 10 };
     110              :     
     111              :   /**
     112              :    * @brief Counts packets since last opmon data generation
     113              :    */
     114              :   std::atomic<int> m_packet_count{ 0 };   
     115              : 
     116              :   // RUN START T0
     117              :   /**
     118              :    * @brief Timestamp used to measure time between opmon reports
     119              :    */   
     120              :   std::chrono::time_point<std::chrono::high_resolution_clock> m_t0;      
     121              : };
     122              : } // namespace crtmodules
     123              : } // namespace dunedaq
     124              : 
     125              : #endif // CRTMODULES_PLUGINS_CRTBERNREADERMODULE_HPP_
        

Generated by: LCOV version 2.0-1