LCOV - code coverage report
Current view: top level - appmodel/src - TPWriterApplication.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 29 0
Test Date: 2026-10-11 15:05:20 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /**
       2              :  * @file TPStreamWriterApplication.cpp
       3              :  *
       4              :  * Implementation of TPStreamWriterApplication's generate_modules dal method
       5              :  *
       6              :  * This is part of the DUNE DAQ Software Suite, copyright 2023.
       7              :  * Licensing/copyright details are in the COPYING file that you should have
       8              :  * received with this code.
       9              :  */
      10              : 
      11              : #include "ConfigObjectFactory.hpp"
      12              : #include "appmodel/NetworkConnectionDescriptor.hpp"
      13              : #include "appmodel/NetworkConnectionRule.hpp"
      14              : #include "appmodel/SourceIDConf.hpp"
      15              : #include "appmodel/TPStreamWriterApplication.hpp"
      16              : #include "appmodel/TPStreamWriterConf.hpp"
      17              : #include "appmodel/TPStreamWriterModule.hpp"
      18              : #include "appmodel/appmodelIssues.hpp"
      19              : #include "conffwk/Configuration.hpp"
      20              : #include "confmodel/Connection.hpp"
      21              : #include "confmodel/NetworkConnection.hpp"
      22              : #include "confmodel/Service.hpp"
      23              : #include "logging/Logging.hpp"
      24              : #include "oks/kernel.hpp"
      25              : 
      26              : #include <fmt/core.h>
      27              : #include <iostream>
      28              : #include <string>
      29              : #include <vector>
      30              : 
      31              : namespace dunedaq {
      32              : namespace appmodel {
      33              : 
      34              : void
      35            0 : TPStreamWriterApplication::generate_modules(std::shared_ptr<appmodel::ConfigurationHelper> /*helper*/) const
      36              : {
      37            0 :   std::vector<const confmodel::DaqModule*> modules;
      38              : 
      39            0 :   ConfigObjectFactory obj_fac(this);
      40              : 
      41            0 :   auto tpwriterConf = get_tp_writer();
      42            0 :   if (tpwriterConf == 0) {
      43              :     throw(BadConf(ERS_HERE, "No TPStreamWriterModule configuration given"));
      44              :   }
      45            0 :   auto tpwriterConfObj = tpwriterConf->config_object();
      46              : 
      47            0 :   const NetworkConnectionDescriptor* tset_in_net_desc = nullptr;
      48            0 :   for (auto rule : get_network_rules()) {
      49            0 :     auto endpoint_class = rule->get_endpoint_class();
      50            0 :     auto data_type = rule->get_descriptor()->get_data_type();
      51            0 :     if (data_type == "TPSet") {
      52            0 :       tset_in_net_desc = rule->get_descriptor();
      53              :     }
      54            0 :   }
      55            0 :   if (tset_in_net_desc == nullptr) {
      56            0 :     throw(BadConf(ERS_HERE, "No network descriptor given to receive TPSets"));
      57              :   }
      58              :   // Create Network Connection
      59            0 :   conffwk::ConfigObject tset_in_net_obj = obj_fac.create_net_obj(tset_in_net_desc, ".*");
      60              : 
      61            0 :   auto source_id = get_source_id();
      62            0 :   if (source_id == nullptr) {
      63            0 :     throw(BadConf(ERS_HERE, "No SourceIDConf given to TPWriterApplication!"));
      64              :   }
      65              : 
      66            0 :   uint tpw_idx = 0;
      67            0 :   std::string tpwrUid("tpwriter-" + std::to_string(source_id->get_sid()));
      68            0 :   conffwk::ConfigObject tpwrObj = obj_fac.create("TPStreamWriterModule", tpwrUid);
      69            0 :   tpwrObj.set_by_val<uint32_t>("source_id", source_id->get_sid());
      70            0 :   tpwrObj.set_by_val("writer_identifier", fmt::format("{}_tpw_{}", UID(), tpw_idx));
      71            0 :   tpwrObj.set_obj("configuration", &tpwriterConf->config_object());
      72            0 :   tpwrObj.set_objs("inputs", { &tset_in_net_obj });
      73              : 
      74            0 :   modules.push_back(obj_fac.get_dal<TPStreamWriterModule>(tpwrUid));
      75              : 
      76            0 :   obj_fac.update_modules(modules);
      77            0 : }
      78              : 
      79              : } // namespace appmodel
      80              : } // namespace dunedaq
        

Generated by: LCOV version 2.0-1