FlatCityBuf C++ reader 0.8.0
Native C++17 reader for FlatCityBuf, the cloud-optimized CityJSON format
Loading...
Searching...
No Matches
curl_range_reader.hpp
Go to the documentation of this file.
1#pragma once
2
3#ifdef FCB_WITH_CURL
4
5# include <fcb/error.hpp>
6# include <fcb/range_reader.hpp>
7
8# include <cstdint>
9# include <memory>
10# include <string>
11# include <vector>
12
13namespace fcb {
14
16 long timeout_ms = 30000;
17 long connect_timeout_ms = 10000;
18 bool follow_redirects = true;
19 std::string user_agent = "flatcitybuf-cpp/0.8";
20
27};
28
36 public:
37 explicit CurlRangeReader(const std::string& url, CurlOptions options = {});
38 ~CurlRangeReader() override;
39
42
43 std::uint64_t total_size() override;
44 std::vector<std::uint8_t> read(std::uint64_t offset, std::uint64_t length) override;
45
48 std::uint64_t request_count() const { return request_count_; }
49 void reset_request_count() { request_count_ = 0; }
50
51 private:
52 struct Impl;
53 std::unique_ptr<Impl> impl_;
54 std::uint64_t request_count_ = 0;
55};
56
57} // namespace fcb
58
59#endif // FCB_WITH_CURL
HTTP range-request adapter, opt-in via the FCB_WITH_CURL CMake option.
std::vector< std::uint8_t > read(std::uint64_t offset, std::uint64_t length) override
Read length bytes at offset, subject to the contract above.
CurlRangeReader(const CurlRangeReader &)=delete
~CurlRangeReader() override
std::uint64_t total_size() override
Total byte length of the resource.
CurlRangeReader & operator=(const CurlRangeReader &)=delete
std::uint64_t request_count() const
Number of HTTP requests issued.
Synchronous byte-range source.
std::uint64_t offset
Definition stree.cpp:57
bool require_stable_representation
Require the server to prove the representation has not changed between requests (ETag/If-Match,...