LCOV - code coverage report
Current view: top level - asiolibs/src - GenericReceiverModel.hpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 11 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 4 0

            Line data    Source code
       1              : /**
       2              :  * @file GenericReceiverModel.hpp Generic IOManager Receiver model
       3              :  *
       4              :  * This is part of the DUNE DAQ , copyright 2020.
       5              :  * Licensing/copyright details are in the COPYING file that you should have
       6              :  * received with this code.
       7              :  */
       8              : #ifndef ASIOLIBS_SRC_GENERICRECEIVERMODEL_HPP_
       9              : #define ASIOLIBS_SRC_GENERICRECEIVERMODEL_HPP_
      10              : 
      11              : #include "GenericReceiverConcept.hpp"
      12              : 
      13              : namespace dunedaq::asiolibs {
      14              : 
      15              : template<class TargetPayloadType>
      16              : class GenericReceiverModel : public GenericReceiverConcept
      17              : {
      18              : public:
      19            0 :   explicit GenericReceiverModel(const std::string& raw_data_receiver_connection_name)
      20            0 :     : m_receiver(get_iom_receiver<TargetPayloadType>(raw_data_receiver_connection_name))
      21            0 :   {}
      22              : 
      23            0 :   std::optional<TypeErasedPayload> try_receive(dunedaq::iomanager::Receiver::timeout_t timeout) override {
      24            0 :     auto opt_payload = m_receiver->try_receive(timeout);
      25            0 :     if (opt_payload) {
      26              :       // Allocate the received payload on the heap with shared ownership,
      27              :       // so its lifetime can outlive this function and be tied to async sends.
      28            0 :       auto payload = std::make_shared<TargetPayloadType>(std::move(*opt_payload));
      29            0 :       return TypeErasedPayload{ std::reinterpret_pointer_cast<const void>(payload), payload.get(), sizeof(*payload) };
      30            0 :     }
      31            0 :     return std::nullopt;
      32            0 :   }
      33              :   
      34              : private:
      35              :   /**
      36              :    * @brief Generic IOManager Receiver
      37              :    */
      38              :   std::shared_ptr<iomanager::ReceiverConcept<TargetPayloadType>> m_receiver;
      39              : };
      40              : 
      41              : } // namespace dunedaq::asiolibs
      42              : 
      43              : #endif // ASIOLIBS_SRC_GENERICRECEIVERMODEL_HPP_
        

Generated by: LCOV version 2.0-1