LCOV - code coverage report
Current view: top level - artdaq/TransferPlugins - MakeTransferPlugin.cc (source / functions) Coverage Total Hit
Test: artdaq.info.cleaned Lines: 40.9 % 22 9
Test Date: 2025-09-04 00:45:34 Functions: 100.0 % 1 1

            Line data    Source code
       1              : #include "artdaq/TransferPlugins/MakeTransferPlugin.hh"
       2              : #include "artdaq-core/Utilities/ExceptionHandler.hh"
       3              : 
       4              : #include "fhiclcpp/ParameterSet.h"
       5              : 
       6              : #include "cetlib/BasicPluginFactory.h"
       7              : 
       8              : #include <sstream>
       9              : #include <utility>  // std::move()
      10              : 
      11              : namespace artdaq {
      12              : std::unique_ptr<artdaq::TransferInterface>
      13            2 : MakeTransferPlugin(const fhicl::ParameterSet& pset,
      14              :                    const std::string& plugin_label,
      15              :                    TransferInterface::Role role)
      16              : {
      17            8 :         static cet::BasicPluginFactory bpf("transfer", "make");
      18              : 
      19            2 :         fhicl::ParameterSet transfer_pset;
      20              : 
      21              :         try
      22              :         {
      23            2 :                 transfer_pset = pset.get<fhicl::ParameterSet>(plugin_label);
      24              :         }
      25            0 :         catch (...)
      26              :         {
      27            0 :                 std::stringstream errmsg;
      28              :                 errmsg
      29            0 :                     << "Error in artdaq::MakeTransferPlugin: Unable to find the transfer plugin parameters in the FHiCL code \"" << transfer_pset.to_string()
      30              :                     << "\"; FHiCL table with label \"" << plugin_label
      31            0 :                     << "\" may not exist, or if it does, one or more parameters may be missing.";
      32            0 :                 ExceptionHandler(ExceptionHandlerRethrow::yes, errmsg.str());
      33            0 :         }
      34              : 
      35              :         try
      36              :         {
      37              :                 auto transfer =
      38              :                     bpf.makePlugin<std::unique_ptr<TransferInterface>,
      39              :                                    const fhicl::ParameterSet&,
      40              :                                    TransferInterface::Role>(
      41            4 :                         transfer_pset.get<std::string>("transferPluginType"),
      42              :                         transfer_pset,
      43            4 :                         std::move(role));  // NOLINT(performance-move-const-arg)
      44              : 
      45            2 :                 return transfer;
      46            2 :         }
      47            0 :         catch (...)
      48              :         {
      49            0 :                 std::stringstream errmsg;
      50              :                 errmsg
      51              :                     << "Unable to create transfer plugin using the FHiCL parameters \""
      52            0 :                     << transfer_pset.to_string()
      53            0 :                     << "\"";
      54            0 :                 ExceptionHandler(ExceptionHandlerRethrow::yes, errmsg.str());
      55            0 :         }
      56              : 
      57            0 :         return nullptr;
      58            2 : }
      59              : }  // namespace artdaq
        

Generated by: LCOV version 2.0-1