nds2-client - User 0.16.7
Loading...
Searching...
No Matches
nds_data_iterator.hh
1//
2// Created by jonathan.hanks on 5/25/18.
3//
4
5#ifndef NDS2_CLIENT_NDS_DATA_ITERATOR_HH
6#define NDS2_CLIENT_NDS_DATA_ITERATOR_HH
7
8#include <iterator>
9#include <memory>
10
11#include "nds_buffer.hh"
12#include "nds_channel.hh"
13
14namespace NDS
15{
16 namespace detail
17 {
18 class iterate_handler;
19 }
20
21 inline namespace abi_0
22 {
38 {
39 using gps_second_type = NDS::buffer::gps_second_type;
40 typedef long stride_type;
41 gps_second_type start;
42 gps_second_type stop;
43 stride_type stride;
44
51 const static stride_type FAST_STRIDE = -1;
52
61 const static stride_type AUTO_STRIDE = 0;
62
68 request_period( ) : start( 0 ), stop( 0 ), stride( 0 )
69 {
70 }
71
82 explicit request_period( stride_type requested_stride )
83 : start( 0 ), stop( 0 ), stride( requested_stride )
84 {
85 }
86
99 explicit request_period( gps_second_type requested_start,
100 gps_second_type requested_stop )
101 : start( requested_start ), stop( requested_stop ), stride( 0 )
102 {
103 }
104
121 explicit request_period( gps_second_type requested_start,
122 gps_second_type requested_stop,
123 stride_type requested_stride )
124 : start( requested_start ), stop( requested_stop ),
125 stride( requested_stride )
126 {
127 }
128 };
129
145 {
146 public:
147 typedef std::shared_ptr< buffers_type > value_type;
148 typedef value_type& reference;
149 typedef value_type* pointer;
150 typedef std::size_t difference_type;
151 typedef std::input_iterator_tag iterator_category;
152
157 DLL_EXPORT data_stream_iterator( );
167 DLL_EXPORT
176 DLL_EXPORT
178
179 DLL_EXPORT
180 data_stream_iterator( std::shared_ptr< detail::iterate_handler > p,
181 value_type c );
182
183 DLL_EXPORT ~data_stream_iterator( );
184
194 DLL_EXPORT data_stream_iterator&
203 DLL_EXPORT data_stream_iterator&
204 operator=( data_stream_iterator&& other ) noexcept;
205
206 DLL_EXPORT bool
207 operator==( const data_stream_iterator& other ) const;
208
209 DLL_EXPORT bool
210 operator!=( const data_stream_iterator& other ) const;
211
219 DLL_EXPORT reference operator*( );
220
225 DLL_EXPORT data_stream_iterator& operator++( );
230 DLL_EXPORT data_stream_iterator operator++( int );
231
232 private:
233 std::shared_ptr< detail::iterate_handler > p_;
234 value_type cache_;
235 };
236
263 {
264 public:
270
271 DLL_EXPORT explicit data_iterable(
272 std::shared_ptr< NDS::detail::iterate_handler > handler );
281 DLL_EXPORT data_iterable( const data_iterable& other );
289 DLL_EXPORT data_iterable( data_iterable&& other ) noexcept;
290
291 DLL_EXPORT ~data_iterable( );
292
302 DLL_EXPORT data_iterable& operator=( const data_iterable& other );
310 DLL_EXPORT data_iterable&
311 operator=( data_iterable&& other ) noexcept;
312
325 DLL_EXPORT iterator_type begin( );
326
334 DLL_EXPORT iterator_type end( );
335
343 DLL_EXPORT void abort( );
344
345 private:
346 std::shared_ptr< NDS::detail::iterate_handler > p_;
347 };
348 }
349}
350
351#endif // NDS2_CLIENT_NDS_DATA_ITERATOR_HH
The data_iterable manages streaming data from an NDS::connection.
Definition nds_data_iterator.hh:263
DLL_EXPORT data_iterable & operator=(data_iterable &&other) noexcept
Move assigment operator.
DLL_EXPORT data_iterable(const data_iterable &other)
Copy constructor.
data_stream_iterator iterator_type
NDS::data_stream_iterator is the iterator type for this object.
Definition nds_data_iterator.hh:269
DLL_EXPORT void abort()
Abort an on-going iteration and close the underlying connection.
Definition nds_data_iterator.cc:103
DLL_EXPORT data_iterable & operator=(const data_iterable &other)
Copy assignment operator.
DLL_EXPORT data_iterable(data_iterable &&other) noexcept
Move constructor.
DLL_EXPORT iterator_type end()
Return a end/sentinal iterator.
Definition nds_data_iterator.cc:97
DLL_EXPORT iterator_type begin()
Return the current start tof the iteration.
Definition nds_data_iterator.cc:91
A input iterator.
Definition nds_data_iterator.hh:145
DLL_EXPORT data_stream_iterator & operator=(data_stream_iterator &&other) noexcept
Move operator.
DLL_EXPORT data_stream_iterator(data_stream_iterator &&other) noexcept
Move constructor.
DLL_EXPORT data_stream_iterator & operator++()
Definition nds_data_iterator.cc:57
DLL_EXPORT data_stream_iterator()
Default constructor.
Definition nds_data_iterator.cc:13
DLL_EXPORT data_stream_iterator(const data_stream_iterator &other)
Copy constructor.
DLL_EXPORT reference operator*()
Access the data at the current location of the iteration.
Definition nds_data_iterator.cc:52
DLL_EXPORT data_stream_iterator & operator=(const data_stream_iterator &other)
Copy operator.
The NDS client namespace.
Definition debug_stream.cc:18
This represents a [start, stop) time with an optional data stride.
Definition nds_data_iterator.hh:38
request_period(stride_type requested_stride)
Represent a request for an endless amount of live data with a given stride.
Definition nds_data_iterator.hh:82
static const stride_type FAST_STRIDE
a data stride of FAST_STRIDE requests sub-second data if possible. On systems that do not support sub...
Definition nds_data_iterator.hh:51
static const stride_type AUTO_STRIDE
a data stride of AUTO_STRIDE requests that the NDS systems determine the stride of data....
Definition nds_data_iterator.hh:61
request_period(gps_second_type requested_start, gps_second_type requested_stop)
Represent a request for bounded data [start, stop)
Definition nds_data_iterator.hh:99
request_period()
Default constructor, represent a request for an endless amount of live data.
Definition nds_data_iterator.hh:68
request_period(gps_second_type requested_start, gps_second_type requested_stop, stride_type requested_stride)
Represent a request for bounded data [start, stop) with a stride.
Definition nds_data_iterator.hh:121