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
typedef std::reverse_iterator
< iterator
reverse_iterator
typedef std::reverse_iterator
< const_iterator
const_reverse_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_head (const DataSampleElement *element)
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
reverse_iterator rbegin ()
const_reverse_iterator rbegin () const
reverse_iterator rend ()
const_reverse_iterator rend () const

Static Public Member Functions

template<size_t N>
static const
SendStateDataSampleList
send_list_containing_element (const DataSampleElement *element, SendStateDataSampleList *(&send_lists)[N])
static void remove (DataSampleElement *stale)

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.

Static Private Member Functions

static const
SendStateDataSampleList
send_list_containing_element (const DataSampleElement *element, SendStateDataSampleList **begin, SendStateDataSampleList **end)

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 147 of file SendStateDataSampleList.h.


Member Typedef Documentation

Definition at line 160 of file SendStateDataSampleList.h.

Definition at line 175 of file SendStateDataSampleList.h.

STL-style bidirectional iterator and const-iterator types.

Definition at line 159 of file SendStateDataSampleList.h.

Definition at line 174 of file SendStateDataSampleList.h.


Constructor & Destructor Documentation

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

Default constructor clears the list.

Definition at line 17 of file SendStateDataSampleList.inl.

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

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

Definition at line 180 of file SendStateDataSampleList.h.

00180 {}


Member Function Documentation

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

Definition at line 155 of file SendStateDataSampleList.inl.

References head_, and tail_.

00156 {
00157   return const_iterator(this->head_, this->tail_, this->head_);
00158 }

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

Return iterator to beginning of list.

Definition at line 141 of file SendStateDataSampleList.inl.

References head_, and tail_.

Referenced by OpenDDS::DCPS::DataWriterImpl::association_complete_i(), OpenDDS::DCPS::WriteDataContainer::get_unsent_data(), OpenDDS::DCPS::DataDurabilityCache::insert(), and rend().

00142 {
00143   return iterator(this->head_, this->tail_, this->head_);
00144 }

Here is the caller graph for this function:

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

Definition at line 47 of file SendStateDataSampleList.cpp.

References dequeue_head(), head_, item(), 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_excess_durable(), 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 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 100 of file SendStateDataSampleList.inl.

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

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

00101 {
00102   //
00103   // Remove the oldest sample from the instance list.
00104   //
00105   stale = head_;
00106 
00107   if (head_ == 0) {
00108     return false;
00109 
00110   } else {
00111     --size_;
00112 
00113     head_ = head_->next_send_sample_;
00114 
00115     if (head_ == 0) {
00116       tail_ = 0;
00117 
00118     } else {
00119       head_->previous_send_sample_ = 0;
00120     }
00121 
00122     stale->next_send_sample_ = 0;
00123     stale->previous_send_sample_ = 0;
00124 
00125     return true;
00126   }
00127 }

Here is the caller graph for this function:

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

Definition at line 162 of file SendStateDataSampleList.inl.

References head_, and tail_.

00163 {
00164   return const_iterator(this->head_, this->tail_, 0);
00165 }

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

Return iterator to end of list.

Definition at line 148 of file SendStateDataSampleList.inl.

References head_, and tail_.

Referenced by OpenDDS::DCPS::DataWriterImpl::association_complete_i(), OpenDDS::DCPS::WriteDataContainer::get_unsent_data(), OpenDDS::DCPS::DataDurabilityCache::insert(), and rbegin().

00149 {
00150   return iterator(this->head_, this->tail_, 0);
00151 }

Here is the caller graph for this function:

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

Definition at line 54 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_prepend().

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

Here is the caller graph for this function:

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 77 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::DataWriterImpl::association_complete_i(), 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::WriteDataContainer::remove_oldest_sample(), OpenDDS::DCPS::ReplayerImpl::write(), and OpenDDS::DCPS::DataWriterImpl::write().

00078 {
00079   ++size_;
00080 
00081   // const_cast here so that higher layers don't need to pass around so many
00082   // non-const pointers to DataSampleElement.  Ideally the design would be
00083   // changed to accommodate const-correctness throughout.
00084   DataSampleElement* mSample = const_cast<DataSampleElement*>(sample);
00085 
00086   if (head_ == 0) {
00087     head_ = tail_ = mSample;
00088     sample->next_send_sample_ = sample->previous_send_sample_ = 0;
00089 
00090   } else {
00091     sample->previous_send_sample_ = tail_;
00092     sample->next_send_sample_ = 0;
00093     tail_->next_send_sample_ = mSample;
00094     tail_ = mSample;
00095   }
00096 }

