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

            Line data    Source code
       1              : /**
       2              :  * @file CreateSource.hpp Specific SourceConcept creator.
       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_CREATESOURCE_HPP_
       9              : #define ASIOLIBS_SRC_CREATESOURCE_HPP_
      10              : 
      11              : #include "SourceConcept.hpp"
      12              : #include "SourceModel.hpp"
      13              : #include "datahandlinglibs/DataHandlingIssues.hpp"
      14              : 
      15              : #include "fdreadoutlibs/DUNEWIBEthTypeAdapter.hpp"
      16              : #include "fdreadoutlibs/TDEFrameTypeAdapter.hpp"
      17              : #include "fdreadoutlibs/CRTBernTypeAdapter.hpp"
      18              : #include "fdreadoutlibs/CRTGrenobleTypeAdapter.hpp"
      19              : 
      20              : #include <memory>
      21              : #include <string>
      22              : 
      23              : namespace dunedaq {
      24              : 
      25            0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::DUNEWIBEthTypeAdapter, "WIBEthFrame")
      26            0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::TDEFrameTypeAdapter, "TDEFrame")
      27            0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::CRTBernTypeAdapter, "CRTBernFrame")
      28            0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::CRTGrenobleTypeAdapter, "CRTGrenobleFrame")
      29              : 
      30              : namespace asiolibs {
      31              : 
      32              : std::shared_ptr<SourceConcept>
      33            0 : createSourceModel(const std::string& conn_uid, bool callback_mode)
      34              : {
      35            0 :   auto datatypes = dunedaq::iomanager::IOManager::get()->get_datatypes(conn_uid);
      36            0 :   if (datatypes.size() != 1) {
      37            0 :     ers::error(dunedaq::datahandlinglibs::GenericConfigurationError(ERS_HERE,
      38            0 :       "Multiple output data types specified! Expected only a single type!"));
      39              :   }
      40            0 :   std::string raw_dt{ *datatypes.begin() };
      41            0 :   TLOG() << "Choosing specializations for SourceModel for output connection "
      42            0 :          << " [uid:" << conn_uid << " , data_type:" << raw_dt << ']';
      43              : 
      44            0 :   if (raw_dt.find("WIBEthFrame") != std::string::npos) {
      45              :     // Create Model
      46            0 :     auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::DUNEWIBEthTypeAdapter>>();
      47              : 
      48              :     // For callback acquisition later (lazy)
      49            0 :     source_model->set_sink_name(conn_uid);
      50              : 
      51              :     // Setup sink (acquire pointer from QueueRegistry)
      52            0 :     source_model->set_sink(conn_uid, callback_mode);
      53              : 
      54              :     // Get parser and sink
      55              :     //auto& parser = source_model->get_parser();
      56              :     //auto& sink = source_model->get_sink();
      57              :     //auto& error_sink = source_model->get_error_sink();
      58              : 
      59              :     // Modify parser as needed...
      60              :     //parser.process_chunk_func = parsers::fixsizedChunkInto<fdreadoutlibs::types::ProtoWIBSuperChunkTypeAdapter>(sink);
      61              :     //if (error_sink != nullptr) {
      62              :     //  parser.process_chunk_with_error_func = parsers::errorChunkIntoSink(error_sink);
      63              :     //}
      64              :     // parser.process_block_func = ...
      65              : 
      66              :     // Return with setup model
      67            0 :     return source_model;
      68              : 
      69            0 :   } else if (raw_dt.find("TDEFrame") != std::string::npos) {
      70              :     // WIB2 specific char arrays
      71            0 :     auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::TDEFrameTypeAdapter>>();
      72            0 :     source_model->set_sink_name(conn_uid);
      73            0 :     source_model->set_sink(conn_uid, callback_mode);
      74              :     //auto& parser = source_model->get_parser();
      75              :     //parser.process_chunk_func = parsers::fixsizedChunkInto<fdreadoutlibs::types::DUNEWIBSuperChunkTypeAdapter>(sink);
      76            0 :     return source_model;
      77            0 :   } else if (raw_dt.find("CRTBernFrame") != std::string::npos) {
      78            0 :     auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::CRTBernTypeAdapter>>();
      79            0 :     source_model->set_sink_name(conn_uid);
      80            0 :     source_model->set_sink(conn_uid, callback_mode);
      81            0 :     return source_model;
      82            0 :   } else if (raw_dt.find("CRTGrenobleFrame") != std::string::npos) {
      83            0 :     auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::CRTGrenobleTypeAdapter>>();
      84            0 :     source_model->set_sink_name(conn_uid);
      85            0 :     source_model->set_sink(conn_uid, callback_mode);
      86            0 :     return source_model;
      87            0 :   }
      88              : 
      89            0 :   return nullptr;
      90            0 : }
      91              : 
      92              : } // namespace asiolibs
      93              : } // namespace dunedaq
      94              : 
      95              : #endif // ASIOLIBS_SRC_CREATESOURCE_HPP_
        

Generated by: LCOV version 2.0-1