LCOV - code coverage report
Current view: top level - DCPS/transport/framework - QueueRemoveVisitor.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 11 0.0 %
Date: 2023-04-30 01:32:43 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /*
       2             :  *
       3             :  *
       4             :  * Distributed under the OpenDDS License.
       5             :  * See: http://www.opendds.org/license.html
       6             :  */
       7             : 
       8             : #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/
       9             : #include "QueueRemoveVisitor.h"
      10             : #include "TransportQueueElement.h"
      11             : 
      12             : #if !defined (__ACE_INLINE__)
      13             : #include "QueueRemoveVisitor.inl"
      14             : #endif /* __ACE_INLINE__ */
      15             : 
      16             : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
      17             : 
      18             : namespace OpenDDS {
      19             : namespace DCPS {
      20             : 
      21           0 : QueueRemoveVisitor::~QueueRemoveVisitor()
      22             : {
      23             :   DBG_ENTRY_LVL("QueueRemoveVisitor", "~QueueRemoveVisitor", 6);
      24           0 : }
      25             : 
      26             : int
      27           0 : QueueRemoveVisitor::visit_element_remove(TransportQueueElement* element,
      28             :                                          int& remove)
      29             : {
      30             :   DBG_ENTRY_LVL("QueueRemoveVisitor", "visit_element_remove", 6);
      31             : 
      32           0 :   if (this->mc_.matches(*element)) {
      33             :     // We are visiting the element that we want to remove, since the
      34             :     // element "matches" our sample_.
      35             : 
      36             :     // In order to have the BasicQueue<T> remove the element that we
      37             :     // are currently visiting, set the remove flag to true (1).  The
      38             :     // BasicQueue<T> will perform the actual removal once we return
      39             :     // from this method.
      40           0 :     remove = 1;
      41             : 
      42             :     // Add the total_length() of the element->msg() chain to our
      43             :     // removed_bytes_ (running) total.
      44           0 :     this->removed_bytes_ += element->msg()->total_length();
      45             : 
      46             :     // Inform the element that we've made a decision - and it is
      47             :     // data_dropped() by transport.
      48             :     // This visitor is used in TransportSendStrategy::do_remove_sample
      49             :     // The dropped_by_transport flag should be false(default) as the
      50             :     // data_dropped is resulted from writer's remove_sample call.
      51           0 :     const bool released = element->data_dropped();
      52             : 
      53             :     // Adjust our status_ to indicate that we actually found (and removed)
      54             :     // the sample.
      55           0 :     this->status_ = released ? REMOVE_RELEASED : REMOVE_FOUND;
      56             : 
      57           0 :     if ((!remove_all_ && released) || this->mc_.unique()) {
      58             :       // Stop visitation since we've handled the element that matched
      59             :       // our sample_.
      60             :       // N.B. This unique() test means that if we are comparing by sample, we
      61             :       //      remove just the single element matching the sample, but if
      62             :       //      we are comparing by publication Id value, we visit the
      63             :       //      entire chain and remove all samples originating from that
      64             :       //      publication Id.
      65           0 :       return 0;
      66             :     }
      67             :   }
      68             : 
      69             :   // Continue visitation.
      70           0 :   return 1;
      71             : }
      72             : 
      73             : }
      74             : }
      75             : 
      76             : OPENDDS_END_VERSIONED_NAMESPACE_DECL

Generated by: LCOV version 1.16