LCOV - code coverage report
Current view: top level - artdaq/ArtModules/detail - TransferWrapper.hh (source / functions) Coverage Total Hit
Test: artdaq.info.cleaned Lines: 0.0 % 2 0
Test Date: 2025-09-04 00:45:34 Functions: 0.0 % 1 0

            Line data    Source code
       1              : #ifndef artdaq_ArtModules_TransferWrapper_hh
       2              : #define artdaq_ArtModules_TransferWrapper_hh
       3              : 
       4              : #include "artdaq-core/Data/RawEvent.hh"
       5              : #include "artdaq/ArtModules/ArtdaqEvent.hh"
       6              : #include "artdaq/ExternalComms/CommanderInterface.hh"
       7              : #include "artdaq/TransferPlugins/TransferInterface.hh"
       8              : 
       9              : namespace fhicl {
      10              : class ParameterSet;
      11              : }
      12              : 
      13              : #include <iostream>
      14              : #include <memory>
      15              : #include <string>
      16              : #include <unordered_map>
      17              : 
      18              : namespace artdaq {
      19              : class Fragment;
      20              : 
      21              : /**
      22              :  * \brief TransferWrapper wraps a TransferInterface so that it can be used in the ArtdaqInput class
      23              :  * to make an art::Source
      24              :  *
      25              :  * JCF, May-27-2016
      26              :  *
      27              :  * This is the class through which code that wants to access a
      28              :  * transfer plugin (e.g., input sources, AggregatorCore, etc.) can do
      29              :  * so. Its functionality is such that it satisfies the requirements
      30              :  * needed to be a template in the ArtdaqInput class
      31              :  */
      32              : class TransferWrapper
      33              : {
      34              : public:
      35              :         /**
      36              :          * \brief TransferWrapper Constructor
      37              :          * \param pset ParameterSet used to configure the TransferWrapper
      38              :          *
      39              :          * \verbatim
      40              :          * TransferWrapper accepts the following Parameters:
      41              :          * "timeoutInUsecs" (Default: 100000): The receive timeout
      42              :          * "dispatcherHost" (REQUIRED): The hostname that the Dispatcher Aggregator is running on
      43              :          * "dispatcherPort" (REQUIRED): The port that the Dispatcher Aggregator is running on
      44              :          * "maxEventsBeforeInit" (Default: 5): How many non-Init events to receive before raising an error
      45              :          * "allowedFragmentTypes" (Default: [226,227,229]): The Fragment type codes for expected Fragments
      46              :          * "dispatcherConnectTimeout" (Default: 0): Maximum amount of time (in seconds) to wait for the Dispatcher to reach the Running state. 0 to wait forever
      47              :          * "dispatcherConnectRetryInterval_us" (Default 1,000,000): Amount of time to wait between polls of the Dispatcher status while waiting for it to reach the Running state.
      48              :          * "quitOnFragmentIntegrityProblem" (Default: true): If there is an inconsistency in the received Fragment, throw an exception and quit when true
      49              :          * "multi_run_mode" (Default: false): Whether to ignore EndOfData Fragments
      50              :          * "debugLevel" (Default: 0): Enables some additional messages
      51              :          * "transfer_plugin" (REQUIRED): Name of the TransferInterface plugin to load
      52              :          *
      53              :          * This parameter set is also passed to TransferInterface, so any necessary Parameters for TransferInterface or the requested plugin
      54              :          * should be included here.
      55              :          * \endverbatim
      56              :          */
      57              :         explicit TransferWrapper(const fhicl::ParameterSet& pset);
      58              : 
      59              :         /**
      60              :          * \brief TransferWrapper Destructor
      61              :          */
      62              :         virtual ~TransferWrapper();
      63              : 
      64              :         /**
      65              :          * \brief Receive a Fragment from the TransferInterface, and send it to art
      66              :          * \return Received Fragment
      67              :          */
      68              :         artdaq::FragmentPtrs receiveMessage();
      69              :         /**
      70              :          * \brief Receive all messsages for an event from ArtdaqSharedMemoryService
      71              :          * \return A map of Fragment::type_t to a unique_ptr to Fragments containing all Fragments in an event
      72              :          */
      73              :         std::shared_ptr<ArtdaqEvent> receiveMessages();
      74              : 
      75              :         /**
      76              :          * \brief Receive the Init message from the TransferInterface, and send it to art
      77              :          * \return Received InitFragment
      78              :          */
      79            0 :         artdaq::FragmentPtrs receiveInitMessage()
      80              :         {
      81            0 :                 return receiveMessage();
      82              :         }
      83              : 
      84              : private:
      85              :         TransferWrapper(TransferWrapper const&) = delete;
      86              :         TransferWrapper(TransferWrapper&&) = delete;
      87              :         TransferWrapper& operator=(TransferWrapper const&) = delete;
      88              :         TransferWrapper& operator=(TransferWrapper&&) = delete;
      89              : 
      90              :         void checkIntegrity(const artdaq::Fragment&) const;
      91              : 
      92              :         void registerMonitor();
      93              :         void unregisterMonitor();
      94              :         std::string getDispatcherStatus();
      95              : 
      96              :         std::size_t timeoutInUsecs_;
      97              :         std::chrono::steady_clock::time_point last_received_data_;
      98              :         std::chrono::steady_clock::time_point last_report_;
      99              :         std::unique_ptr<TransferInterface> transfer_;
     100              :         std::unique_ptr<CommanderInterface> commander_;
     101              :         const fhicl::ParameterSet pset_;
     102              :         std::string label_;
     103              :         const std::string dispatcherHost_;
     104              :         const std::string dispatcherPort_;
     105              :         const std::string serverUrl_;
     106              :         const std::size_t maxEventsBeforeInit_;
     107              :         const std::vector<int> allowedFragmentTypes_;
     108              :         const double runningStateTimeout_;
     109              :         size_t runningStateInterval_us_;
     110              :         const bool quitOnFragmentIntegrityProblem_;
     111              :         const bool multi_run_mode_;
     112              :         bool monitorRegistered_;
     113              : };  // namespace artdaq
     114              : }  // namespace artdaq
     115              : 
     116              : #endif /* artdaq_ArtModules_TransferWrapper_hh */
        

Generated by: LCOV version 2.0-1