OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Private Attributes | List of all members
OpenDDS::DCPS::RemoveAllVisitor Class Reference

#include <RemoveAllVisitor.h>

Inheritance diagram for OpenDDS::DCPS::RemoveAllVisitor:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::RemoveAllVisitor:
Collaboration graph
[legend]

Public Member Functions

 RemoveAllVisitor ()
 
virtual ~RemoveAllVisitor ()
 
virtual int visit_element_remove (TransportQueueElement *element, int &remove)
 
int status () const
 
int removed_bytes () const
 
- Public Member Functions inherited from OpenDDS::DCPS::BasicQueueVisitor< TransportQueueElement >
 BasicQueueVisitor ()
 
virtual ~BasicQueueVisitor ()
 
virtual int visit_element (TransportQueueElement *element)
 
virtual int visit_element_ref (TransportQueueElement *&element)
 

Private Attributes

int status_
 Holds the status of our visit. More...
 
size_t removed_bytes_
 

Detailed Description

Definition at line 21 of file RemoveAllVisitor.h.

Constructor & Destructor Documentation

◆ RemoveAllVisitor()

ACE_INLINE OpenDDS::DCPS::RemoveAllVisitor::RemoveAllVisitor ( )

Definition at line 11 of file RemoveAllVisitor.inl.

References ACE_INLINE, and DBG_ENTRY_LVL.

12  : status_(0),
14 {
15  DBG_ENTRY_LVL("RemoveAllVisitor", "RemoveAllVisitor", 6);
16 }
int status_
Holds the status of our visit.
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

◆ ~RemoveAllVisitor()

OpenDDS::DCPS::RemoveAllVisitor::~RemoveAllVisitor ( )
virtual

Definition at line 16 of file RemoveAllVisitor.cpp.

References DBG_ENTRY_LVL.

17 {
18  DBG_ENTRY_LVL("RemoveAllVisitor", "~RemoveAllVisitor", 6);
19 }
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

Member Function Documentation

◆ removed_bytes()

ACE_INLINE int OpenDDS::DCPS::RemoveAllVisitor::removed_bytes ( ) const

Definition at line 26 of file RemoveAllVisitor.inl.

References DBG_ENTRY_LVL, and removed_bytes_.

27 {
28  DBG_ENTRY_LVL("RemoveAllVisitor", "removed_bytes", 6);
29  return static_cast<int>(removed_bytes_);
30 }
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

◆ status()

ACE_INLINE int OpenDDS::DCPS::RemoveAllVisitor::status ( void  ) const

Accessor for the status. Called after this visitor object has been passed to BasicQueue<T>::accept_remove_visitor().

Definition at line 19 of file RemoveAllVisitor.inl.

References ACE_INLINE, DBG_ENTRY_LVL, and status_.

20 {
21  DBG_ENTRY_LVL("RemoveAllVisitor", "status", 6);
22  return status_;
23 }
int status_
Holds the status of our visit.
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

◆ visit_element_remove()

int OpenDDS::DCPS::RemoveAllVisitor::visit_element_remove ( TransportQueueElement element,
int &  remove 
)
virtual

The BasicQueue<T>::accept_remove_visitor() method will call this visit_element_remove() method for each element in the queue.

Reimplemented from OpenDDS::DCPS::BasicQueueVisitor< TransportQueueElement >.

Definition at line 22 of file RemoveAllVisitor.cpp.

References OpenDDS::DCPS::TransportQueueElement::data_dropped(), DBG_ENTRY_LVL, OpenDDS::DCPS::TransportQueueElement::msg(), removed_bytes_, status_, and ACE_Message_Block::total_length().

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 }
int status_
Holds the status of our visit.
#define DBG_ENTRY_LVL(CNAME, MNAME, DBG_LVL)
Definition: EntryExit.h:68

Member Data Documentation

◆ removed_bytes_

size_t OpenDDS::DCPS::RemoveAllVisitor::removed_bytes_
private

Definition at line 44 of file RemoveAllVisitor.h.

Referenced by removed_bytes(), and visit_element_remove().

◆ status_

int OpenDDS::DCPS::RemoveAllVisitor::status_
private

Holds the status of our visit.

Definition at line 42 of file RemoveAllVisitor.h.

Referenced by status(), and visit_element_remove().


The documentation for this class was generated from the following files: