Skip to content

Commit

Permalink
Fix DomainParticipant::register_remote_type return when negotiating t…
Browse files Browse the repository at this point in the history
…ype (#3786)

* Refs #19359: Change ReturnCode when negotiating through type lookup service

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19359: Improve API reference

Signed-off-by: Eduardo Ponz <[email protected]>

* Refs #19359: Apply suggestions

Signed-off-by: Eduardo Ponz <[email protected]>

---------

Signed-off-by: Eduardo Ponz <[email protected]>
  • Loading branch information
EduPonz committed Aug 11, 2023
1 parent d27ad9d commit 107ea8d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
20 changes: 11 additions & 9 deletions include/fastdds/dds/domain/DomainParticipant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/fastdds/domain/DomainParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
17 changes: 17 additions & 0 deletions src/cpp/fastdds/domain/DomainParticipantImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 107ea8d

Please sign in to comment.