nds2-client - ClientDeveloper  0.16.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nds_iterate_handler.hh
Go to the documentation of this file.
1 #ifndef __NDS_ITERATE_HANDLER_HH__
2 #define __NDS_ITERATE_HANDLER_HH__
3 
4 #include <memory>
5 #include "nds_buffer.hh"
6 
7 namespace NDS
8 {
9  namespace detail
10  {
11  struct conn_p_type;
12 
20  : public std::enable_shared_from_this< iterate_handler >
21  {
22  public:
23  explicit iterate_handler(
24  std::shared_ptr< NDS::detail::conn_p_type >&& conn_p )
25  : conn_p_{ conn_p }
26  {
27  }
28  virtual bool has_next( ) = 0;
29 
30  virtual void next( buffers_type& ) = 0;
31 
32  void next( );
33 
34  virtual ~iterate_handler( );
35 
36  virtual bool
37  done( )
38  {
39  return !has_next( );
40  }
41 
42  void abort( );
43 
44  std::shared_ptr< buffers_type > cache_;
45 
46  protected:
48  conn( )
49  {
50  return conn_p_.get( );
51  }
52 
53  private:
54  std::shared_ptr< NDS::detail::conn_p_type > conn_p_;
55 
56  void invalidate( );
57  };
58  }
59 }
60 
61 #endif // __NDS_ITERATE_HANDLER_HH__
Definition: nds_iterate_handler.hh:19
void next()
Definition: nds_iterate_handler.cc:12
std::shared_ptr< NDS::detail::conn_p_type > conn_p_
Definition: nds_iterate_handler.hh:54
iterate_handler(std::shared_ptr< NDS::detail::conn_p_type > &&conn_p)
Definition: nds_iterate_handler.hh:23
void abort()
Definition: nds_iterate_handler.cc:32
std::shared_ptr< buffers_type > cache_
Definition: nds_iterate_handler.hh:44
NDS::detail::conn_p_type * conn()
Definition: nds_iterate_handler.hh:48
virtual bool done()
Definition: nds_iterate_handler.hh:37
std::vector< buffer > buffers_type
Definition: nds_buffer.hh:356
Definition: nds_connection_ptype.hh:148
void invalidate()
Definition: nds_iterate_handler.cc:46