nds2-client - ClientDeveloper  0.16.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nds_data_iterator.hh
Go to the documentation of this file.
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 
14 namespace 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;
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;
149  typedef value_type* pointer;
150  typedef std::size_t difference_type;
151  typedef std::input_iterator_tag iterator_category;
152 
167  DLL_EXPORT
176  DLL_EXPORT
177  data_stream_iterator( data_stream_iterator&& other ) noexcept;
178 
179  DLL_EXPORT
180  data_stream_iterator( std::shared_ptr< detail::iterate_handler > p,
181  value_type c );
182 
184 
194  DLL_EXPORT data_stream_iterator&
195  operator=( const data_stream_iterator& other );
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_;
235  };
236 
263  {
264  public:
269  typedef data_stream_iterator iterator_type;
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:262
DLL_EXPORT data_stream_iterator()
Default constructor.
Definition: nds_data_iterator.cc:13
value_type & reference
Definition: nds_data_iterator.hh:148
std::shared_ptr< buffers_type > value_type
Definition: nds_data_iterator.hh:147
std::input_iterator_tag iterator_category
Definition: nds_data_iterator.hh:151
std::shared_ptr< detail::iterate_handler > p_
Definition: nds_data_iterator.hh:233
A input iterator.
Definition: nds_data_iterator.hh:144
gps_second_type start
Definition: nds_data_iterator.hh:41
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
long stride_type
Definition: nds_data_iterator.hh:40
NDS::buffer::gps_second_type gps_second_type
Definition: nds_data_iterator.hh:39
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
request_period()
Default constructor, represent a request for an endless amount of live data.
Definition: nds_data_iterator.hh:68
value_type * pointer
Definition: nds_data_iterator.hh:149
This represents a [start, stop) time with an optional data stride.
Definition: nds_data_iterator.hh:37
#define DLL_EXPORT
Definition: channel.h:12
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
data_stream_iterator iterator_type
NDS::data_stream_iterator is the iterator type for this object.
Definition: nds_data_iterator.hh:269
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
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
std::size_t difference_type
Definition: nds_data_iterator.hh:150
value_type cache_
Definition: nds_data_iterator.hh:234
gps_second_type stop
Definition: nds_data_iterator.hh:42
stride_type stride
Definition: nds_data_iterator.hh:43