From 107ea8d64942102696840cd7d3e4cf93fa7a143e Mon Sep 17 00:00:00 2001 From: Eduardo Ponz Segrelles Date: Fri, 11 Aug 2023 13:40:25 +0200 Subject: [PATCH] Fix DomainParticipant::register_remote_type return when negotiating type (#3786) * Refs #19359: Change ReturnCode when negotiating through type lookup service Signed-off-by: Eduardo Ponz * Refs #19359: Improve API reference Signed-off-by: Eduardo Ponz * Refs #19359: Apply suggestions Signed-off-by: Eduardo Ponz --------- Signed-off-by: Eduardo Ponz --- .../fastdds/dds/domain/DomainParticipant.hpp | 20 ++++++++++--------- .../fastdds/domain/DomainParticipantImpl.cpp | 2 +- .../fastdds/domain/DomainParticipantImpl.hpp | 17 ++++++++++++++++ 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/include/fastdds/dds/domain/DomainParticipant.hpp b/include/fastdds/dds/domain/DomainParticipant.hpp index f140fc65b81..7ac5f4b8998 100644 --- a/include/fastdds/dds/domain/DomainParticipant.hpp +++ b/include/fastdds/dds/domain/DomainParticipant.hpp @@ -850,19 +850,21 @@ class DomainParticipant : public Entity const fastrtps::types::TypeIdentifierSeq& in) const; /** - * Helps the user to solve all dependencies calling internally to the typelookup service - * and registers the resulting dynamic type. - * The registration will be perform asynchronously and the user will be notified through the - * given callback, which receives the type_name as unique argument. - * If the type is already registered, the function will return true, but the callback will not be called. - * If the given type_information is enough to build the type without using the typelookup service, - * it will return true and the callback will be never called. + * Helps the user to solve all dependencies calling internally to the type lookup service and + * registers the resulting dynamic type. + * The registration may be perform asynchronously, case in which the user will be notified + * through the given callback, which receives the type_name as unique argument. * * @param type_information * @param type_name * @param callback - * @return true if type is already available (callback will not be called). false if type isn't available yet - * (the callback will be called if negotiation is success, and ignored in other case). + * @return RETCODE_OK If the given type_information is enough to build the type without using + * the typelookup service (callback will not be called). + * @return RETCODE_OK if the given type is already available (callback will not be called). + * @return RETCODE_NO_DATA if type is not available yet (the callback will be called if + * negotiation is success, and ignored in other case). + * @return RETCODE_NOT_ENABLED if the DomainParticipant is not enabled. + * @return RETCODE_PRECONDITION_NOT_MET if the DomainParticipant type lookup service is disabled. */ RTPS_DllAPI ReturnCode_t register_remote_type( const fastrtps::types::TypeInformation& type_information, diff --git a/src/cpp/fastdds/domain/DomainParticipantImpl.cpp b/src/cpp/fastdds/domain/DomainParticipantImpl.cpp index 496b53969c6..7be131a0222 100644 --- a/src/cpp/fastdds/domain/DomainParticipantImpl.cpp +++ b/src/cpp/fastdds/domain/DomainParticipantImpl.cpp @@ -1801,7 +1801,7 @@ ReturnCode_t DomainParticipantImpl::register_remote_type( // Move the filled vector to the map parent_requests_.emplace(std::make_pair(requestId, std::move(vector))); - return ReturnCode_t::RETCODE_OK; + return ReturnCode_t::RETCODE_NO_DATA; } return ReturnCode_t::RETCODE_PRECONDITION_NOT_MET; } diff --git a/src/cpp/fastdds/domain/DomainParticipantImpl.hpp b/src/cpp/fastdds/domain/DomainParticipantImpl.hpp index d93792c241d..ae11876d443 100644 --- a/src/cpp/fastdds/domain/DomainParticipantImpl.hpp +++ b/src/cpp/fastdds/domain/DomainParticipantImpl.hpp @@ -489,6 +489,23 @@ class DomainParticipantImpl fastrtps::rtps::SampleIdentity get_types( const fastrtps::types::TypeIdentifierSeq& in) const; + /** + * Helps the user to solve all dependencies calling internally to the typelookup service and + * registers the resulting dynamic type. + * The registration may be perform asynchronously, case in which the user will be notified + * through the given callback, which receives the type_name as unique argument. + * + * @param type_information + * @param type_name + * @param callback + * @return RETCODE_OK If the given type_information is enough to build the type without using + * the typelookup service (callback will not be called). + * @return RETCODE_OK if the given type is already available (callback will not be called). + * @return RETCODE_NO_DATA if type is not available yet (the callback will be called if + * negotiation is success, and ignored in other case). + * @return RETCODE_NOT_ENABLED if the DomainParticipant is not enabled. + * @return RETCODE_PRECONDITION_NOT_MET if the DomainParticipant type lookup service is disabled. + */ ReturnCode_t register_remote_type( const fastrtps::types::TypeInformation& type_information, const std::string& type_name,