00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/ 00009 #include "ThreadPerConRemoveVisitor.h" 00010 #include "TransportQueueElement.h" 00011 #include "TransportRetainedElement.h" 00012 00013 #if !defined (__ACE_INLINE__) 00014 #include "ThreadPerConRemoveVisitor.inl" 00015 #endif /* __ACE_INLINE__ */ 00016 00017 namespace OpenDDS { 00018 namespace DCPS { 00019 00020 ThreadPerConRemoveVisitor::~ThreadPerConRemoveVisitor() 00021 { 00022 DBG_ENTRY("ThreadPerConRemoveVisitor", "~ThreadPerConRemoveVisitor"); 00023 } 00024 00025 int 00026 ThreadPerConRemoveVisitor::visit_element_remove(SendRequest* req, 00027 int& remove) 00028 { 00029 DBG_ENTRY("ThreadPerConRemoveVisitor", "visit_element_remove"); 00030 00031 TransportQueueElement::MatchOnDataPayload modp(this->sample_->rd_ptr()); 00032 if ((req->op_ == SEND) && modp.matches(*req->element_)) { 00033 // We are visiting the element that we want to remove, since the 00034 // element "matches" our sample_. 00035 00036 // In order to have the BasicQueue<T> remove the element that we 00037 // are currently visiting, set the remove flag to true (1). The 00038 // BasicQueue<T> will perform the actual removal once we return 00039 // from this method. 00040 remove = 1; 00041 00042 // Inform the element that we've made a decision - and it is 00043 // data_dropped() 00044 const bool released = req->element_->data_dropped(); 00045 00046 // Adjust our status_ to indicate that we actually found (and removed) 00047 // the sample. 00048 this->status_ = released ? REMOVE_RELEASED : REMOVE_FOUND; 00049 00050 // Stop visitation since we've handled the element that matched 00051 // our sample_. 00052 return 0; 00053 } 00054 00055 // Continue visitation. 00056 return 1; 00057 } 00058 00059 } 00060 }