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 "ThreadPerConRemoveVisitor.h" 10 : #include "TransportQueueElement.h" 11 : #include "TransportRetainedElement.h" 12 : 13 : #if !defined (__ACE_INLINE__) 14 : #include "ThreadPerConRemoveVisitor.inl" 15 : #endif /* __ACE_INLINE__ */ 16 : 17 : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 18 : 19 : namespace OpenDDS { 20 : namespace DCPS { 21 : 22 0 : ThreadPerConRemoveVisitor::~ThreadPerConRemoveVisitor() 23 : { 24 : DBG_ENTRY("ThreadPerConRemoveVisitor", "~ThreadPerConRemoveVisitor"); 25 0 : } 26 : 27 : int 28 0 : ThreadPerConRemoveVisitor::visit_element_remove(SendRequest* req, 29 : int& remove) 30 : { 31 : DBG_ENTRY("ThreadPerConRemoveVisitor", "visit_element_remove"); 32 : 33 0 : TransportQueueElement::MatchOnDataPayload modp(sample_->rd_ptr()); 34 0 : if ((req->op_ == SEND) && modp.matches(*req->element_)) { 35 : // We are visiting the element that we want to remove, since the 36 : // element "matches" our sample_. 37 : 38 : // In order to have the BasicQueue<T> remove the element that we 39 : // are currently visiting, set the remove flag to true (1). The 40 : // BasicQueue<T> will perform the actual removal once we return 41 : // from this method. 42 0 : remove = 1; 43 : 44 : // Inform the element that we've made a decision - and it is 45 : // data_dropped() 46 0 : const bool released = req->element_->data_dropped(); 47 : 48 : // Adjust our status_ to indicate that we actually found (and removed) 49 : // the sample. 50 0 : status_ = released ? REMOVE_RELEASED : REMOVE_FOUND; 51 : 52 : // Stop visitation since we've handled the element that matched 53 : // our sample_. 54 0 : return 0; 55 : } 56 : 57 : // Continue visitation. 58 0 : return 1; 59 0 : } 60 : 61 : } 62 : } 63 : 64 : OPENDDS_END_VERSIONED_NAMESPACE_DECL