From 1dad270e0734328dc48c6b5f33a0a38355cf3029 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Mon, 13 Jan 2025 19:17:41 +0100 Subject: [PATCH 1/2] Remove `gid_hash_` from `AttachmentData` (#416) This member is computed in the constructor which is in turn called in `rmw_publish`. This hash is not serialized as part of the attachment. (cherry picked from commit f040f5cc2d2a2a4d7c6e8713e9526a6273b95427) # Conflicts: # rmw_zenoh_cpp/src/detail/attachment_helpers.cpp # rmw_zenoh_cpp/src/detail/attachment_helpers.hpp --- rmw_zenoh_cpp/src/detail/attachment_helpers.cpp | 14 +++++--------- rmw_zenoh_cpp/src/detail/attachment_helpers.hpp | 8 ++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp b/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp index 9a10fc5e..e8a10e84 100644 --- a/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp +++ b/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp @@ -35,14 +35,12 @@ AttachmentData::AttachmentData( const std::array source_gid) : sequence_number_(sequence_number), source_timestamp_(source_timestamp), - source_gid_(source_gid), - gid_hash_(hash_gid(source_gid)) + source_gid_(source_gid) { } AttachmentData::AttachmentData(AttachmentData && data) { - gid_hash_ = std::move(data.gid_hash_); sequence_number_ = std::move(data.sequence_number_); source_timestamp_ = std::move(data.source_timestamp_); source_gid_ = data.source_gid_; @@ -66,12 +64,6 @@ std::array AttachmentData::copy_gid() const return source_gid_; } -///============================================================================= -size_t AttachmentData::gid_hash() const -{ - return gid_hash_; -} - zenoh::Bytes AttachmentData::serialize_to_zbytes() { auto serializer = zenoh::ext::Serializer(); @@ -103,7 +95,11 @@ AttachmentData::AttachmentData(const zenoh::Bytes & bytes) if (source_gid_str != "source_gid") { throw std::runtime_error("source_gid is not found in the attachment."); } +<<<<<<< HEAD this->source_gid_ = deserializer.deserialize>(); gid_hash_ = hash_gid(this->source_gid_); +======= + this->source_gid_ = deserializer.deserialize>(); +>>>>>>> f040f5c (Remove `gid_hash_` from `AttachmentData` (#416)) } } // namespace rmw_zenoh_cpp diff --git a/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp b/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp index 6de90587..93f21ca7 100644 --- a/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp +++ b/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp @@ -38,16 +38,24 @@ class AttachmentData final int64_t sequence_number() const; int64_t source_timestamp() const; +<<<<<<< HEAD std::array copy_gid() const; size_t gid_hash() const; +======= + std::array copy_gid() const; +>>>>>>> f040f5c (Remove `gid_hash_` from `AttachmentData` (#416)) zenoh::Bytes serialize_to_zbytes(); private: int64_t sequence_number_; int64_t source_timestamp_; +<<<<<<< HEAD std::array source_gid_; size_t gid_hash_; +======= + std::array source_gid_; +>>>>>>> f040f5c (Remove `gid_hash_` from `AttachmentData` (#416)) }; } // namespace rmw_zenoh_cpp From aee5770a7e3f05632b36644580c0f44c9fbc3455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Tue, 14 Jan 2025 11:15:50 +0100 Subject: [PATCH 2/2] fix merge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alejandro Hernández Cordero --- rmw_zenoh_cpp/src/detail/attachment_helpers.cpp | 5 ----- rmw_zenoh_cpp/src/detail/attachment_helpers.hpp | 10 ---------- 2 files changed, 15 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp b/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp index e8a10e84..f6a87e9f 100644 --- a/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp +++ b/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp @@ -95,11 +95,6 @@ AttachmentData::AttachmentData(const zenoh::Bytes & bytes) if (source_gid_str != "source_gid") { throw std::runtime_error("source_gid is not found in the attachment."); } -<<<<<<< HEAD this->source_gid_ = deserializer.deserialize>(); - gid_hash_ = hash_gid(this->source_gid_); -======= - this->source_gid_ = deserializer.deserialize>(); ->>>>>>> f040f5c (Remove `gid_hash_` from `AttachmentData` (#416)) } } // namespace rmw_zenoh_cpp diff --git a/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp b/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp index 93f21ca7..f9f32ff7 100644 --- a/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp +++ b/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp @@ -38,24 +38,14 @@ class AttachmentData final int64_t sequence_number() const; int64_t source_timestamp() const; -<<<<<<< HEAD std::array copy_gid() const; - size_t gid_hash() const; -======= - std::array copy_gid() const; ->>>>>>> f040f5c (Remove `gid_hash_` from `AttachmentData` (#416)) zenoh::Bytes serialize_to_zbytes(); private: int64_t sequence_number_; int64_t source_timestamp_; -<<<<<<< HEAD std::array source_gid_; - size_t gid_hash_; -======= - std::array source_gid_; ->>>>>>> f040f5c (Remove `gid_hash_` from `AttachmentData` (#416)) }; } // namespace rmw_zenoh_cpp