Skip to content

Commit

Permalink
fix: cleaner function signature serializeStl -> serialize
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanchristopheruel committed Mar 17, 2024
1 parent 3efc935 commit 7fd394c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ if (!file.is_open()) {
}
std::vector<openstl::Triangle> originalTriangles{}; // User triangles
openstl::serializeStl(originalTriangles, file, openstl::StlFormat::Binary); // Or StlFormat::ASCII
openstl::serialize(originalTriangles, file, openstl::StlFormat::Binary); // Or StlFormat::ASCII
if (file.fail()) {
std::cerr << "Error: Failed to write to file " << filename << std::endl;
Expand All @@ -104,7 +104,7 @@ file.close();
std::stringstream ss;

std::vector<openstl::Triangle> originalTriangles{}; // User triangles
openstl::serializeStl(originalTriangles, ss, openstl::StlFormat::Binary); // Or StlFormat::ASCII
openstl::serialize(originalTriangles, ss, openstl::StlFormat::Binary); // Or StlFormat::ASCII
```
# Integrate to your codebase
Expand Down
2 changes: 1 addition & 1 deletion modules/core/include/openstl/core/stl.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ namespace openstl
* @param format The format of the STL file (ASCII or binary).
*/
template <typename Stream, typename Container>
inline void serializeStl(const Container& triangles, Stream& stream, StlFormat format) {
inline void serialize(const Container& triangles, Stream& stream, StlFormat format) {
switch (format) {
case StlFormat::ASCII:
serializeAsciiStl(triangles, stream);
Expand Down
2 changes: 1 addition & 1 deletion python/core/src/stl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void serialize(py::module_ &m) {
return false;

StridedTriangleSpan stridedIter{buf.data(), (size_t)buf.shape(0)};
openstl::serializeStl(stridedIter, file, format); // Or StlFormat::ASCII
openstl::serialize(stridedIter, file, format);

if (file.fail()) {
std::cerr << "Error: Failed to write to file " << filename << std::endl;
Expand Down
6 changes: 3 additions & 3 deletions tests/core/src/serialize.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TEST_CASE("Serialize STL triangles", "[openstl]") {
REQUIRE(stream.is_open());

// Serialize the triangles in binary format
serializeStl(originalTriangles, stream, StlFormat::Binary);
serialize(originalTriangles, stream, StlFormat::Binary);
REQUIRE_FALSE(stream.fail());
stream.close();

Expand All @@ -58,7 +58,7 @@ TEST_CASE("Serialize STL triangles", "[openstl]") {
std::stringstream ss;

// Serialize the triangles in binary format
serializeStl(originalTriangles, ss, StlFormat::Binary);
serialize(originalTriangles, ss, StlFormat::Binary);

// Deserialize the serialized triangles
ss.seekg(0);
Expand All @@ -78,7 +78,7 @@ TEST_CASE("Serialize STL triangles", "[openstl]") {
REQUIRE(stream.is_open());

// Serialize the triangles in ASCII format
serializeStl(originalTriangles, stream, StlFormat::ASCII);
serialize(originalTriangles, stream, StlFormat::ASCII);
REQUIRE_FALSE(stream.fail());
stream.close();

Expand Down

0 comments on commit 7fd394c

Please sign in to comment.