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
00017 #include <iterator>
00018
00019 class DDS_TEST;
00020
00021 namespace OpenDDS {
00022 namespace DCPS {
00023
00024 class DataSampleElement;
00025
00026 const int MAX_READERS_TO_RESEND = 5;
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 class OpenDDS_Dcps_Export SendStateDataSampleListIterator
00039 : public std::iterator<std::bidirectional_iterator_tag, DataSampleElement>
00040 {
00041 public:
00042
00043
00044
00045
00046
00047
00048 SendStateDataSampleListIterator(DataSampleElement* head,
00049 DataSampleElement* tail,
00050 DataSampleElement* current);
00051
00052 SendStateDataSampleListIterator& operator++();
00053 SendStateDataSampleListIterator operator++(int);
00054 SendStateDataSampleListIterator& operator--();
00055 SendStateDataSampleListIterator operator--(int);
00056
00057 reference operator*();
00058 pointer operator->();
00059
00060 bool
00061 operator==(const SendStateDataSampleListIterator& rhs) const {
00062 return this->head_ == rhs.head_
00063 && this->tail_ == rhs.tail_
00064 && this->current_ == rhs.current_;
00065 }
00066
00067 bool
00068 operator!=(const SendStateDataSampleListIterator& rhs) const {
00069 return !(*this == rhs);
00070 }
00071
00072 private:
00073 SendStateDataSampleListIterator();
00074
00075 DataSampleElement* head_;
00076 DataSampleElement* tail_;
00077 DataSampleElement* current_;
00078
00079 friend class SendStateDataSampleListConstIterator;
00080 };
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 class OpenDDS_Dcps_Export SendStateDataSampleListConstIterator
00093 {
00094 public:
00095 typedef const DataSampleElement* pointer;
00096 typedef const DataSampleElement& reference;
00097
00098
00099 SendStateDataSampleListConstIterator(const DataSampleElement* head,
00100 const DataSampleElement* tail,
00101 const DataSampleElement* current);
00102
00103 SendStateDataSampleListConstIterator(const SendStateDataSampleListIterator& iterator);
00104
00105 SendStateDataSampleListConstIterator& operator++();
00106 SendStateDataSampleListConstIterator operator++(int);
00107 SendStateDataSampleListConstIterator& operator--();
00108 SendStateDataSampleListConstIterator operator--(int);
00109 reference operator*() const;
00110 pointer operator->() const;
00111
00112 bool
00113 operator==(const SendStateDataSampleListConstIterator& rhs) const {
00114 return this->head_ == rhs.head_
00115 && this->tail_ == rhs.tail_
00116 && this->current_ == rhs.current_;
00117 }
00118
00119 bool
00120 operator!=(const SendStateDataSampleListConstIterator& rhs) const {
00121 return !(*this == rhs);
00122 }
00123
00124 private:
00125 SendStateDataSampleListConstIterator();
00126
00127 const DataSampleElement* head_;
00128 const DataSampleElement* tail_;
00129 const DataSampleElement* current_;
00130
00131 };
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 class OpenDDS_Dcps_Export SendStateDataSampleList {
00145
00146 friend class ::DDS_TEST;
00147
00148 public:
00149
00150
00151 typedef SendStateDataSampleListIterator iterator;
00152 typedef SendStateDataSampleListConstIterator const_iterator;
00153
00154
00155 SendStateDataSampleList();
00156 ~SendStateDataSampleList(){};
00157
00158
00159
00160
00161
00162 static const SendStateDataSampleList* send_list_containing_element(const DataSampleElement* element,
00163 OPENDDS_VECTOR(SendStateDataSampleList*) send_lists);
00164
00165
00166 void reset();
00167
00168 ssize_t size() const;
00169 DataSampleElement* head() const;
00170 DataSampleElement* tail() const;
00171
00172 void enqueue_tail(const DataSampleElement* element);
00173 void enqueue_tail(SendStateDataSampleList list);
00174
00175 bool dequeue_head(DataSampleElement*& stale);
00176
00177 bool dequeue(const DataSampleElement* stale);
00178
00179
00180 iterator begin();
00181 const_iterator begin() const;
00182
00183
00184 iterator end();
00185 const_iterator end() const;
00186
00187 protected:
00188
00189
00190 DataSampleElement* head_;
00191
00192
00193 DataSampleElement* tail_;
00194
00195
00196 ssize_t size_;
00197
00198
00199
00200 };
00201
00202 }
00203 }
00204
00205 #if defined(__ACE_INLINE__)
00206 #include "SendStateDataSampleList.inl"
00207 #endif
00208
00209 #endif