#include <QueueRemoveVisitor.h>
Inheritance diagram for OpenDDS::DCPS::QueueRemoveVisitor:
Public Member Functions | |
QueueRemoveVisitor (const TransportQueueElement::MatchCriteria &mc) | |
virtual | ~QueueRemoveVisitor () |
virtual int | visit_element_remove (TransportQueueElement *element, int &remove) |
RemoveResult | status () const |
int | removed_bytes () const |
Private Attributes | |
const TransportQueueElement::MatchCriteria & | mc_ |
Criteria object describing the Queue Element that needs to be removed. | |
RemoveResult | status_ |
Holds the status of our visit. | |
size_t | removed_bytes_ |
Definition at line 24 of file QueueRemoveVisitor.h.
ACE_INLINE OpenDDS::DCPS::QueueRemoveVisitor::QueueRemoveVisitor | ( | const TransportQueueElement::MatchCriteria & | mc | ) | [explicit] |
Definition at line 14 of file QueueRemoveVisitor.inl.
References DBG_ENTRY_LVL.
00016 : mc_(mc) 00017 , status_(REMOVE_NOT_FOUND) 00018 , removed_bytes_(0) 00019 { 00020 DBG_ENTRY_LVL("QueueRemoveVisitor", "QueueRemoveVisitor", 6); 00021 }
OpenDDS::DCPS::QueueRemoveVisitor::~QueueRemoveVisitor | ( | ) | [virtual] |
Definition at line 19 of file QueueRemoveVisitor.cpp.
References DBG_ENTRY_LVL.
00020 { 00021 DBG_ENTRY_LVL("QueueRemoveVisitor", "~QueueRemoveVisitor", 6); 00022 }
ACE_INLINE int OpenDDS::DCPS::QueueRemoveVisitor::removed_bytes | ( | ) | const |
Definition at line 31 of file QueueRemoveVisitor.inl.
References DBG_ENTRY_LVL, and removed_bytes_.
Referenced by OpenDDS::DCPS::TransportSendStrategy::do_remove_sample().
00032 { 00033 DBG_ENTRY_LVL("QueueRemoveVisitor", "removed_bytes", 6); 00034 return static_cast<int>(this->removed_bytes_); 00035 }
ACE_INLINE RemoveResult OpenDDS::DCPS::QueueRemoveVisitor::status | ( | ) | const |
Accessor for the status. Called after this visitor object has been passed to BasicQueue<T>::accept_remove_visitor().
Definition at line 24 of file QueueRemoveVisitor.inl.
References DBG_ENTRY_LVL, and status_.
Referenced by OpenDDS::DCPS::TransportSendStrategy::do_remove_sample().
00025 { 00026 DBG_ENTRY_LVL("QueueRemoveVisitor", "status", 6); 00027 return this->status_; 00028 }
int OpenDDS::DCPS::QueueRemoveVisitor::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.
Definition at line 25 of file QueueRemoveVisitor.cpp.
References OpenDDS::DCPS::TransportQueueElement::data_dropped(), DBG_ENTRY_LVL, OpenDDS::DCPS::TransportQueueElement::msg(), OpenDDS::DCPS::REMOVE_FOUND, OpenDDS::DCPS::REMOVE_RELEASED, removed_bytes_, and status_.
00027 { 00028 DBG_ENTRY_LVL("QueueRemoveVisitor", "visit_element_remove", 6); 00029 00030 if (this->mc_.matches(*element)) { 00031 // We are visiting the element that we want to remove, since the 00032 // element "matches" our sample_. 00033 00034 // In order to have the BasicQueue<T> remove the element that we 00035 // are currently visiting, set the remove flag to true (1). The 00036 // BasicQueue<T> will perform the actual removal once we return 00037 // from this method. 00038 remove = 1; 00039 00040 // Add the total_length() of the element->msg() chain to our 00041 // removed_bytes_ (running) total. 00042 this->removed_bytes_ += element->msg()->total_length(); 00043 00044 // Inform the element that we've made a decision - and it is 00045 // data_dropped() by transport. 00046 // This visitor is used in TransportSendStrategy::do_remove_sample 00047 // The dropped_by_transport flag should be false(default) as the 00048 // data_dropped is resulted from writer's remove_sample call. 00049 const bool released = element->data_dropped(); 00050 00051 // Adjust our status_ to indicate that we actually found (and removed) 00052 // the sample. 00053 this->status_ = released ? REMOVE_RELEASED : REMOVE_FOUND; 00054 00055 if (released || this->mc_.unique()) { 00056 // Stop visitation since we've handled the element that matched 00057 // our sample_. 00058 // N.B. This unique() test means that if we are comparing by sample, we 00059 // remove just the single element matching the sample, but if 00060 // we are comparing by publication Id value, we visit the 00061 // entire chain and remove all samples originating from that 00062 // publication Id. 00063 return 0; 00064 } 00065 } 00066 00067 // Continue visitation. 00068 return 1; 00069 }
Criteria object describing the Queue Element that needs to be removed.
Definition at line 46 of file QueueRemoveVisitor.h.
size_t OpenDDS::DCPS::QueueRemoveVisitor::removed_bytes_ [private] |
Definition at line 51 of file QueueRemoveVisitor.h.
Referenced by removed_bytes(), and visit_element_remove().
Holds the status of our visit.
Definition at line 49 of file QueueRemoveVisitor.h.
Referenced by status(), and visit_element_remove().