Here is the caller graph for this function:

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

Definition at line 40 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().

00041 {
00042   return head_;
00043 }

Here is the caller graph for this function:

ACE_INLINE SendStateDataSampleList::const_reverse_iterator OpenDDS::DCPS::SendStateDataSampleList::rbegin ( void   )  const

Definition at line 183 of file SendStateDataSampleList.inl.

References end().

00184 {
00185   return const_reverse_iterator(end());
00186 }

Here is the call graph for this function:

ACE_INLINE SendStateDataSampleList::reverse_iterator OpenDDS::DCPS::SendStateDataSampleList::rbegin ( void   ) 

Definition at line 169 of file SendStateDataSampleList.inl.

References end().

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

00170 {
00171   return reverse_iterator(end());
00172 }

Here is the call graph for this function:

Here is the caller graph for this function:

ACE_INLINE void OpenDDS::DCPS::SendStateDataSampleList::remove ( DataSampleElement stale  )  [static]

Remove from whichever list "stale" belongs to, without needing a reference to the SendStateDataSampleList object itself. That SendStateDataSampleList is no longer accurate and can't be used.

Definition at line 131 of file SendStateDataSampleList.inl.

References OpenDDS::DCPS::DataSampleElement::next_send_sample_, and OpenDDS::DCPS::DataSampleElement::previous_send_sample_.

00132 {
00133   if (stale->previous_send_sample_)
00134     stale->previous_send_sample_->next_send_sample_ = stale->next_send_sample_;
00135   if (stale->next_send_sample_)
00136     stale->next_send_sample_->previous_send_sample_ = stale->previous_send_sample_;
00137 }

ACE_INLINE SendStateDataSampleList::const_reverse_iterator OpenDDS::DCPS::SendStateDataSampleList::rend ( void   )  const

Definition at line 190 of file SendStateDataSampleList.inl.

References begin().

00191 {
00192   return const_reverse_iterator(begin());
00193 }

Here is the call graph for this function:

ACE_INLINE SendStateDataSampleList::reverse_iterator OpenDDS::DCPS::SendStateDataSampleList::rend ( void   ) 

Definition at line 176 of file SendStateDataSampleList.inl.

References begin().

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

00177 {
00178   return reverse_iterator(begin());
00179 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reset to initial state.

Definition at line 25 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().

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

Here is the caller graph for this function:

template<size_t N>
static const SendStateDataSampleList* OpenDDS::DCPS::SendStateDataSampleList::send_list_containing_element ( const DataSampleElement element,
SendStateDataSampleList *(&)  send_lists[N] 
) [inline, 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 188 of file SendStateDataSampleList.h.

00190   {
00191     return send_list_containing_element(element,
00192                                         &send_lists[0], &send_lists[N]);
00193   }

const SendStateDataSampleList * OpenDDS::DCPS::SendStateDataSampleList::send_list_containing_element ( const DataSampleElement element,
SendStateDataSampleList **  begin,
SendStateDataSampleList **  end 
) [static, private]

Definition at line 27 of file SendStateDataSampleList.cpp.

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

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

00030 {
00031   const DataSampleElement* head = element;
00032 
00033   while (head->previous_send_sample_ != 0) {
00034     head = head->previous_send_sample_;
00035   }
00036 
00037   for (SendStateDataSampleList** it = begin; it != end; ++it) {
00038     if ((*it)->head_ == head) {
00039       return *it;
00040     }
00041   }
00042   return 0;
00043 }

Here is the call graph for this function:

Here is the caller graph for this function:

ACE_INLINE ssize_t OpenDDS::DCPS::SendStateDataSampleList::size ( void   )  const
ACE_INLINE DataSampleElement * OpenDDS::DCPS::SendStateDataSampleList::tail ( void   )  const

Definition at line 47 of file SendStateDataSampleList.inl.

References tail_.

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

00048 {
00049   return tail_;
00050 }

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class ::DDS_TEST [friend]

Definition at line 149 of file SendStateDataSampleList.h.


Member Data Documentation

The first element of the list.

Definition at line 232 of file SendStateDataSampleList.h.

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

Number of elements in the list.

Definition at line 238 of file SendStateDataSampleList.h.

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

The last element of the list.

Definition at line 235 of file SendStateDataSampleList.h.

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1