From f040f5cc2d2a2a4d7c6e8713e9526a6273b95427 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Mon, 13 Jan 2025 19:17:41 +0100 Subject: [PATCH] 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. --- rmw_zenoh_cpp/src/detail/attachment_helpers.cpp | 11 +---------- rmw_zenoh_cpp/src/detail/attachment_helpers.hpp | 2 -- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp b/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp index 6f128b47..29675b36 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(); @@ -104,6 +96,5 @@ AttachmentData::AttachmentData(const zenoh::Bytes & bytes) throw std::runtime_error("source_gid is not found in the attachment."); } this->source_gid_ = deserializer.deserialize>(); - gid_hash_ = hash_gid(this->source_gid_); } } // 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 64f444d1..4f2171e2 100644 --- a/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp +++ b/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp @@ -39,7 +39,6 @@ class AttachmentData final int64_t sequence_number() const; int64_t source_timestamp() const; std::array copy_gid() const; - size_t gid_hash() const; zenoh::Bytes serialize_to_zbytes(); @@ -47,7 +46,6 @@ class AttachmentData final int64_t sequence_number_; int64_t source_timestamp_; std::array source_gid_; - size_t gid_hash_; }; } // namespace rmw_zenoh_cpp