LCOV - code coverage report
Current view: top level - flxlibs/src - CreateElink.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 % 4 0

            Line data    Source code
       1              : /**
       2              :  * @file CreateElink.hpp Specific ElinkConcept 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 FLXLIBS_SRC_CREATEELINK_HPP_
       9              : #define FLXLIBS_SRC_CREATEELINK_HPP_
      10              : 
      11              : #include "ElinkConcept.hpp"
      12              : #include "ElinkModel.hpp"
      13              : #include "flxlibs/AvailableParserOperations.hpp"
      14              : #include "datahandlinglibs/DataHandlingIssues.hpp"
      15              : //#include "fdreadoutlibs/ProtoWIBSuperChunkTypeAdapter.hpp"
      16              : //#include "fdreadoutlibs/DUNEWIBSuperChunkTypeAdapter.hpp"
      17              : #include "fdreadoutlibs/DAPHNESuperChunkTypeAdapter.hpp"
      18              : #include "fdreadoutlibs/DAPHNEStreamSuperChunkTypeAdapter.hpp"
      19              : #include "fdreadoutlibs/VariableSizePayloadTypeAdapter.hpp"
      20              : 
      21              : #include <memory>
      22              : #include <string>
      23              : 
      24              : namespace dunedaq {
      25              : 
      26              : //DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::ProtoWIBSuperChunkTypeAdapter, "WIBFrame")
      27              : //DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::DUNEWIBSuperChunkTypeAdapter, "WIB2Frame")
      28            0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::DAPHNESuperChunkTypeAdapter, "PDSFrame")
      29            0 : DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::DAPHNEStreamSuperChunkTypeAdapter, "PDSStreamFrame")
      30              : 
      31              : namespace flxlibs {
      32              : 
      33              : std::unique_ptr<ElinkConcept>
      34            0 : createElinkModel(const std::string& conn_uid)
      35              : {
      36            0 :   auto datatypes = dunedaq::iomanager::IOManager::get()->get_datatypes(conn_uid);
      37            0 :   if (datatypes.size() != 1) {
      38            0 :     ers::error(dunedaq::datahandlinglibs::GenericConfigurationError(ERS_HERE,
      39            0 :       "Multiple output data types specified! Expected only a single type!"));
      40              :   }
      41            0 :   std::string raw_dt{ *datatypes.begin() };
      42            0 :   TLOG() << "Choosing specializations for ElinkModel for output connection "
      43            0 :          << " [uid:" << conn_uid << " , data_type:" << raw_dt << ']';
      44              : /*
      45              : 
      46              :   if (raw_dt.find("WIBFrame") != std::string::npos) {
      47              :     // WIB1 specific char arrays
      48              :     // Create Model
      49              :     auto elink_model = std::make_unique<ElinkModel<fdreadoutlibs::types::ProtoWIBSuperChunkTypeAdapter>>();
      50              : 
      51              :     // Setup sink (acquire pointer from QueueRegistry)
      52              :     elink_model->set_sink(conn_uid);
      53              : 
      54              :     // Get parser and sink
      55              :     auto& parser = elink_model->get_parser();
      56              :     auto& sink = elink_model->get_sink();
      57              :     auto& error_sink = elink_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              :     return elink_model;
      68              : 
      69              :   } else if (raw_dt.find("WIB2Frame") != std::string::npos) {
      70              :     // WIB2 specific char arrays
      71              :     auto elink_model = std::make_unique<ElinkModel<fdreadoutlibs::types::DUNEWIBSuperChunkTypeAdapter>>();
      72              :     elink_model->set_sink(conn_uid);
      73              :     auto& parser = elink_model->get_parser();
      74              :     auto& sink = elink_model->get_sink();
      75              :     parser.process_chunk_func = parsers::fixsizedChunkInto<fdreadoutlibs::types::DUNEWIBSuperChunkTypeAdapter>(sink);
      76              :     return elink_model;
      77              : 
      78              :   } else*/ 
      79            0 :   if (raw_dt.find("PDSStreamFrame") != std::string::npos) {
      80              :     // PDS specific char arrays
      81            0 :     auto elink_model = std::make_unique<ElinkModel<fdreadoutlibs::types::DAPHNEStreamSuperChunkTypeAdapter>>();
      82            0 :     elink_model->set_sink(conn_uid);
      83            0 :     auto& parser = elink_model->get_parser();
      84            0 :     auto& sink = elink_model->get_sink();
      85            0 :     parser.process_chunk_func = parsers::fixsizedChunkInto<fdreadoutlibs::types::DAPHNEStreamSuperChunkTypeAdapter>(sink);
      86            0 :     return elink_model;
      87              : 
      88            0 :   } else if (raw_dt.find("PDSFrame") != std::string::npos) {
      89              :     // PDS specific char arrays
      90            0 :     auto elink_model = std::make_unique<ElinkModel<fdreadoutlibs::types::DAPHNESuperChunkTypeAdapter>>();
      91            0 :     elink_model->set_sink(conn_uid);
      92            0 :     auto& parser = elink_model->get_parser();
      93            0 :     auto& sink = elink_model->get_sink();
      94            0 :     parser.process_chunk_func = parsers::fixsizedChunkInto<fdreadoutlibs::types::DAPHNESuperChunkTypeAdapter>(sink);
      95            0 :     return elink_model;
      96              : 
      97              : 
      98            0 :   } else if (raw_dt.find("varsize") != std::string::npos) {
      99              :     // Variable sized user payloads
     100            0 :     auto elink_model = std::make_unique<ElinkModel<fdreadoutlibs::types::VariableSizePayloadTypeAdapter>>();
     101            0 :     elink_model->set_sink(conn_uid);
     102            0 :     auto& parser = elink_model->get_parser();
     103            0 :     auto& sink = elink_model->get_sink();
     104            0 :     parser.process_chunk_func = parsers::varsizedChunkIntoWrapper(sink);
     105            0 :     parser.process_shortchunk_func = parsers::varsizedShortchunkIntoWrapper(sink);
     106            0 :     return elink_model;
     107            0 :   }
     108              : 
     109            0 :   return nullptr;
     110            0 : }
     111              : 
     112              : } // namespace flxlibs
     113              : } // namespace dunedaq
     114              : 
     115              : #endif // FLXLIBS_SRC_CREATEELINK_HPP_
        

Generated by: LCOV version 2.0-1