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

          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 "CopyChainVisitor.h"
      10             : #include "TransportQueueElement.h"
      11             : 
      12             : #if !defined (__ACE_INLINE__)
      13             : #include "CopyChainVisitor.inl"
      14             : #endif /* __ACE_INLINE__ */
      15             : 
      16           2 : OpenDDS::DCPS::CopyChainVisitor::~CopyChainVisitor()
      17             : {
      18             :   DBG_ENTRY_LVL("CopyChainVisitor", "~CopyChainVisitor", 6);
      19           2 : }
      20             : 
      21             : int
      22           2 : OpenDDS::DCPS::CopyChainVisitor::visit_element(TransportQueueElement* element)
      23             : {
      24             :   DBG_ENTRY_LVL("CopyChainVisitor", "visit_element", 6);
      25             : 
      26           2 :   TransportRetainedElement* copiedElement = 0;
      27           2 :   if (duplicate_) {
      28             :     // Create a new copy of the current element.
      29           1 :     copiedElement = new
      30             :       TransportRetainedElement(
      31           1 :         element->duplicate_msg(),
      32           2 :         element->publication_id()
      33           1 :       );
      34             :   } else {
      35             :     // Create a new copy of the current element.
      36           1 :     copiedElement = new
      37             :       TransportRetainedElement(
      38           1 :         element->msg(),
      39           2 :         element->publication_id(),
      40             :         mb_allocator_,
      41             :         db_allocator_
      42           1 :       );
      43             :   }
      44             : 
      45             :   // Add the copy to the target.
      46           2 :   target_.put(copiedElement);
      47             : 
      48             :   // Visit entire queue.
      49           2 :   return 1;
      50             : }

Generated by: LCOV version 1.16