18 #ifndef RTI_ROUTING_PROCESSOR_SAMPLE_ITERATOR_HPP_
19 #define RTI_ROUTING_PROCESSOR_SAMPLE_ITERATOR_HPP_
22 #include <rti/routing/processor/LoanedSample.hpp>
32 struct no_sample_info_t {
43 template <
typename T,
typename U>
47 typedef std::random_access_iterator_tag iterator_category;
48 typedef const LoanedSample<T, U> value_type;
49 typedef value_type reference;
50 typedef value_type pointer;
51 typedef std::ptrdiff_t difference_type;
52 typedef RTI_RoutingServiceSample* SampleSeqType;
53 typedef RTI_RoutingServiceSampleInfo* InfoSeqType;
56 static no_sample_info_t *_null_info_scrachtpad[1];
57 static InfoSeqType _null_info_seq;
58 static int _null_info_pos;
71 const SampleSeqType sample_seq,
72 const InfoSeqType info_seq,
75 : _sample_seq(sample_seq),
76 _info_seq(info_seq == NULL ? _null_info_seq : info_seq),
79 _info_pos(info_seq == NULL ? _null_info_pos : _pos)
84 : _sample_seq(other._sample_seq),
85 _info_seq(other._info_seq),
86 _length(other._length),
88 _info_pos(other._info_pos)
94 _sample_seq = other._sample_seq;
95 _info_seq = other._info_seq;
96 _length = other._length;
98 _info_pos = other._info_pos;
103 value_type operator*()
const
105 return value_type(_sample_seq[_pos], _info_seq[_info_pos]);
108 value_type operator->()
const
110 return value_type(_sample_seq[_pos], _info_seq[_info_pos]);
113 value_type operator[](difference_type offset)
const
115 return (_info_seq == _null_info_seq)
116 ? value_type(_sample_seq[_pos], NULL)
117 : value_type(_sample_seq[_pos + offset], _info_seq[_info_pos + offset]);
176 friend difference_type operator-(
180 return s1._pos - s2._pos;
186 return s1._pos < s2._pos;
192 return s1._pos > s2._pos;
198 return s1._pos <= s2._pos;
204 return s1._pos >= s2._pos;
210 return (s1._sample_seq == s2._sample_seq) && (s1._pos == s2._pos);
221 return (_length == _pos);
227 SampleSeqType _sample_seq;
228 InfoSeqType _info_seq;
235 template <
typename T,
typename U>
238 template <
typename T,
typename U>
241 template <
typename T,
typename U>
242 typename SampleIterator<T, U>::InfoSeqType SampleIterator<T, U>::_null_info_seq =
243 reinterpret_cast<InfoSeqType
> (SampleIterator<T, U>::_null_info_scrachtpad);
247 #endif // RTI_ROUTING_PROCESSOR_SAMPLE_ITERATOR_HPP_