OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
OpenDDS::DCPS::InstanceDataSampleList Class Reference

#include <InstanceDataSampleList.h>

Collaboration diagram for OpenDDS::DCPS::InstanceDataSampleList:
Collaboration graph
[legend]

Public Member Functions

 InstanceDataSampleList ()
 
 ~InstanceDataSampleList ()
 
void reset ()
 Reset to initial state. More...
 
ssize_t size () const
 
DataSampleElementhead () const
 
DataSampleElementtail () const
 
void enqueue_tail (const DataSampleElement *element)
 
bool dequeue_head (DataSampleElement *&stale)
 
bool dequeue (const DataSampleElement *stale)
 

Static Public Member Functions

static bool on_some_list (const DataSampleElement *iter)
 
static DataSampleElementnext (const DataSampleElement *iter)
 
static DataSampleElementprev (const DataSampleElement *iter)
 

Protected Attributes

DataSampleElementhead_
 The first element of the list. More...
 
DataSampleElementtail_
 The last element of the list. More...
 
ssize_t size_
 Number of elements in the list. More...
 

Detailed Description

A list of DataSampleElement pointers to be queued by the order the samples are written to the instance (within PRESENTATION.access_scope==INSTANCE). It is mainly used on the send side to count the depth of instance data and to allow the removal of elements by instance. Manages DataSampleElement's next_instance_sample pointer

Definition at line 35 of file InstanceDataSampleList.h.

Constructor & Destructor Documentation

◆ InstanceDataSampleList()

ACE_INLINE OpenDDS::DCPS::InstanceDataSampleList::InstanceDataSampleList ( )

Definition at line 17 of file InstanceDataSampleList.inl.

References ACE_INLINE.

18  : head_(0),
19  tail_(0),
20  size_(0)
21 {
22 }
DataSampleElement * tail_
The last element of the list.
DataSampleElement * head_
The first element of the list.
ssize_t size_
Number of elements in the list.

◆ ~InstanceDataSampleList()

OpenDDS::DCPS::InstanceDataSampleList::~InstanceDataSampleList ( )
inline

Definition at line 38 of file InstanceDataSampleList.h.

38 {}

Member Function Documentation

◆ dequeue()

bool OpenDDS::DCPS::InstanceDataSampleList::dequeue ( const DataSampleElement stale)

Definition at line 33 of file InstanceDataSampleList.cpp.

References dequeue_head(), head_, OpenDDS::DCPS::DataSampleElement::next_instance_sample_, OPENDDS_END_VERSIONED_NAMESPACE_DECL, OpenDDS::DCPS::DataSampleElement::previous_instance_sample_, size_, and tail_.

Referenced by OpenDDS::DCPS::WriteDataContainer::data_delivered(), and OpenDDS::DCPS::WriteDataContainer::remove_excess_durable().

34 {
35  if (head_ == 0) {
36  return false;
37  }
38 
39  if (stale == head_) {
40  DataSampleElement* tmp;
41  return dequeue_head(tmp);
42  }
43 
44  if (stale == tail_) {
47 
48  } else {
50  stale->next_instance_sample_;
53  }
54 
56  --size_;
57  return true;
58 }
DataSampleElement * tail_
The last element of the list.
DataSampleElement * previous_instance_sample_
DataSampleElement * head_
The first element of the list.
DataSampleElement * next_instance_sample_
Thread of data within the instance.
bool dequeue_head(DataSampleElement *&stale)
ssize_t size_
Number of elements in the list.

◆ dequeue_head()

ACE_INLINE bool OpenDDS::DCPS::InstanceDataSampleList::dequeue_head ( DataSampleElement *&  stale)

Definition at line 94 of file InstanceDataSampleList.inl.

References head_, OpenDDS::DCPS::DataSampleElement::next_instance_sample_, OPENDDS_END_VERSIONED_NAMESPACE_DECL, OpenDDS::DCPS::DataSampleElement::previous_instance_sample_, size_, and tail_.

Referenced by dequeue(), and OpenDDS::DCPS::WriteDataContainer::remove_oldest_sample().

95 {
96  //
97  // Remove the oldest sample from the instance list.
98  //
99  stale = head_;
100 
101  if (head_ == 0) {
102  // try to dequeue empty instance list.
103  return false;
104 
105  } else {
106  --size_;
108 
109  if (head_ == 0) {
110  tail_ = 0;
111  } else {
113  }
114 
115  stale->next_instance_sample_ = 0;
116  return true;
117  }
118 }
DataSampleElement * tail_
The last element of the list.
DataSampleElement * previous_instance_sample_
DataSampleElement * head_
The first element of the list.
DataSampleElement * next_instance_sample_
Thread of data within the instance.
ssize_t size_
Number of elements in the list.

◆ enqueue_tail()

ACE_INLINE void OpenDDS::DCPS::InstanceDataSampleList::enqueue_tail ( const DataSampleElement element)

Definition at line 68 of file InstanceDataSampleList.inl.

References ACE_INLINE, head_, OpenDDS::DCPS::DataSampleElement::next_instance_sample_, OpenDDS::DCPS::DataSampleElement::previous_instance_sample_, size_, and tail_.

Referenced by OpenDDS::DCPS::WriteDataContainer::enqueue().

