| 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 |
nothing calls this directly
no test coverage detected