RemoveAllVisitor.cpp

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/
00009 #include "RemoveAllVisitor.h"
00010 #include "TransportQueueElement.h"
00011 
00012 #if !defined (__ACE_INLINE__)
00013 #include "RemoveAllVisitor.inl"
00014 #endif /* __ACE_INLINE__ */
00015 
00016 OpenDDS::DCPS::RemoveAllVisitor::~RemoveAllVisitor()
00017 {
00018   DBG_ENTRY_LVL("RemoveAllVisitor","~RemoveAllVisitor",6);
00019 }
00020 
00021 int
00022 OpenDDS::DCPS::RemoveAllVisitor::visit_element_remove(TransportQueueElement* element,
00023                                                       int&                   remove)
00024 {
00025   DBG_ENTRY_LVL("RemoveAllVisitor","visit_element_remove",6);
00026 
00027   // Always remove the element passed in. Always set the remove flag
00028   // to true (1).  The BasicQueue<T> will perform the actual removal
00029   // once we return from this method.
00030   remove = 1;
00031 
00032   // Add the total_length() of the element->msg() chain to our
00033   // removed_bytes_ (running) total.
00034   if (element->msg()) {
00035     this->removed_bytes_ += element->msg()->total_length();
00036   }
00037 
00038   // Inform the element that we've made a decision - and it is
00039   // data_dropped()
00040   // This visitor is used in TransportSendStrategy::clear and
00041   // TransportSendBuffer::release. In formal case, the sample
00042   // is dropped by transport. In the later case, the
00043   // dropped_by_transport is not used as the sample is cloned
00044   // and no callback is made to writer.
00045   element->data_dropped(true);
00046 
00047   // Adjust our status_ to indicate that we actually found (and removed)
00048   // the sample.
00049   this->status_ = 1;
00050 
00051   // Continue visitation.
00052   return 1;
00053 }

Generated on Fri Feb 12 20:05:25 2016 for OpenDDS by  doxygen 1.4.7