LCOV - code coverage report
Current view: top level - appmodel/src - DFOApplication.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 56 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 2 0

            Line data    Source code
       1              : /**
       2              :  * @file DFO.cpp
       3              :  *
       4              :  * Implementation of DFOApplication'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              : 
      12              : #include "ConfigObjectFactory.hpp"
      13              : #include "appmodel/DFApplication.hpp"
      14              : #include "appmodel/DFOApplication.hpp"
      15              : #include "appmodel/DFOConf.hpp"
      16              : #include "appmodel/DFOModule.hpp"
      17              : #include "appmodel/NetworkConnectionDescriptor.hpp"
      18              : #include "appmodel/NetworkConnectionRule.hpp"
      19              : #include "appmodel/QueueConnectionRule.hpp"
      20              : #include "appmodel/QueueDescriptor.hpp"
      21              : #include "appmodel/appmodelIssues.hpp"
      22              : #include "conffwk/Configuration.hpp"
      23              : #include "confmodel/Connection.hpp"
      24              : #include "confmodel/NetworkConnection.hpp"
      25              : #include "confmodel/Service.hpp"
      26              : #include "logging/Logging.hpp"
      27              : #include "oks/kernel.hpp"
      28              : 
      29              : #include <string>
      30              : #include <vector>
      31              : 
      32              : namespace dunedaq {
      33              : namespace appmodel {
      34              : 
      35              : void
      36            0 : DFOApplication::generate_modules(const confmodel::Session* session) const
      37              : {
      38            0 :   std::vector<const confmodel::DaqModule*> modules;
      39              : 
      40            0 :   ConfigObjectFactory obj_fac(this);
      41              : 
      42              : 
      43            0 :   std::string dfoUid("DFO-" + UID());
      44            0 :   TLOG_DEBUG(7) << "creating OKS configuration object for DFOModule class ";
      45            0 :   auto dfoObj = obj_fac.create("DFOModule", dfoUid);
      46              : 
      47            0 :   auto dfoConf = get_dfo();
      48            0 :   dfoObj.set_obj("configuration", &dfoConf->config_object());
      49              : 
      50            0 :   if (dfoConf == 0) {
      51              :     throw(BadConf(ERS_HERE, "No DFOConf configuration given"));
      52              :   }
      53              : 
      54            0 :   std::vector<const conffwk::ConfigObject*> output_conns;
      55            0 :   std::vector<const conffwk::ConfigObject*> input_conns;
      56            0 :   conffwk::ConfigObject tdInObj;
      57            0 :   conffwk::ConfigObject busyOutObj;
      58            0 :   conffwk::ConfigObject tokenInObj;
      59              : 
      60            0 :   for (auto rule : get_network_rules()) {
      61            0 :     auto endpoint_class = rule->get_endpoint_class();
      62            0 :     auto descriptor = rule->get_descriptor();
      63              : 
      64            0 :     auto connObj = obj_fac.create_net_obj(descriptor, "");
      65              : 
      66            0 :     if (descriptor->get_data_type() == "TriggerDecision") {
      67            0 :       if (endpoint_class == "DFOModule") {
      68            0 :         tdInObj = connObj;
      69            0 :         input_conns.push_back(&tdInObj);
      70              :       }
      71            0 :     } else if (descriptor->get_data_type() == "TriggerDecisionToken") {
      72            0 :       tokenInObj = connObj;
      73            0 :       input_conns.push_back(&tokenInObj);
      74              :     }
      75              : 
      76            0 :     else if (descriptor->get_data_type() == "TriggerInhibit") {
      77            0 :       busyOutObj = connObj;
      78            0 :       output_conns.push_back(&busyOutObj);
      79              :     }
      80            0 :   }
      81              : 
      82            0 :   if (tdInObj == nullptr) {
      83            0 :     throw(BadConf(ERS_HERE, "No TriggerDecision input connection descriptor given"));
      84              :   }
      85            0 :   if (busyOutObj == nullptr) {
      86            0 :     throw(BadConf(ERS_HERE, "No TriggerInhibit output connection descriptor given"));
      87              :   }
      88            0 :   if (tokenInObj == nullptr) {
      89            0 :     throw(BadConf(ERS_HERE, "No TriggerDecisionToken input connection descriptor given"));
      90              :   }
      91              : 
      92              :   // Process special Network rules!
      93              :   // Looking for DataRequest rules from ReadoutAppplications in current Session
      94            0 :   auto sessionApps = session->enabled_applications();
      95            0 :   std::vector<conffwk::ConfigObject> tdOutObjs;
      96            0 :   for (auto app : sessionApps) {
      97            0 :     auto dfapp = app->cast<appmodel::DFApplication>();
      98            0 :     if (dfapp == nullptr)
      99            0 :       continue;
     100              : 
     101            0 :     auto dfNRules = dfapp->get_network_rules();
     102            0 :     for (auto rule : dfNRules) {
     103            0 :       auto descriptor = rule->get_descriptor();
     104            0 :       auto data_type = descriptor->get_data_type();
     105            0 :       if (data_type == "TriggerDecision") {
     106            0 :         tdOutObjs.emplace_back(obj_fac.create_net_obj(descriptor, dfapp->UID()));
     107              :       } // If network rule has TriggerDecision type of data
     108            0 :     }   // Loop over Apps network rules
     109            0 :   }     // loop over Session specific Apps
     110              : 
     111            0 :   for (auto& tdOut : tdOutObjs) {
     112            0 :     output_conns.push_back(&tdOut);
     113              :   }
     114              : 
     115            0 :   dfoObj.set_objs("inputs", input_conns);
     116            0 :   dfoObj.set_objs("outputs", output_conns);
     117              : 
     118              :   // Add to our list of modules to return
     119            0 :   modules.push_back(obj_fac.get_dal<DFOModule>(dfoUid));
     120              : 
     121            0 :   obj_fac.update_modules(modules);
     122            0 : }
     123              : 
     124              : } // namespace appmodel  
     125              : } // namespace dunedaq
        

Generated by: LCOV version 2.0-1