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 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00018 00019 namespace OpenDDS { 00020 namespace DCPS { 00021 00022 ThreadPerConRemoveVisitor::~ThreadPerConRemoveVisitor() 00023 { 00024 DBG_ENTRY("ThreadPerConRemoveVisitor", "~ThreadPerConRemoveVisitor"); 00025 } 00026 00027 int 00028 ThreadPerConRemoveVisitor::visit_element_remove(SendRequest* req, 00029 int& remove) 00030 { 00031 DBG_ENTRY("ThreadPerConRemoveVisitor", "visit_element_remove"); 00032 00033 TransportQueueElement::MatchOnDataPayload modp(this->sample_->rd_ptr()); 00034 if ((req->op_ == SEND) && modp.matches(*req->element_)) { 00035 // We are visiting the element that we want to remove, since the 00036 // element "matches" our sample_. 00037 00038 // In order to have the BasicQueue<T> remove the element that we 00039 // are currently visiting, set the remove flag to true (1). The 00040 // BasicQueue<T> will perform the actual removal once we return 00041 // from this method. 00042 remove = 1; 00043 00044 // Inform the element that we've made a decision - and it is 00045 // data_dropped() 00046 const bool released = req->element_->data_dropped(); 00047 00048 // Adjust our status_ to indicate that we actually found (and removed) 00049 // the sample. 00050 this->status_ = released ? REMOVE_RELEASED : REMOVE_FOUND; 00051 00052 // Stop visitation since we've handled the element that matched 00053 // our sample_. 00054 return 0; 00055 } 00056 00057 // Continue visitation. 00058 return 1; 00059 } 00060 00061 } 00062 } 00063 00064 OPENDDS_END_VERSIONED_NAMESPACE_DECL