OpenDDS  Snapshot(2023/04/07-19:43)
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
OpenDDS::DCPS::SendStateDataSampleListIterator Struct Reference

SendStateDataSampleList STL-style iterator implementation. More...

#include <SendStateDataSampleList.h>

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

Public Types

typedef std::bidirectional_iterator_tag iterator_category
 
typedef DataSampleElement value_type
 
typedef std::ptrdiff_t difference_type
 
typedef value_typepointer
 
typedef value_typereference
 

Public Member Functions

 SendStateDataSampleListIterator ()
 Default constructor required by ForwardIterator concept. More...
 
 SendStateDataSampleListIterator (DataSampleElement *head, DataSampleElement *tail, DataSampleElement *current)
 
SendStateDataSampleListIteratoroperator++ ()
 
SendStateDataSampleListIterator operator++ (int)
 
SendStateDataSampleListIteratoroperator-- ()
 
SendStateDataSampleListIterator operator-- (int)
 
reference operator* ()
 
pointer operator-> ()
 
bool operator== (const SendStateDataSampleListIterator &rhs) const
 
bool operator!= (const SendStateDataSampleListIterator &rhs) const
 

Private Attributes

DataSampleElementhead_
 
DataSampleElementtail_
 
DataSampleElementcurrent_
 

Friends

class SendStateDataSampleListConstIterator
 

Detailed Description

SendStateDataSampleList STL-style iterator implementation.

This class implements a STL-style iterator for the OpenDDS SendStateDataSampleList class. The resulting iterator may be used with the STL generic algorithms. It is meant for iteration over the "send samples" in a SendStateDataSampleList.

Definition at line 43 of file SendStateDataSampleList.h.

Member Typedef Documentation

◆ difference_type

Definition at line 47 of file SendStateDataSampleList.h.

◆ iterator_category

Definition at line 45 of file SendStateDataSampleList.h.

◆ pointer

Definition at line 48 of file SendStateDataSampleList.h.

◆ reference

Definition at line 49 of file SendStateDataSampleList.h.

◆ value_type

Definition at line 46 of file SendStateDataSampleList.h.

Constructor & Destructor Documentation

◆ SendStateDataSampleListIterator() [1/2]

OpenDDS::DCPS::SendStateDataSampleListIterator::SendStateDataSampleListIterator ( )
inline

Default constructor required by ForwardIterator concept.

Definition at line 52 of file SendStateDataSampleList.h.

References OpenDDS::DCPS::operator*().

52 {}

◆ SendStateDataSampleListIterator() [2/2]

OpenDDS::DCPS::SendStateDataSampleListIterator::SendStateDataSampleListIterator ( DataSampleElement head,
DataSampleElement tail,
DataSampleElement current 
)

This constructor is used when constructing an "end" iterator.

Definition at line 109 of file SendStateDataSampleList.cpp.

113  : head_(head)
114  , tail_(tail)
115  , current_(current)
116 {
117 }

Member Function Documentation

◆ operator!=()

bool OpenDDS::DCPS::SendStateDataSampleListIterator::operator!= ( const SendStateDataSampleListIterator rhs) const
inline

Definition at line 77 of file SendStateDataSampleList.h.

77  {
78  return !(*this == rhs);
79  }

◆ operator*()

SendStateDataSampleListIterator::reference OpenDDS::DCPS::SendStateDataSampleListIterator::operator* ( void  )

Definition at line 158 of file SendStateDataSampleList.cpp.

References current_.

159 {
160  // Hopefully folks will be smart enough to not dereference a
161  // null iterator. Such a case should only exist for an "end"
162  // iterator. Otherwise we may want to throw an exception here.
163  // assert (this->current_ != 0);
164 
165  return *(this->current_);
166 }

◆ operator++() [1/2]

SendStateDataSampleListIterator & OpenDDS::DCPS::SendStateDataSampleListIterator::operator++ ( void  )

Definition at line 120 of file SendStateDataSampleList.cpp.

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

121 {
122  if (this->current_) {
123  this->current_ = this->current_->next_send_sample_;
124  }
125 
126  return *this;
127 }
DataSampleElement * next_send_sample_
Thread of data being unsent/sending/sent/released.

◆ operator++() [2/2]

SendStateDataSampleListIterator OpenDDS::DCPS::SendStateDataSampleListIterator::operator++ ( int  )

Definition at line 130 of file SendStateDataSampleList.cpp.

131 {
133  ++(*this);
134  return tmp;
135 }
SendStateDataSampleListIterator()
Default constructor required by ForwardIterator concept.

◆ operator--() [1/2]

SendStateDataSampleListIterator & OpenDDS::DCPS::SendStateDataSampleListIterator::operator-- ( void  )

Definition at line 138 of file SendStateDataSampleList.cpp.

References current_, OpenDDS::DCPS::DataSampleElement::previous_send_sample_, and tail_.

139 {
140  if (this->current_) {
141  this->current_ = this->current_->previous_send_sample_;
142  } else {
143  this->current_ = this->tail_;
144  }
145 
146  return *this;
147 }
DataSampleElement * previous_send_sample_

◆ operator--() [2/2]

SendStateDataSampleListIterator OpenDDS::DCPS::SendStateDataSampleListIterator::operator-- ( int  )

Definition at line 150 of file SendStateDataSampleList.cpp.

151 {
153  --(*this);
154  return tmp;
155 }
SendStateDataSampleListIterator()
Default constructor required by ForwardIterator concept.

◆ operator->()

SendStateDataSampleListIterator::pointer OpenDDS::DCPS::SendStateDataSampleListIterator::operator-> ( void  )

Definition at line 169 of file SendStateDataSampleList.cpp.

References current_.

170 {
171  return this->current_;
172 }

◆ operator==()

bool OpenDDS::DCPS::SendStateDataSampleListIterator::operator== ( const SendStateDataSampleListIterator rhs) const
inline

Definition at line 70 of file SendStateDataSampleList.h.

References current_, head_, head_, and tail_.

70  {
71  return this->head_ == rhs.head_
72  && this->tail_ == rhs.tail_
73  && this->current_ == rhs.current_;
74  }

Friends And Related Function Documentation

◆ SendStateDataSampleListConstIterator

Definition at line 86 of file SendStateDataSampleList.h.

Member Data Documentation

◆ current_

DataSampleElement* OpenDDS::DCPS::SendStateDataSampleListIterator::current_
private

Definition at line 84 of file SendStateDataSampleList.h.

Referenced by operator*(), operator++(), operator--(), operator->(), and operator==().

◆ head_

DataSampleElement* OpenDDS::DCPS::SendStateDataSampleListIterator::head_
private

Definition at line 82 of file SendStateDataSampleList.h.

Referenced by operator==().

◆ tail_

DataSampleElement* OpenDDS::DCPS::SendStateDataSampleListIterator::tail_
private

Definition at line 83 of file SendStateDataSampleList.h.

Referenced by operator--(), and operator==().


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