OpenDDS  Snapshot(2023/04/28-20:55)
ThreadPerConRemoveVisitor.cpp
Go to the documentation of this file.
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/
10 #include "TransportQueueElement.h"
12 
13 #if !defined (__ACE_INLINE__)
15 #endif /* __ACE_INLINE__ */
16 
18 
19 namespace OpenDDS {
20 namespace DCPS {
21 
23 {
24  DBG_ENTRY("ThreadPerConRemoveVisitor", "~ThreadPerConRemoveVisitor");
25 }
26 
27 int
29  int& remove)
30 {
31  DBG_ENTRY("ThreadPerConRemoveVisitor", "visit_element_remove");
32 
34  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  remove = 1;
43 
44  // Inform the element that we've made a decision - and it is
45  // data_dropped()
46  const bool released = req->element_->data_dropped();
47 
48  // Adjust our status_ to indicate that we actually found (and removed)
49  // the sample.
50  status_ = released ? REMOVE_RELEASED : REMOVE_FOUND;
51 
52  // Stop visitation since we've handled the element that matched
53  // our sample_.
54  return 0;
55  }
56 
57  // Continue visitation.
58  return 1;
59 }
60 
61 }
62 }
63 
bool data_dropped(bool dropped_by_transport=false)
char * rd_ptr(void) const
virtual int visit_element_remove(SendRequest *element, int &remove)
#define DBG_ENTRY(CNAME, MNAME)
Definition: EntryExit.h:72
const ACE_Message_Block * sample_
The sample that needs to be removed.
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
RemoveResult status_
Holds the status of our visit.
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28