Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[c++] Change BinaryBuffer type #3233

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libtiledbsoma/src/geometry/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum GeometryType : uint32_t {
GEOMETRYCOLLECTION = 7
};

using BinaryBuffer = std::vector<uint8_t>;
using BinaryBuffer = std::vector<std::byte>;

struct GeometryCollection;
using GenericGeometry = std::variant<
Expand Down
2 changes: 1 addition & 1 deletion libtiledbsoma/src/geometry/operators/io/read.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct Reader<BinaryBuffer> {
return value;
}

std::vector<uint8_t> buffer;
std::vector<std::byte> buffer;
size_t position;
};

Expand Down
4 changes: 2 additions & 2 deletions libtiledbsoma/src/geometry/operators/io/write.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ size_t wkb_size(const GenericGeometry& geometry) {
}

WKBWriteOperator::WKBWriteOperator(
uint8_t* buffer, size_t& position, size_t size)
std::byte* buffer, size_t& position, size_t size)
: buffer(buffer)
, position(position)
, size(size) {
Expand Down Expand Up @@ -185,7 +185,7 @@ void WKBWriteOperator::operator()(const GeometryCollection& collection) {
}
}

void to_wkb(const GenericGeometry& geometry, uint8_t* buffer, size_t size) {
void to_wkb(const GenericGeometry& geometry, std::byte* buffer, size_t size) {
size_t position = 0;

std::visit(WKBWriteOperator{buffer, position, size}, geometry);
Expand Down
4 changes: 2 additions & 2 deletions libtiledbsoma/src/geometry/operators/io/write.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct WKBSizeOperator {
};

struct WKBWriteOperator {
WKBWriteOperator(uint8_t* buffer, size_t& position, size_t size);
WKBWriteOperator(std::byte* buffer, size_t& position, size_t size);

template <typename T>
void write(const T& value) {
Expand All @@ -47,7 +47,7 @@ struct WKBWriteOperator {
void operator()(const MultiPolygon& multi_polygon);
void operator()(const GeometryCollection& collection);

uint8_t* buffer;
std::byte* buffer;
size_t& position;
size_t size;
};
Expand Down
5 changes: 1 addition & 4 deletions libtiledbsoma/test/unit_soma_geometry_dataframe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,7 @@ TEST_CASE("SOMAGeometryDataFrame: Roundtrip", "[SOMAGeometryDataFrame]") {
CHECK(
std::vector<double_t>({1}) ==
std::vector<double_t>(d4span.begin(), d4span.end()));
auto a = geometry::to_wkb(polygon);
for (size_t i = 0; i < wkbs[0].size(); ++i) {
CHECK(a[i] == (unsigned char)wkbs[0][i]);
}
CHECK(geometry::to_wkb(polygon) == wkbs[0]);
CHECK(
std::vector<double_t>({63}) ==
std::vector<double>(a0span.begin(), a0span.end()));
Expand Down
Loading