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]
List of all members.

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.

Private Attributes

const ACE_Message_Block * sample_
 The sample that needs to be removed.
RemoveResult status_
 Holds the status of our visit.

Detailed Description

Definition at line 20 of file ThreadPerConRemoveVisitor.h.


Constructor & Destructor Documentation

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 DBG_ENTRY.

00013   : sample_(sample)
00014   , status_(REMOVE_NOT_FOUND)
00015 {
00016   DBG_ENTRY("ThreadPerConRemoveVisitor", "ThreadPerConRemoveVisitor");
00017 }

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

Definition at line 20 of file ThreadPerConRemoveVisitor.cpp.

References DBG_ENTRY.

00021 {
00022   DBG_ENTRY("ThreadPerConRemoveVisitor", "~ThreadPerConRemoveVisitor");
00023 }


Member Function Documentation

ACE_INLINE OpenDDS::DCPS::RemoveResult OpenDDS::DCPS::ThreadPerConRemoveVisitor::status (  )  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().

00021 {
00022   DBG_ENTRY("ThreadPerConRemoveVisitor", "status");
00023   return this->status_;
00024 }

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.

Definition at line 26 of file ThreadPerConRemoveVisitor.cpp.

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

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


Member Data Documentation

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

The sample that needs to be removed.

Definition at line 44 of file ThreadPerConRemoveVisitor.h.

RemoveResult OpenDDS::DCPS::ThreadPerConRemoveVisitor::status_ [private]

Holds the status of our visit.

Definition at line 47 of file ThreadPerConRemoveVisitor.h.

Referenced by status(), and visit_element_remove().


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:29 2016 for OpenDDS by  doxygen 1.4.7