multipart_stream.h
Go to the documentation of this file.
1 #ifndef MULTIPART_STREAM_H_
2 #define MULTIPART_STREAM_H_
3 
4 #include <ros/ros.h>
5 #include <async_web_server_cpp/http_connection.hpp>
6 
7 #include <queue>
8 
9 namespace web_video_server
10 {
11 
12 struct PendingFooter {
14  boost::weak_ptr<std::string> contents;
15 };
16 
18 public:
19  MultipartStream(async_web_server_cpp::HttpConnectionPtr& connection,
20  const std::string& boundry="boundarydonotcross",
21  std::size_t max_queue_size=1);
22 
23  void sendInitialHeader();
24  void sendPartHeader(const ros::Time &time, const std::string& type, size_t payload_size);
25  void sendPartFooter(const ros::Time &time);
26  void sendPartAndClear(const ros::Time &time, const std::string& type, std::vector<unsigned char> &data);
27  void sendPart(const ros::Time &time, const std::string& type, const boost::asio::const_buffer &buffer,
28  async_web_server_cpp::HttpConnection::ResourcePtr resource);
29 
30 private:
31  bool isBusy();
32 
33 private:
34  const std::size_t max_queue_size_;
35  async_web_server_cpp::HttpConnectionPtr connection_;
36  std::string boundry_;
37  std::queue<PendingFooter> pending_footers_;
38 };
39 
40 }
41 
42 #endif
async_web_server_cpp::HttpConnectionPtr connection_
boost::weak_ptr< std::string > contents
std::queue< PendingFooter > pending_footers_


web_video_server
Author(s): Mitchell Wills
autogenerated on Wed Jun 5 2019 20:38:04