OpenDDS  Snapshot(2023/04/28-20:55)
RemoveAllVisitor.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/
9 #include "RemoveAllVisitor.h"
10 #include "TransportQueueElement.h"
11 
12 #if !defined (__ACE_INLINE__)
13 #include "RemoveAllVisitor.inl"
14 #endif /* __ACE_INLINE__ */
15 
17 {
18  DBG_ENTRY_LVL("RemoveAllVisitor", "~RemoveAllVisitor", 6);
19 }
20 
21 int
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  remove = 1;
31 
32  // Add the total_length() of the element->msg() chain to our
33  // removed_bytes_ (running) total.
34  if (element->msg()) {
35  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  element->data_dropped(true);
46 
47  // Adjust our status_ to indicate that we actually found (and removed)
48  // the sample.
49  status_ = 1;
50 
51  // Continue visitation.
52  return 1;
53 }
virtual int visit_element_remove(TransportQueueElement *element, int &remove)
bool data_dropped(bool dropped_by_transport=false)
int status_
Holds the status of our visit.
size_t total_length(void) const
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68
Base wrapper class around a data/control sample to be sent.
virtual const ACE_Message_Block * msg() const =0
The marshalled sample (sample header + sample data)