OpenDDS  Snapshot(2023/04/28-20:55)
WriterDataSampleList.cpp
Go to the documentation of this file.
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 
17 
18 namespace OpenDDS {
19 namespace DCPS {
20 
21 bool
23 {
24  if (head_ == 0) {
25  return false;
26  }
27 
28  if (stale == head_) {
30  return dequeue_head(head);
31  }
32 
33  // Search from head_->next_writer_sample_.
34  bool found = false;
35 
37  item != 0;
38  item = item->next_writer_sample_) {
39  if (item == stale) {
40  found = true;
41  break;
42  }
43  }
44 
45  if (found) {
46  // Adjust list size.
47  -- size_ ;
48 
49  //
50  // Remove from the previous element.
51  //
53 
54  //
55  // Remove from the next element.
56  //
57  if (stale->next_writer_sample_ != 0) {
58  // Remove the inside of the list.
60 
61  } else {
62  // Remove from the tail of the list.
64  }
65 
66  stale->next_writer_sample_ = 0;
67  stale->previous_writer_sample_ = 0;
68  }
69 
70  return found;
71 }
72 
73 
74 } // namespace DCPS
75 } // namespace OpenDDS
76 
bool dequeue(const DataSampleElement *stale)
ssize_t size_
Number of elements in the list.
bool dequeue_head(DataSampleElement *&stale)
DataSampleElement * next_writer_sample_
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
DataSampleElement * previous_writer_sample_
Thread of all data within a DataWriter.
DataSampleElement * head_
The first element of the list.
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
DataSampleElement * tail_
The last element of the list.