OpenDDS::DCPS::SendStateDataSampleList Class Reference

#include <SendStateDataSampleList.h>

Collaboration diagram for OpenDDS::DCPS::SendStateDataSampleList:

Collaboration graph
[legend]
List of all members.

Public Types

typedef SendStateDataSampleListIterator iterator
 STL-style bidirectional iterator and const-iterator types.
typedef SendStateDataSampleListConstIterator const_iterator

Public Member Functions

 SendStateDataSampleList ()
 Default constructor clears the list.
 ~SendStateDataSampleList ()
void reset ()
 Reset to initial state.
ssize_t size () const
DataSampleElementhead () const
DataSampleElementtail () const
void enqueue_tail (const DataSampleElement *element)
void enqueue_tail (SendStateDataSampleList list)
bool dequeue_head (DataSampleElement *&stale)
bool dequeue (const DataSampleElement *stale)
iterator begin ()
 Return iterator to beginning of list.
const_iterator begin () const
iterator end ()
 Return iterator to end of list.
const_iterator end () const

Static Public Member Functions

static const SendStateDataSampleListsend_list_containing_element (const DataSampleElement *element, OPENDDS_VECTOR(SendStateDataSampleList *) send_lists)

Protected Attributes

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

Friends

class ::DDS_TEST

Detailed Description

A list of DataSampleElement pointers to be queued by the order the samples are to be transmitted over the transport layer. Cache the number of elements in the list so that list traversal is not required to find this information. The Publisher may use this to maintain a list of samples to be sent with PRESENTATION.access_scope==GROUP by obtaining data from each DataWriter as it becomes available and concatenating the data in the order in which it was written. Manages DataSampleElement's previous_send_sample/next_send_sample pointers

Definition at line 144 of file SendStateDataSampleList.h.


Member Typedef Documentation

typedef SendStateDataSampleListConstIterator OpenDDS::DCPS::SendStateDataSampleList::const_iterator

Definition at line 152 of file SendStateDataSampleList.h.

typedef SendStateDataSampleListIterator OpenDDS::DCPS::SendStateDataSampleList::iterator

STL-style bidirectional iterator and const-iterator types.

Definition at line 151 of file SendStateDataSampleList.h.


Constructor & Destructor Documentation

ACE_INLINE OpenDDS::DCPS::SendStateDataSampleList::SendStateDataSampleList (  ) 

Default constructor clears the list.

Definition at line 16 of file SendStateDataSampleList.inl.

00017   : head_(0),
00018     tail_(0),
00019     size_(0)
00020 {
00021 }

OpenDDS::DCPS::SendStateDataSampleList::~SendStateDataSampleList (  )  [inline]

Definition at line 156 of file SendStateDataSampleList.h.

00156 {};


Member Function Documentation

ACE_INLINE SendStateDataSampleList::const_iterator OpenDDS::DCPS::SendStateDataSampleList::begin (  )  const

Definition at line 128 of file SendStateDataSampleList.inl.

00129 {
00130   return const_iterator(this->head_, this->tail_, this->head_);
00131 }

ACE_INLINE SendStateDataSampleList::iterator OpenDDS::DCPS::SendStateDataSampleList::begin (  ) 

Return iterator to beginning of list.

Definition at line 114 of file SendStateDataSampleList.inl.

Referenced by OpenDDS::DCPS::WriteDataContainer::copy_and_append(), OpenDDS::DCPS::WriteDataContainer::get_unsent_data(), OpenDDS::DCPS::DataDurabilityCache::insert(), and send_list_containing_element().

00115 {
00116   return iterator(this->head_, this->tail_, this->head_);
00117 }

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

Definition at line 47 of file SendStateDataSampleList.cpp.

References dequeue_head(), head_, OpenDDS::DCPS::DataSampleElement::next_send_sample_, OpenDDS::DCPS::DataSampleElement::previous_send_sample_, size_, and tail_.

Referenced by OpenDDS::DCPS::WriteDataContainer::data_delivered(), OpenDDS::DCPS::WriteDataContainer::data_dropped(), OpenDDS::DCPS::WriteDataContainer::remove_oldest_historical_sample(), OpenDDS::DCPS::WriteDataContainer::remove_oldest_sample(), and OpenDDS::DCPS::ReplayerImpl::write().

