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

Don't copy contiguous bytes on reception #343

Merged
merged 11 commits into from
Dec 23, 2024
Prev Previous commit
Fix build errors
  • Loading branch information
fuzzypixelz committed Dec 20, 2024
commit e289a48d9f0546108f5ac8d4972dc162c6a40c49
6 changes: 3 additions & 3 deletions rmw_zenoh_cpp/src/detail/zenoh_utils.cpp
Original file line number Diff line number Diff line change
@@ -101,7 +101,7 @@ Payload::Payload(const zenoh::Bytes & bytes)
}
}

const uint8_t * Payload::data()
const uint8_t * Payload::data() const
{
if (std::holds_alternative<Empty>(bytes_)) {
return nullptr;
@@ -112,7 +112,7 @@ const uint8_t * Payload::data()
}
}

size_t Payload::size()
size_t Payload::size() const
{
if (std::holds_alternative<Empty>(bytes_)) {
return 0;
@@ -123,7 +123,7 @@ size_t Payload::size()
}
}

bool Payload::empty()
bool Payload::empty() const
{
return std::holds_alternative<Empty>(bytes_);
}
2 changes: 1 addition & 1 deletion rmw_zenoh_cpp/src/detail/zenoh_utils.hpp
Original file line number Diff line number Diff line change
@@ -91,7 +91,7 @@ class Payload
// Is `std::vector<uint8_t>` in case of a non-contiguous payload
// and `zenoh::Slice` plus a `zenoh::Bytes` otherwise.
std::variant<NonContiguous, Contiguous, Empty> bytes_;
}
};
} // namespace rmw_zenoh_cpp

#endif // DETAIL__ZENOH_UTILS_HPP_
Loading