LCOV - code coverage report
Current view: top level - artdaq/RoutingPolicies - NoOp_policy.cc (source / functions) Coverage Total Hit
Test: artdaq.info.cleaned Lines: 0.0 % 20 0
Test Date: 2025-09-04 00:45:34 Functions: 0.0 % 6 0

            Line data    Source code
       1              : #define TRACE_NAME "NoOp_policy"
       2              : #include "TRACE/tracemf.h"
       3              : 
       4              : #include <utility>
       5              : 
       6              : #include "artdaq/RoutingPolicies/PolicyMacros.hh"
       7              : #include "artdaq/RoutingPolicies/RoutingManagerPolicy.hh"
       8              : 
       9              : #include "fhiclcpp/ParameterSet.h"
      10              : 
      11              : namespace artdaq {
      12              : /**
      13              :  * \brief A RoutingManagerPolicy which simply assigns Sequence IDs to tokens in the order they were received
      14              :  */
      15              : class NoOpPolicy : public RoutingManagerPolicy
      16              : {
      17              : public:
      18              :         /**
      19              :          * \brief NoOpPolicy Constructor
      20              :          * \param ps ParameterSet used to configure the NoOpPolicy
      21              :          *
      22              :          * NoOpPolicy takes no additional Parameters at this time
      23              :          */
      24            0 :         explicit NoOpPolicy(fhicl::ParameterSet const& ps)
      25            0 :             : RoutingManagerPolicy(ps)
      26              :         {
      27            0 :         }
      28              : 
      29              :         /**
      30              :          * \brief Default virtual Destructor
      31              :          */
      32            0 :         ~NoOpPolicy() override = default;
      33              : 
      34              :         /**
      35              :          * @brief Add entries to the given RoutingPacket using currently-held tokens
      36              :          * @param table RoutingPacket to add entries to
      37              :          *
      38              :          * NoOp_policy will add entries for all tokens in the order that they were received
      39              :          */
      40              :         void CreateRoutingTable(detail::RoutingPacket& table) override;
      41              :         /**
      42              :          * @brief Get an artdaq::detail::RoutingPacketEntry for a given sequence ID and rank. Used by RequestBasedEventBuilder and DataFlow RoutingManagerMode
      43              :          * @param seq Sequence Number to get route for
      44              :          * @param requesting_rank Rank to route for
      45              :          * @return artdaq::detail::RoutingPacketEntry connecting sequence ID to destination rank
      46              :          */
      47              :         detail::RoutingPacketEntry CreateRouteForSequenceID(artdaq::Fragment::sequence_id_t seq, int requesting_rank) override;
      48              : 
      49              : private:
      50              :         NoOpPolicy(NoOpPolicy const&) = delete;
      51              :         NoOpPolicy(NoOpPolicy&&) = delete;
      52              :         NoOpPolicy& operator=(NoOpPolicy const&) = delete;
      53              :         NoOpPolicy& operator=(NoOpPolicy&&) = delete;
      54              : };
      55              : 
      56            0 : void NoOpPolicy::CreateRoutingTable(detail::RoutingPacket& table)
      57              : {
      58            0 :         while (!tokens_.empty())
      59              :         {
      60            0 :                 table.emplace_back(next_sequence_id_, tokens_.front());
      61            0 :                 next_sequence_id_++;
      62            0 :                 tokens_.pop_front();
      63            0 :                 tokens_used_since_last_update_++;
      64              :         }
      65            0 : }
      66              : 
      67            0 : detail::RoutingPacketEntry NoOpPolicy::CreateRouteForSequenceID(artdaq::Fragment::sequence_id_t seq, int)
      68              : {
      69            0 :         detail::RoutingPacketEntry output;
      70            0 :         if (!tokens_.empty())
      71              :         {
      72            0 :                 auto dest = tokens_.front();  // No-Op: Use first token
      73            0 :                 output = detail::RoutingPacketEntry(seq, dest);
      74            0 :                 tokens_.pop_front();
      75            0 :                 tokens_used_since_last_update_++;
      76              :         }
      77              : 
      78            0 :         return output;
      79              : }
      80              : 
      81              : }  // namespace artdaq
      82              : 
      83            0 : DEFINE_ARTDAQ_ROUTING_POLICY(artdaq::NoOpPolicy)
        

Generated by: LCOV version 2.0-1