00048 {
00049   if (head_ == 0) {
00050     return false;
00051   }
00052 
00053   // Same as dequeue from head.
00054   if (stale == head_) {
00055     DataSampleElement* tmp = head_;
00056     return dequeue_head(tmp);
00057   }
00058 
00059   // Search from head_->next_send_sample_.
00060   DataSampleElement* toRemove = 0;
00061   for (DataSampleElement* item = head_->next_send_sample_;
00062        item != 0 && toRemove == 0;
00063        item = item->next_send_sample_) {
00064     if (item == stale) {
00065       toRemove = item;
00066     }
00067   }
00068 
00069   if (toRemove) {
00070     size_ --;
00071     // Remove from the previous element.
00072     toRemove->previous_send_sample_->next_send_sample_ = toRemove->next_send_sample_ ;
00073 
00074     // Remove from the next element.
00075     if (toRemove->next_send_sample_ != 0) {
00076       // Remove from the inside of the list.
00077       toRemove->next_send_sample_->previous_send_sample_ = toRemove->previous_send_sample_ ;
00078 
00079     } else {
00080       toRemove->previous_send_sample_->next_send_sample_ = 0;
00081       // Remove from the tail of the list.
00082       tail_ = toRemove->previous_send_sample_ ;
00083     }
00084 
00085     toRemove->next_send_sample_ = 0;
00086     toRemove->previous_send_sample_ = 0;
00087   }
00088 
00089   return toRemove;
00090 }

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

Definition at line 78 of file SendStateDataSampleList.inl.

References head_, OpenDDS::DCPS::DataSampleElement::next_send_sample_, OpenDDS::DCPS::DataSampleElement::previous_send_sample_, size_, and tail_.

Referenced by dequeue().

00079 {
00080   //
00081   // Remove the oldest sample from the instance list.
00082   //
00083   stale = head_;
00084 
00085   if (head_ == 0) {
00086     return false;
00087 
00088   } else {
00089     --size_ ;
00090 
00091     head_ = head_->next_send_sample_ ;
00092 
00093     if (head_ == 0) {
00094       tail_ = 0;
00095 
00096     } else {
00097       head_->previous_send_sample_ = 0;
00098     }
00099 
00100     //else
00101     //  {
00102     //    head_->previous_writer_sample_ = 0;
00103     //  }
00104 
00105     stale->next_send_sample_ = 0 ;
00106     stale->previous_send_sample_ = 0 ;
00107 
00108     return true;
00109   }
00110 }

ACE_INLINE SendStateDataSampleList::const_iterator OpenDDS::DCPS::SendStateDataSampleList::end (  )  const

Definition at line 135 of file SendStateDataSampleList.inl.

00136 {
00137   return const_iterator(this->head_, this->tail_, 0);
00138 }

ACE_INLINE SendStateDataSampleList::iterator OpenDDS::DCPS::SendStateDataSampleList::end (  ) 

Return iterator to end of list.

Definition at line 121 of file SendStateDataSampleList.inl.

Referenced by OpenDDS::DCPS::WriteDataContainer::copy_and_append(), OpenDDS::DCPS::WriteDataContainer::get_unsent_data(), OpenDDS::DCPS::DataDurabilityCache::insert(), and send_list_containing_element().

00122 {
00123   return iterator(this->head_, this->tail_, 0);
00124 }

void OpenDDS::DCPS::SendStateDataSampleList::enqueue_tail ( SendStateDataSampleList  list  ) 

Definition at line 93 of file SendStateDataSampleList.cpp.

References head_, OpenDDS::DCPS::DataSampleElement::next_send_sample_, OpenDDS::DCPS::DataSampleElement::previous_send_sample_, size_, and tail_.

00094 {
00095   //// Make the appended list linked with next_send_sample_ first.
00096   //DataSampleElement* cur = list.head_;
00097 
00098   //if (list.size_ > 1 && cur->next_send_sample_ == 0)
00099   // {
00100   //   for (ssize_t i = 0; i < list.size_; i ++)
00101   //     {
00102   //       cur->next_send_sample_ = cur->next_writer_sample_;
00103   //       cur = cur->next_writer_sample_;
00104   //     }
00105   // }
00106 
00107   if (head_ == 0) {
00108     head_ = list.head_;
00109     tail_ = list.tail_;
00110     size_ = list.size_;
00111 
00112   } else {
00113     tail_->next_send_sample_
00114     //= tail_->next_writer_sample_
00115     = list.head_;
00116     list.head_->previous_send_sample_ = tail_;
00117     //list.head_->previous_writer_sample_ = tail_;
00118     tail_ = list.tail_;
00119     size_ = size_ + list.size_;
00120   }
00121 }

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

Definition at line 53 of file SendStateDataSampleList.inl.

References head_, OpenDDS::DCPS::DataSampleElement::next_send_sample_, OpenDDS::DCPS::DataSampleElement::previous_send_sample_, size_, and tail_.

Referenced by OpenDDS::DCPS::WriteDataContainer::copy_and_append(), OpenDDS::DCPS::WriteDataContainer::data_delivered(), OpenDDS::DCPS::WriteDataContainer::data_dropped(), OpenDDS::DCPS::WriteDataContainer::enqueue(), OpenDDS::DCPS::WriteDataContainer::enqueue_control(), OpenDDS::DCPS::WriteDataContainer::get_unsent_data(), OpenDDS::DCPS::ReplayerImpl::write(), OpenDDS::DCPS::DataWriterImpl::write(), and OpenDDS::RTPS::Sedp::Writer::write_sample().

