vision_batch.hpp
1 #ifndef NOOS_VISION_BATCH_HPP
2 #define NOOS_VISION_BATCH_HPP
3 #include <noos/cloud/includes.ihh>
4 #include <noos/cloud/asio/http_request.hpp>
5 #include <noos/cloud/cloud_base.hpp>
6 #include <noos/cloud/deserialize.hpp>
7 #include <noos/cloud/vision_base.hpp>
8 #include <noos/objects.hpp>
9 namespace noos {
10 namespace cloud {
18 template <class cloud_type>
19 struct tied
20 {
21  typedef typename cloud_type::callback callback;
22  cloud_type object;
23  callback functor;
25  tied(callback functor);
28  tied(callback functor, cloud_type object);
29 };
30 
32 template <class cloud_type>
33 tied<cloud_type> make_tie(typename cloud_type::callback functor);
34 
43 template <class... ties>
45 : public http_request,
46  public cloud_base<bool>,
47  public cloud_batch
48 {
49 public:
50  using callback = std::function<void(std::string)>;
51  typedef typename vision_batch<ties...>::data_type data_types;
58  ties... args);
65  void process(std::string json);
66 
67 protected:
68  // expand the tuple of ties
69  template<std::size_t... batch_size>
70  void expand_batch(std::string json,
71  std::string key,
72  std::index_sequence<batch_size...>);
73 
74  // find the cloud_pair (cloud_class and callack and pass the data)
75  void find_cloud_type(ties... args,
76  std::string json,
77  std::string key);
78 
79  noos::object::picture image__;
80  std::tuple<ties...> batch__;
81 };
82 }
83 }
84 #include "vision_batch.tpl"
85 #endif
nooser for the classes http_header &http_post used for cloud requests
Definition: http_request.hpp:20
tied is a convenience pair struct for object + functors used by vision_batch
Definition: vision_batch.hpp:19
cloud service batch class
Definition: cloud_base.hpp:49
Definition: asio_handler.hpp:14
class which wraps around raw bytes of a picture
Definition: picture.hpp:17
vision_batch
Definition: vision_batch.hpp:44
cloud service base class
Definition: cloud_base.hpp:15
tied< cloud_type > make_tie(typename cloud_type::callback functor)
simple helper - not really needed
tied(callback functor)
constructor requires only the functor