InstanceDataSampleList.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 "InstanceDataSampleList.h"
00010 #include "DataSampleElement.h"
00011 #include "Definitions.h"
00012 #include "PublicationInstance.h"
00013 
00014 #include "dds/DCPS/transport/framework/TransportSendListener.h"
00015 
00016 #if !defined (__ACE_INLINE__)
00017 #include "InstanceDataSampleList.inl"
00018 #endif /* __ACE_INLINE__ */
00019 
00020 namespace OpenDDS {
00021 namespace DCPS {
00022 
00023 
00024 bool
00025 InstanceDataSampleList::dequeue(const DataSampleElement* stale)
00026 {
00027   if (head_ == 0) {
00028     return false;
00029   }
00030 
00031   // Same as dequeue from head.
00032   if (stale == head_) {
00033     DataSampleElement* tmp = head_;
00034     return dequeue_head(tmp);
00035   }
00036 
00037   // Search from head_->next_instance_sample_.
00038   DataSampleElement* previous = head_;
00039   DataSampleElement* item;
00040   for (item = head_->next_instance_sample_;
00041        item != 0;
00042        item = item->next_instance_sample_) {
00043     if (item == stale) {
00044       previous->next_instance_sample_ = item->next_instance_sample_;
00045       if (previous->next_instance_sample_ == 0) {
00046         tail_ = previous;
00047       }
00048       --size_ ;
00049       item->next_instance_sample_ = 0;
00050       break;
00051     }
00052 
00053     previous = item;
00054   }
00055 
00056   return item;
00057 }
00058 
00059 
00060 } // namespace DCPS
00061 } // namespace OpenDDS

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