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

Classes

struct  FeatureAccess
 Internal gateway to Feature's generated FlatBuffers pointer. More...
 
struct  HeaderAccess
 Internal gateway to HeaderView's generated FlatBuffers pointer. More...
 

Functions

std::uint64_t checked_add (std::uint64_t a, std::uint64_t b, const char *what="add")
 
std::uint64_t checked_mul (std::uint64_t a, std::uint64_t b, const char *what="mul")
 
std::uint64_t ceil_div (std::uint64_t a, std::uint64_t b)
 ceil(a / b) without the (a + b - 1) overflow hazard.
 
std::uint64_t range_end (std::uint64_t offset, std::uint64_t length)
 End of a range, checked.
 
void require_within (std::uint64_t offset, std::uint64_t length, std::uint64_t limit, const char *what)
 Throws unless [offset, offset+length) lies wholly within limit.
 

Function Documentation

◆ ceil_div()

std::uint64_t fcb::detail::ceil_div ( std::uint64_t  a,
std::uint64_t  b 
)
inline

ceil(a / b) without the (a + b - 1) overflow hazard.

Throws on b == 0 rather than trapping, because callers pass file-supplied divisors.

Definition at line 34 of file checked.hpp.

References ceil_div(), and fcb::IllegalHeaderSize.

Referenced by ceil_div(), fcb::rtree_level_bounds(), fcb::rtree_num_nodes(), fcb::stree_level_bounds(), and fcb::stree_num_nodes().

◆ checked_add()

std::uint64_t fcb::detail::checked_add ( std::uint64_t  a,
std::uint64_t  b,
const char *  what = "add" 
)
inline

◆ checked_mul()

std::uint64_t fcb::detail::checked_mul ( std::uint64_t  a,
std::uint64_t  b,
const char *  what = "mul" 
)
inline

Definition at line 24 of file checked.hpp.

References checked_mul(), and fcb::IllegalHeaderSize.

Referenced by checked_mul(), fcb::rtree_search_bbox(), and fcb::stree_query().

◆ range_end()

std::uint64_t fcb::detail::range_end ( std::uint64_t  offset,
std::uint64_t  length 
)
inline

End of a range, checked.

Use at EVERY place that forms offset+length: cache coverage tests, feature cursor advance, node slab bounds, payload entry bounds, and HTTP Range header construction.

Definition at line 44 of file checked.hpp.

References checked_add(), and offset.

Referenced by fcb::CurlRangeReader::read(), and require_within().

◆ require_within()

void fcb::detail::require_within ( std::uint64_t  offset,
std::uint64_t  length,
std::uint64_t  limit,
const char *  what 
)
inline

Throws unless [offset, offset+length) lies wholly within limit.

Definition at line 49 of file checked.hpp.

References fcb::IllegalHeaderSize, offset, and range_end().

Referenced by fcb::FeatureIterator::next().