69 {
70  // const_cast here so that higher layers don't need to pass around so many
71  // non-const pointers to DataSampleElement. Ideally the design would be
72  // changed to accommodate const-correctness throughout.
73  DataSampleElement* mSample = const_cast<DataSampleElement*>(sample);
74 
75  mSample->next_instance_sample_ = 0;
76 
77  ++size_;
78 
79  if (head_ == 0) {
80  // First sample on queue.
81  head_ = tail_ = mSample;
82  mSample->previous_instance_sample_ = 0;
83 
84  } else {
85  // Another sample on an existing queue.
86  tail_->next_instance_sample_ = mSample;
88  tail_ = mSample;
89  }
90 }
DataSampleElement * tail_
The last element of the list.
DataSampleElement * previous_instance_sample_
DataSampleElement * head_
The first element of the list.
DataSampleElement * next_instance_sample_
Thread of data within the instance.
ssize_t size_
Number of elements in the list.

◆ head()

ACE_INLINE DataSampleElement * OpenDDS::DCPS::InstanceDataSampleList::head ( void  ) const

Definition at line 40 of file InstanceDataSampleList.inl.

References ACE_INLINE, and head_.

41 {
42  return head_;
43 }
DataSampleElement * head_
The first element of the list.

◆ next()

ACE_INLINE DataSampleElement * OpenDDS::DCPS::InstanceDataSampleList::next ( const DataSampleElement iter)
static

Definition at line 54 of file InstanceDataSampleList.inl.

References ACE_INLINE, and OpenDDS::DCPS::DataSampleElement::next_instance_sample_.

55 {
56  return iter->next_instance_sample_;
57 }

◆ on_some_list()

bool OpenDDS::DCPS::InstanceDataSampleList::on_some_list ( const DataSampleElement iter)
static

Definition at line 26 of file InstanceDataSampleList.cpp.

References OpenDDS::DCPS::DataSampleElement::handle_, head_, OpenDDS::DCPS::DataSampleElement::next_instance_sample_, OpenDDS::DCPS::DataSampleElement::previous_instance_sample_, and OpenDDS::DCPS::PublicationInstance::samples_.

Referenced by OpenDDS::DCPS::WriteDataContainer::data_delivered(), and OpenDDS::DCPS::WriteDataContainer::data_dropped().

27 {
28  return iter->next_instance_sample_ || iter->previous_instance_sample_
29  || (iter->handle_ && iter->handle_->samples_.head_ == iter);
30 }

◆ prev()

ACE_INLINE DataSampleElement * OpenDDS::DCPS::InstanceDataSampleList::prev ( const DataSampleElement iter)
static

Definition at line 61 of file InstanceDataSampleList.inl.

References ACE_INLINE, and OpenDDS::DCPS::DataSampleElement::previous_instance_sample_.

Referenced by OpenDDS::DCPS::WriteDataContainer::remove_excess_durable().

62 {
63  return iter->previous_instance_sample_;
64 }

◆ reset()

ACE_INLINE void OpenDDS::DCPS::InstanceDataSampleList::reset ( void  )

Reset to initial state.

Definition at line 25 of file InstanceDataSampleList.inl.

References ACE_INLINE, head_, size_, and tail_.

26 {
27  head_ = tail_ = 0;
28  size_ = 0;
29 }
DataSampleElement * tail_
The last element of the list.
DataSampleElement * head_
The first element of the list.
ssize_t size_
Number of elements in the list.

◆ size()

ACE_INLINE ssize_t OpenDDS::DCPS::InstanceDataSampleList::size ( void  ) const

Definition at line 33 of file InstanceDataSampleList.inl.

References ACE_INLINE, and size_.

Referenced by OpenDDS::DCPS::WriteDataContainer::num_samples(), and OpenDDS::DCPS::WriteDataContainer::remove_instance().

34 {
35  return size_;
36 }
ssize_t size_
Number of elements in the list.

◆ tail()

ACE_INLINE DataSampleElement * OpenDDS::DCPS::InstanceDataSampleList::tail ( void  ) const

Definition at line 47 of file InstanceDataSampleList.inl.

References ACE_INLINE, and tail_.

Referenced by OpenDDS::DCPS::WriteDataContainer::remove_excess_durable().

48 {
49  return tail_;
50 }
DataSampleElement * tail_
The last element of the list.

Member Data Documentation

◆ head_

DataSampleElement* OpenDDS::DCPS::InstanceDataSampleList::head_
protected

The first element of the list.

Definition at line 60 of file InstanceDataSampleList.h.

Referenced by dequeue(), dequeue_head(), enqueue_tail(), head(), on_some_list(), and reset().

◆ size_

ssize_t OpenDDS::DCPS::InstanceDataSampleList::size_
protected

Number of elements in the list.

Definition at line 66 of file InstanceDataSampleList.h.

Referenced by dequeue(), dequeue_head(), enqueue_tail(), reset(), and size().

◆ tail_

DataSampleElement* OpenDDS::DCPS::InstanceDataSampleList::tail_
protected

The last element of the list.

Definition at line 63 of file InstanceDataSampleList.h.

Referenced by dequeue(), dequeue_head(), enqueue_tail(), reset(), and tail().


The documentation for this class was generated from the following files: