MCPcopy Create free account
hub / github.com/apache/arrow / ReadCoords

Method ReadCoords

cpp/src/parquet/geospatial/util_internal.cc:67–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65
66 template <typename Coord, typename Visit>
67 void ReadCoords(uint32_t n_coords, bool swap, Visit&& visit) {
68 uint64_t total_bytes = 0;
69 if (::arrow::internal::MultiplyWithOverflow(static_cast<uint64_t>(n_coords),
70 static_cast<uint64_t>(sizeof(Coord)),
71 &total_bytes) ||
72 size_ < total_bytes) {
73 throw ParquetException("Can't read coordinate sequence of ", total_bytes,
74 " bytes from WKBBuffer with ", size_, " remaining");
75 }
76
77 if (swap) {
78 Coord coord;
79 for (uint32_t i = 0; i < n_coords; i++) {
80 coord = ReadUnchecked<Coord>();
81 for (auto& c : coord) {
82 c = ::arrow::bit_util::ByteSwap(c);
83 }
84
85 visit(coord);
86 }
87 } else {
88 for (uint32_t i = 0; i < n_coords; i++) {
89 visit(ReadUnchecked<Coord>());
90 }
91 }
92 }
93
94 size_t size() { return size_; }
95

Callers

nothing calls this directly

Calls 3

MultiplyWithOverflowFunction · 0.85
ParquetExceptionFunction · 0.85
ByteSwapFunction · 0.85

Tested by

no test coverage detected