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

SendStateDataSampleList STL-style const iterator implementation. More...

#include <SendStateDataSampleList.h>

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

Public Types

typedef std::bidirectional_iterator_tag iterator_category
 
typedef const DataSampleElement value_type
 
typedef std::ptrdiff_t difference_type
 
typedef const DataSampleElementpointer
 
typedef const DataSampleElementreference
 

Public Member Functions

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

Private Attributes

const DataSampleElementhead_
 
const DataSampleElementtail_
 
const DataSampleElementcurrent_
 

Detailed Description

SendStateDataSampleList STL-style const iterator implementation.

This class implements a STL-style const 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 99 of file SendStateDataSampleList.h.

Member Typedef Documentation

◆ difference_type

Definition at line 103 of file SendStateDataSampleList.h.

◆ iterator_category

Definition at line 101 of file SendStateDataSampleList.h.

◆ pointer

Definition at line 104 of file SendStateDataSampleList.h.

◆ reference

Definition at line 105 of file SendStateDataSampleList.h.

◆ value_type

Definition at line 102 of file SendStateDataSampleList.h.

Constructor & Destructor Documentation

◆ SendStateDataSampleListConstIterator() [1/3]

OpenDDS::DCPS::SendStateDataSampleListConstIterator::SendStateDataSampleListConstIterator ( )
inline

Default constructor required by ForwardIterator concept.

Definition at line 108 of file SendStateDataSampleList.h.

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

108 {}

◆ SendStateDataSampleListConstIterator() [2/3]

OpenDDS::DCPS::SendStateDataSampleListConstIterator::SendStateDataSampleListConstIterator ( const DataSampleElement head,
const DataSampleElement tail,
const DataSampleElement current 
)

Definition at line 174 of file SendStateDataSampleList.cpp.

178  : head_(head)
179  , tail_(tail)
180  , current_(current)
181 {
182 }

◆ SendStateDataSampleListConstIterator() [3/3]

OpenDDS::DCPS::SendStateDataSampleListConstIterator::SendStateDataSampleListConstIterator ( const SendStateDataSampleListIterator iterator)

Definition at line 184 of file SendStateDataSampleList.cpp.

186  : head_(iterator.head_)
187  , tail_(iterator.tail_)
188  , current_(iterator.current_)
189 {
190 }

Member Function Documentation

◆ operator!=()

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

Definition at line 131 of file SendStateDataSampleList.h.

131  {
132  return !(*this == rhs);
133  }

◆ operator*()

SendStateDataSampleListConstIterator::reference OpenDDS::DCPS::SendStateDataSampleListConstIterator::operator* ( void  ) const

Definition at line 231 of file SendStateDataSampleList.cpp.

References current_.

232 {
233  // Hopefully folks will be smart enough to not dereference a
234  // null iterator. Such a case should only exist for an "end"
235  // iterator. Otherwise we may want to throw an exception here.
236  // assert (this->current_ != 0);
237 
238  return *(this->current_);
239 }

◆ operator++() [1/2]

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

Definition at line 193 of file SendStateDataSampleList.cpp.

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

194 {
195  if (this->current_) {
196  this->current_ = this->current_->next_send_sample_;
197  }
198 
199  return *this;
200 }
DataSampleElement * next_send_sample_
Thread of data being unsent/sending/sent/released.

◆ operator++() [2/2]

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

Definition at line 203 of file SendStateDataSampleList.cpp.

204 {
206  ++(*this);
207  return tmp;
208 }
SendStateDataSampleListConstIterator()
Default constructor required by ForwardIterator concept.

◆ operator--() [1/2]

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

Definition at line 211 of file SendStateDataSampleList.cpp.

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

212 {
213  if (this->current_) {
214  this->current_ = this->current_->previous_send_sample_;
215  } else {
216  this->current_ = this->tail_;
217  }
218 
219  return *this;
220 }
DataSampleElement * previous_send_sample_

◆ operator--() [2/2]

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

Definition at line 223 of file SendStateDataSampleList.cpp.

224 {
226  --(*this);
227  return tmp;
228 }
SendStateDataSampleListConstIterator()
Default constructor required by ForwardIterator concept.

◆ operator->()

SendStateDataSampleListConstIterator::pointer OpenDDS::DCPS::SendStateDataSampleListConstIterator::operator-> ( void  ) const

Definition at line 242 of file SendStateDataSampleList.cpp.

References current_, and OPENDDS_END_VERSIONED_NAMESPACE_DECL.

243 {
244  return this->current_;
245 }

◆ operator==()

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

Definition at line 124 of file SendStateDataSampleList.h.

References current_, head_, head_, and tail_.

124  {
125  return this->head_ == rhs.head_
126  && this->tail_ == rhs.tail_
127  && this->current_ == rhs.current_;
128  }

Member Data Documentation

◆ current_

const DataSampleElement* OpenDDS::DCPS::SendStateDataSampleListConstIterator::current_
private

Definition at line 138 of file SendStateDataSampleList.h.

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

◆ head_

const DataSampleElement* OpenDDS::DCPS::SendStateDataSampleListConstIterator::head_
private

Definition at line 136 of file SendStateDataSampleList.h.

Referenced by operator==().

◆ tail_

const DataSampleElement* OpenDDS::DCPS::SendStateDataSampleListConstIterator::tail_
private

Definition at line 137 of file SendStateDataSampleList.h.

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


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