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 "RemoveAllVisitor.h" 10 : #include "TransportQueueElement.h" 11 : 12 : #if !defined (__ACE_INLINE__) 13 : #include "RemoveAllVisitor.inl" 14 : #endif /* __ACE_INLINE__ */ 15 : 16 4 : OpenDDS::DCPS::RemoveAllVisitor::~RemoveAllVisitor() 17 : { 18 : DBG_ENTRY_LVL("RemoveAllVisitor", "~RemoveAllVisitor", 6); 19 4 : } 20 : 21 : int 22 4 : OpenDDS::DCPS::RemoveAllVisitor::visit_element_remove(TransportQueueElement* element, 23 : int& remove) 24 : { 25 : DBG_ENTRY_LVL("RemoveAllVisitor", "visit_element_remove", 6); 26 : 27 : // Always remove the element passed in. Always set the remove flag 28 : // to true (1). The BasicQueue<T> will perform the actual removal 29 : // once we return from this method. 30 4 : remove = 1; 31 : 32 : // Add the total_length() of the element->msg() chain to our 33 : // removed_bytes_ (running) total. 34 4 : if (element->msg()) { 35 4 : removed_bytes_ += element->msg()->total_length(); 36 : } 37 : 38 : // Inform the element that we've made a decision - and it is 39 : // data_dropped() 40 : // This visitor is used in TransportSendStrategy::clear and 41 : // TransportSendBuffer::release. In formal case, the sample 42 : // is dropped by transport. In the later case, the 43 : // dropped_by_transport is not used as the sample is cloned 44 : // and no callback is made to writer. 45 4 : element->data_dropped(true); 46 : 47 : // Adjust our status_ to indicate that we actually found (and removed) 48 : // the sample. 49 4 : status_ = 1; 50 : 51 : // Continue visitation. 52 4 : return 1; 53 : }