SendStateDataSampleList.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef OPENDDS_DCPS_SENDSTATEDATASAMPLELIST_H
00009 #define OPENDDS_DCPS_SENDSTATEDATASAMPLELIST_H
00010
00011 #include "dds/DdsDcpsInfoUtilsC.h"
00012 #include "PoolAllocator.h"
00013 #include "Definitions.h"
00014 #include "transport/framework/TransportDefs.h"
00015 #include "Dynamic_Cached_Allocator_With_Overflow_T.h"
00016 #include "ace/config-lite.h"
00017
00018 #include <iterator>
00019
00020 class DDS_TEST;
00021
00022 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00023
00024 namespace OpenDDS {
00025 namespace DCPS {
00026
00027 class DataSampleElement;
00028
00029 const int MAX_READERS_TO_RESEND = 5;
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class OpenDDS_Dcps_Export SendStateDataSampleListIterator
00042 : public std::iterator<std::bidirectional_iterator_tag, DataSampleElement>
00043 {
00044 public:
00045
00046
00047 SendStateDataSampleListIterator(){}
00048
00049
00050
00051
00052 SendStateDataSampleListIterator(DataSampleElement* head,
00053 DataSampleElement* tail,
00054 DataSampleElement* current);
00055
00056 SendStateDataSampleListIterator& operator++();
00057 SendStateDataSampleListIterator operator++(int);
00058 SendStateDataSampleListIterator& operator--();
00059 SendStateDataSampleListIterator operator--(int);
00060
00061 reference operator*();
00062 pointer operator->();
00063
00064 bool
00065 operator==(const SendStateDataSampleListIterator& rhs) const {
00066 return this->head_ == rhs.head_
00067 && this->tail_ == rhs.tail_
00068 && this->current_ == rhs.current_;
00069 }
00070
00071 bool
00072 operator!=(const SendStateDataSampleListIterator& rhs) const {
00073 return !(*this == rhs);
00074 }
00075
00076 private:
00077 DataSampleElement* head_;
00078 DataSampleElement* tail_;
00079 DataSampleElement* current_;
00080
00081 friend class SendStateDataSampleListConstIterator;
00082 };
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 class OpenDDS_Dcps_Export SendStateDataSampleListConstIterator
00095 : public std::iterator<std::bidirectional_iterator_tag, DataSampleElement>
00096 {
00097 public:
00098 typedef const DataSampleElement* pointer;
00099 typedef const DataSampleElement& reference;
00100
00101
00102 SendStateDataSampleListConstIterator(){}
00103
00104 SendStateDataSampleListConstIterator(const DataSampleElement* head,
00105 const DataSampleElement* tail,
00106 const DataSampleElement* current);
00107
00108 SendStateDataSampleListConstIterator(const SendStateDataSampleListIterator& iterator);
00109
00110 SendStateDataSampleListConstIterator& operator++();
00111 SendStateDataSampleListConstIterator operator++(int);
00112 SendStateDataSampleListConstIterator& operator--();
00113 SendStateDataSampleListConstIterator operator--(int);
00114 reference operator*() const;
00115 pointer operator->() const;
00116
00117 bool
00118 operator==(const SendStateDataSampleListConstIterator& rhs) const {
00119 return this->head_ == rhs.head_
00120 && this->tail_ == rhs.tail_
00121 && this->current_ == rhs.current_;
00122 }
00123
00124 bool
00125 operator!=(const SendStateDataSampleListConstIterator& rhs) const {
00126 return !(*this == rhs);
00127 }
00128
00129 private:
00130 const DataSampleElement* head_;
00131 const DataSampleElement* tail_;
00132 const DataSampleElement* current_;
00133
00134 };
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 class OpenDDS_Dcps_Export SendStateDataSampleList {
00148
00149 friend class ::DDS_TEST;
00150
00151 static const SendStateDataSampleList*
00152 send_list_containing_element(const DataSampleElement* element,
00153 SendStateDataSampleList** begin,
00154 SendStateDataSampleList** end);
00155
00156 public:
00157
00158
00159 typedef SendStateDataSampleListIterator iterator;
00160 typedef SendStateDataSampleListConstIterator const_iterator;
00161
00162 #if defined __SUNPRO_CC && __SUNPRO_CC <= 0x5130 \
00163 && defined _RWSTD_NO_CLASS_PARTIAL_SPEC
00164 typedef std::reverse_iterator<iterator, std::bidirectional_iterator_tag,
00165 DataSampleElement, DataSampleElement&,
00166 DataSampleElement*, std::ptrdiff_t>
00167 reverse_iterator;
00168 typedef std::reverse_iterator<const_iterator, std::bidirectional_iterator_tag,
00169 const DataSampleElement,
00170 const DataSampleElement&,
00171 const DataSampleElement*, std::ptrdiff_t>
00172 const_reverse_iterator;
00173 #else
00174 typedef std::reverse_iterator<iterator> reverse_iterator;
00175 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
00176 #endif
00177
00178
00179 SendStateDataSampleList();
00180 ~SendStateDataSampleList(){}
00181
00182
00183
00184
00185
00186 template <size_t N>
00187 static const SendStateDataSampleList*
00188 send_list_containing_element(const DataSampleElement* element,
00189 SendStateDataSampleList* (&send_lists)[N])
00190 {
00191 return send_list_containing_element(element,
00192 &send_lists[0], &send_lists[N]);
00193 }
00194
00195
00196 void reset();
00197
00198 ssize_t size() const;
00199 DataSampleElement* head() const;
00200 DataSampleElement* tail() const;
00201
00202 void enqueue_head(const DataSampleElement* element);
00203
00204 void enqueue_tail(const DataSampleElement* element);
00205 void enqueue_tail(SendStateDataSampleList list);
00206
00207 bool dequeue_head(DataSampleElement*& stale);
00208
00209 bool dequeue(const DataSampleElement* stale);
00210
00211
00212
00213
00214 static void remove(DataSampleElement* stale);
00215
00216
00217 iterator begin();
00218 const_iterator begin() const;
00219
00220
00221 iterator end();
00222 const_iterator end() const;
00223
00224 reverse_iterator rbegin();
00225 const_reverse_iterator rbegin() const;
00226 reverse_iterator rend();
00227 const_reverse_iterator rend() const;
00228
00229 protected:
00230
00231
00232 DataSampleElement* head_;
00233
00234
00235 DataSampleElement* tail_;
00236
00237
00238 ssize_t size_;
00239
00240
00241
00242 };
00243
00244 }
00245 }
00246
00247 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00248
00249 #if defined(__ACE_INLINE__)
00250 #include "SendStateDataSampleList.inl"
00251 #endif
00252
00253 #endif