00054 {
00055   ++size_;
00056 
00057   // const_cast here so that higher layers don't need to pass around so many
00058   // non-const pointers to DataSampleElement.  Ideally the design would be
00059   // changed to accommodate const-correctness throughout.
00060   DataSampleElement* mSample = const_cast<DataSampleElement*>(sample);
00061 
00062   if (head_ == 0) {
00063     // First sample in list.
00064     head_ = tail_ = mSample;
00065 
00066   } else {
00067     // Add to existing list.
00068     //sample->previous_writer_sample_ = tail_;
00069     //tail_->next_writer_sample_ = sample;
00070     mSample->previous_send_sample_ = tail_;
00071     tail_->next_send_sample_ = mSample;
00072     tail_ = mSample;
00073   }
00074 }

ACE_INLINE DataSampleElement * OpenDDS::DCPS::SendStateDataSampleList::head (  )  const

Definition at line 39 of file SendStateDataSampleList.inl.

References head_.

Referenced by OpenDDS::DCPS::TransportClient::send(), OpenDDS::DCPS::TransportClient::send_i(), send_list_containing_element(), and OpenDDS::DCPS::TransportClient::send_w_control().

00040 {
00041   return head_;
00042 }

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

Reset to initial state.

Definition at line 24 of file SendStateDataSampleList.inl.

References head_, size_, and tail_.

Referenced by OpenDDS::DCPS::WriteDataContainer::get_resend_data(), OpenDDS::DCPS::WriteDataContainer::get_unsent_data(), and OpenDDS::DCPS::DataWriterImpl::send_suspended_data().

00025 {
00026   head_ = tail_ = 0;
00027   size_ = 0;
00028 }

const SendStateDataSampleList * OpenDDS::DCPS::SendStateDataSampleList::send_list_containing_element ( const DataSampleElement element,
OPENDDS_VECTOR(SendStateDataSampleList *)  send_lists 
) [static]

Returns a pointer to the SendStateDataSampleList containing a given DataSampleElement for use in the typical situation where the send state of a DataSampleElement is tracked by shifting it between distinct SendStateDataSampleLists, one for each state

Definition at line 25 of file SendStateDataSampleList.cpp.

References begin(), end(), head(), OpenDDS::DCPS::OPENDDS_VECTOR(), and OpenDDS::DCPS::DataSampleElement::previous_send_sample_.

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

00027 {
00028   DataSampleElement* head = const_cast<DataSampleElement*>(element);
00029 
00030   while (head->previous_send_sample_ != 0) {
00031     head = head->previous_send_sample_;
00032   }
00033 
00034   SendStateDataSampleList* list_containing_element = 0;
00035 
00036   for(OPENDDS_VECTOR(SendStateDataSampleList*)::iterator it = send_lists.begin(); it != send_lists.end(); ++it) {
00037     if ((*it)->head_ == head) {
00038         list_containing_element = *it;
00039         break;
00040     }
00041   }
00042   return list_containing_element;
00043 }

ACE_INLINE ssize_t OpenDDS::DCPS::SendStateDataSampleList::size (  )  const

Definition at line 32 of file SendStateDataSampleList.inl.

References size_.

Referenced by OpenDDS::DCPS::DataDurabilityCache::insert(), OpenDDS::DCPS::WriteDataContainer::log_send_state_lists(), OpenDDS::DCPS::WriteDataContainer::pending_data(), and OpenDDS::DCPS::WriteDataContainer::reenqueue_all().

00033 {
00034   return size_;
00035 }

ACE_INLINE DataSampleElement * OpenDDS::DCPS::SendStateDataSampleList::tail (  )  const

Definition at line 46 of file SendStateDataSampleList.inl.

References tail_.

Referenced by OpenDDS::DCPS::TransportClient::send_i().

00047 {
00048   return tail_;
00049 }


Friends And Related Function Documentation

friend class ::DDS_TEST [friend]

Definition at line 146 of file SendStateDataSampleList.h.


Member Data Documentation

DataSampleElement* OpenDDS::DCPS::SendStateDataSampleList::head_ [protected]

The first element of the list.

Definition at line 190 of file SendStateDataSampleList.h.

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

ssize_t OpenDDS::DCPS::SendStateDataSampleList::size_ [protected]

Number of elements in the list.

Definition at line 196 of file SendStateDataSampleList.h.

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

DataSampleElement* OpenDDS::DCPS::SendStateDataSampleList::tail_ [protected]

The last element of the list.

Definition at line 193 of file SendStateDataSampleList.h.

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


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:24 2016 for OpenDDS by  doxygen 1.4.7