Line data Source code
1 : /* 2 : * 3 : * 4 : * Distributed under the OpenDDS License. 5 : * See: http://www.opendds.org/license.html 6 : */ 7 : 8 : #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/ 9 : #include "WriterDataSampleList.h" 10 : #include "DataSampleElement.h" 11 : 12 : #if !defined (__ACE_INLINE__) 13 : #include "WriterDataSampleList.inl" 14 : #endif /* __ACE_INLINE__ */ 15 : 16 : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 17 : 18 : namespace OpenDDS { 19 : namespace DCPS { 20 : 21 : bool 22 0 : WriterDataSampleList::dequeue(const DataSampleElement* stale) 23 : { 24 0 : if (head_ == 0) { 25 0 : return false; 26 : } 27 : 28 0 : if (stale == head_) { 29 0 : DataSampleElement* head = head_; 30 0 : return dequeue_head(head); 31 : } 32 : 33 : // Search from head_->next_writer_sample_. 34 0 : bool found = false; 35 : 36 0 : for (DataSampleElement* item = head_->next_writer_sample_; 37 0 : item != 0; 38 0 : item = item->next_writer_sample_) { 39 0 : if (item == stale) { 40 0 : found = true; 41 0 : break; 42 : } 43 : } 44 : 45 0 : if (found) { 46 : // Adjust list size. 47 0 : -- size_ ; 48 : 49 : // 50 : // Remove from the previous element. 51 : // 52 0 : stale->previous_writer_sample_->next_writer_sample_ = stale->next_writer_sample_ ; 53 : 54 : // 55 : // Remove from the next element. 56 : // 57 0 : if (stale->next_writer_sample_ != 0) { 58 : // Remove the inside of the list. 59 0 : stale->next_writer_sample_->previous_writer_sample_ = stale->previous_writer_sample_ ; 60 : 61 : } else { 62 : // Remove from the tail of the list. 63 0 : tail_ = stale->previous_writer_sample_ ; 64 : } 65 : 66 0 : stale->next_writer_sample_ = 0; 67 0 : stale->previous_writer_sample_ = 0; 68 : } 69 : 70 0 : return found; 71 : } 72 : 73 : 74 : } // namespace DCPS 75 : } // namespace OpenDDS 76 : 77 : OPENDDS_END_VERSIONED_NAMESPACE_DECL