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

#include <ThreadPerConRemoveVisitor.h>

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

Public Member Functions

 ThreadPerConRemoveVisitor (const ACE_Message_Block *sample)
 
virtual ~ThreadPerConRemoveVisitor ()
 
virtual int visit_element_remove (SendRequest *element, int &remove)
 
RemoveResult status () const
 True if the visitor found and removed the sample. More...
 
- Public Member Functions inherited from OpenDDS::DCPS::BasicQueueVisitor< SendRequest >
 BasicQueueVisitor ()
 
virtual ~BasicQueueVisitor ()
 
virtual int visit_element (SendRequest *element)
 
virtual int visit_element_ref (SendRequest *&element)
 

Private Attributes

const ACE_Message_Blocksample_
 The sample that needs to be removed. More...
 
RemoveResult status_
 Holds the status of our visit. More...
 

Detailed Description

Definition at line 22 of file ThreadPerConRemoveVisitor.h.

Constructor & Destructor Documentation

◆ ThreadPerConRemoveVisitor()

ACE_INLINE OpenDDS::DCPS::ThreadPerConRemoveVisitor::ThreadPerConRemoveVisitor ( const ACE_Message_Block sample)
explicit

In order to construct a QueueRemoveVisitor, it must be provided with the DataSampleElement* (used as an identifier) that should be removed from the BasicQueue<T> (the one this visitor will visit when it is passed-in to a BasicQueue<T>::accept_remove_visitor() invocation).

Definition at line 11 of file ThreadPerConRemoveVisitor.inl.

References ACE_INLINE, and DBG_ENTRY.

13  : sample_(sample)
15 {
16  DBG_ENTRY("ThreadPerConRemoveVisitor", "ThreadPerConRemoveVisitor");
17 }
const ACE_Message_Block * sample_
The sample that needs to be removed.
#define DBG_ENTRY(CNAME, MNAME)
Definition: EntryExit.h:72
RemoveResult status_
Holds the status of our visit.

◆ ~ThreadPerConRemoveVisitor()

OpenDDS::DCPS::ThreadPerConRemoveVisitor::~ThreadPerConRemoveVisitor ( )
virtual

Definition at line 22 of file ThreadPerConRemoveVisitor.cpp.

References DBG_ENTRY.

23 {
24  DBG_ENTRY("ThreadPerConRemoveVisitor", "~ThreadPerConRemoveVisitor");
25 }
#define DBG_ENTRY(CNAME, MNAME)
Definition: EntryExit.h:72

Member Function Documentation

◆ status()

ACE_INLINE OpenDDS::DCPS::RemoveResult OpenDDS::DCPS::ThreadPerConRemoveVisitor::status ( void  ) const

True if the visitor found and removed the sample.

Definition at line 20 of file ThreadPerConRemoveVisitor.inl.

References DBG_ENTRY, and status_.

Referenced by OpenDDS::DCPS::ThreadPerConnectionSendTask::remove_sample().

21 {
22  DBG_ENTRY("ThreadPerConRemoveVisitor", "status");
23  return this->status_;
24 }
#define DBG_ENTRY(CNAME, MNAME)
Definition: EntryExit.h:72
RemoveResult status_
Holds the status of our visit.

◆ visit_element_remove()

int OpenDDS::DCPS::ThreadPerConRemoveVisitor::visit_element_remove ( SendRequest 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< SendRequest >.

Definition at line 28 of file ThreadPerConRemoveVisitor.cpp.

References OpenDDS::DCPS::TransportQueueElement::data_dropped(), DBG_ENTRY, OpenDDS::DCPS::SendRequest::element_, OpenDDS::DCPS::SendRequest::op_, OPENDDS_END_VERSIONED_NAMESPACE_DECL, ACE_Message_Block::rd_ptr(), OpenDDS::DCPS::REMOVE_FOUND, OpenDDS::DCPS::REMOVE_RELEASED, sample_, OpenDDS::DCPS::SEND, and status_.

30 {
31  DBG_ENTRY("ThreadPerConRemoveVisitor", "visit_element_remove");
32 
33  TransportQueueElement::MatchOnDataPayload modp(sample_->rd_ptr());
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 }
char * rd_ptr(void) const
const ACE_Message_Block * sample_
The sample that needs to be removed.
#define DBG_ENTRY(CNAME, MNAME)
Definition: EntryExit.h:72
RemoveResult status_
Holds the status of our visit.

Member Data Documentation

◆ sample_

const ACE_Message_Block* OpenDDS::DCPS::ThreadPerConRemoveVisitor::sample_
private

The sample that needs to be removed.

Definition at line 46 of file ThreadPerConRemoveVisitor.h.

Referenced by visit_element_remove().

◆ status_

RemoveResult OpenDDS::DCPS::ThreadPerConRemoveVisitor::status_
private

Holds the status of our visit.

Definition at line 49 of file ThreadPerConRemoveVisitor.h.

Referenced by status(), and visit_element_remove().


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