FlatCityBuf C++ reader 0.8.0
Native C++17 reader for FlatCityBuf, the cloud-optimized CityJSON format
Loading...
Searching...
No Matches
fcb::CurlRangeReader Class Reference

HTTP range-request adapter, opt-in via the FCB_WITH_CURL CMake option. More...

#include <fcb/http/curl_range_reader.hpp>

Inheritance diagram for fcb::CurlRangeReader:
fcb::RangeReader

Classes

struct  Impl
 

Public Member Functions

 CurlRangeReader (const std::string &url, CurlOptions options={})
 
 ~CurlRangeReader () override
 
 CurlRangeReader (const CurlRangeReader &)=delete
 
CurlRangeReaderoperator= (const CurlRangeReader &)=delete
 
std::uint64_t total_size () override
 Total byte length of the resource.
 
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.
 
std::uint64_t request_count () const
 Number of HTTP requests issued.
 
void reset_request_count ()
 
- Public Member Functions inherited from fcb::RangeReader
virtual ~RangeReader ()=default
 
virtual void read_batch (std::vector< RangeRequest > &requests)
 Fill every request, preserving order.
 

Detailed Description

HTTP range-request adapter, opt-in via the FCB_WITH_CURL CMake option.

libcurl is used rather than a header-only HTTP client specifically because it brings its own platform TLS (Schannel / SecureTransport / system OpenSSL), so this library never link-depends on a TLS stack. That is what keeps the vcpkg port acceptable.

Definition at line 35 of file curl_range_reader.hpp.

Constructor & Destructor Documentation

◆ CurlRangeReader() [1/2]

fcb::CurlRangeReader::CurlRangeReader ( const std::string &  url,
CurlOptions  options = {} 
)
explicit

Definition at line 137 of file curl_range_reader.cpp.

References fcb::HttpError.

◆ ~CurlRangeReader()

fcb::CurlRangeReader::~CurlRangeReader ( )
overridedefault

◆ CurlRangeReader() [2/2]

fcb::CurlRangeReader::CurlRangeReader ( const CurlRangeReader )
delete

Member Function Documentation

◆ operator=()

CurlRangeReader & fcb::CurlRangeReader::operator= ( const CurlRangeReader )
delete

◆ read()

std::vector< std::uint8_t > fcb::CurlRangeReader::read ( std::uint64_t  offset,
std::uint64_t  length 
)
overridevirtual

Read length bytes at offset, subject to the contract above.

Implements fcb::RangeReader.

Definition at line 200 of file curl_range_reader.cpp.

References fcb::HttpError, offset, and fcb::detail::range_end().

Referenced by total_size().

◆ request_count()

std::uint64_t fcb::CurlRangeReader::request_count ( ) const
inline

Number of HTTP requests issued.

Exists so tests can assert on the prefetch behaviour that justifies the buffering design.

Definition at line 48 of file curl_range_reader.hpp.

◆ reset_request_count()

void fcb::CurlRangeReader::reset_request_count ( )
inline

Definition at line 49 of file curl_range_reader.hpp.

◆ total_size()

std::uint64_t fcb::CurlRangeReader::total_size ( )
overridevirtual

Total byte length of the resource.

This is a REQUIRED bounds/security contract, not a convenience: every computed section offset and range request is validated against it, so a corrupt header cannot make the core read or allocate out of bounds. (It is NOT needed to size the last feature – every feature carries its own 4-byte size prefix.)

Implements fcb::RangeReader.

Definition at line 155 of file curl_range_reader.cpp.

References fcb::HttpError, and read().


The documentation for this class was generated from the following files: