From 1cebd0336c866b8f82a2afa7bb972bfa50bd53d2 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Wed, 17 Jul 2024 07:58:42 +0200 Subject: [PATCH] Remove `WriterProxyData` from public APIs (#95) * Refs #21301. Remove `WriterProxyData` from public APIs. Signed-off-by: Miguel Company * Refs #21301. Rename enum to `WriterDiscoveryStatus`. Signed-off-by: Miguel Company * Refs #21301. Rename header to `WriterDiscoveryStatus.hpp`. Signed-off-by: Miguel Company * Refs #21301. Use `fastcdr::string_255`. Signed-off-by: Miguel Company --------- Signed-off-by: Miguel Company --- include/DiscoveryServerManager.h | 5 +++-- src/DiscoveryServerManager.cpp | 27 +++++++++++++++------------ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/include/DiscoveryServerManager.h b/include/DiscoveryServerManager.h index e11dff9..cd779c9 100644 --- a/include/DiscoveryServerManager.h +++ b/include/DiscoveryServerManager.h @@ -289,7 +289,8 @@ class DiscoveryServerManager void on_data_writer_discovery( DomainParticipant* participant, - WriterDiscoveryInfo&& info, + rtps::WriterDiscoveryStatus reason, + const PublicationBuiltinTopicData& info, bool& should_be_ignored) override; // callback liveliness functions @@ -343,7 +344,7 @@ std::ostream& operator <<( ReaderDiscoveryInfo::DISCOVERY_STATUS); std::ostream& operator <<( std::ostream&, - WriterDiscoveryInfo::DISCOVERY_STATUS); + WriterDiscoveryStatus); } // namespace discovery_server } // namespace eprosima diff --git a/src/DiscoveryServerManager.cpp b/src/DiscoveryServerManager.cpp index e0030bf..bec5697 100644 --- a/src/DiscoveryServerManager.cpp +++ b/src/DiscoveryServerManager.cpp @@ -18,11 +18,13 @@ #include +#include #include #include #include #include #include +#include #include "DiscoveryServerManager.h" #include "IDs.h" @@ -1720,11 +1722,12 @@ void DiscoveryServerManager::on_data_reader_discovery( void DiscoveryServerManager::on_data_writer_discovery( DomainParticipant* participant, - WriterDiscoveryInfo&& info, + rtps::WriterDiscoveryStatus reason, + const PublicationBuiltinTopicData& info, bool& should_be_ignored) { - static_cast(should_be_ignored); - typedef WriterDiscoveryInfo::DISCOVERY_STATUS DS; + should_be_ignored = false; + typedef WriterDiscoveryStatus DS; // if the callback origin was removed ignore GUID_t srcGuid = participant->guid(); @@ -1735,8 +1738,8 @@ void DiscoveryServerManager::on_data_writer_discovery( return; } - const GUID_t& pubsid = info.info.guid(); - GUID_t partid = iHandle2GUID(info.info.RTPSParticipantKey()); + const GUID_t& pubsid = info.guid; + GUID_t partid = info.participant_guid; // non reported info std::string part_name; @@ -1781,7 +1784,7 @@ void DiscoveryServerManager::on_data_writer_discovery( part_name = ss.str(); } - switch (info.status) + switch (reason) { case DS::DISCOVERED_WRITER: @@ -1789,8 +1792,8 @@ void DiscoveryServerManager::on_data_writer_discovery( srcName, partid, pubsid, - info.info.typeName().to_string(), - info.info.topicName().to_string(), + info.type_name.to_string(), + info.topic_name.to_string(), callback_time); break; case DS::REMOVED_WRITER: @@ -1802,8 +1805,8 @@ void DiscoveryServerManager::on_data_writer_discovery( } LOG_INFO("Participant " << participant->get_qos().name().to_string() << " reports a publisher of participant " - << part_name << " is " << info.status << " with typename: " << info.info.typeName() - << " topic: " << info.info.topicName() << " GUID: " << pubsid); + << part_name << " is " << reason << " with typename: " << info.type_name + << " topic: " << info.topic_name << " GUID: " << pubsid); } void DiscoveryServerManager::on_liveliness_changed( @@ -1859,9 +1862,9 @@ std::ostream& eprosima::discovery_server::operator <<( std::ostream& eprosima::discovery_server::operator <<( std::ostream& o, - WriterDiscoveryInfo::DISCOVERY_STATUS s) + WriterDiscoveryStatus s) { - typedef WriterDiscoveryInfo::DISCOVERY_STATUS DS; + typedef WriterDiscoveryStatus DS; switch (s) {