http-downloader.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2020 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 #include <string>
7 #include <functional>
8 #include <vector>
9 
10 namespace rs2
11 {
12  namespace http
13  {
14 
16  typedef std::function<callback_result(uint64_t dl_current_bytes, uint64_t dl_total_bytes)> user_callback_func_type;
17 
18  struct progress_data; // Forward Declaration
19 
20  // This class is a service class for downloading a file from an HTTP URL.
21  // The class use libcurl as a client-side URL transfer library.
23  {
24  public:
26  ~http_downloader();
27 
28  // The optional callback function provides 2 major capabilities:
29  // - Current status about the download progress
30  // - Control the download process (stop/continue) using the return value of the callback function (true = stop download)
31  bool download_to_stream(const std::string& url, std::stringstream &output, user_callback_func_type user_callback_func = user_callback_func_type());
32  bool download_to_bytes_vector(const std::string& url, std::vector<uint8_t> &output, user_callback_func_type user_callback_func = user_callback_func_type());
33  bool download_to_file(const std::string& url, const std::string &file_name, user_callback_func_type user_callback_func = user_callback_func_type());
34 
35  private:
36  void register_progress_call_back(progress_data &progress_record, user_callback_func_type user_callback_func);
37  void set_common_options(const std::string &url);
38 
39  void* _curl;
40  };
41  }
42 }
Definition: cah-model.h:10
GLsizei const GLchar *const * string
std::function< callback_result(uint64_t dl_current_bytes, uint64_t dl_total_bytes)> user_callback_func_type


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:16