Set TopicDataType name before registering types in DomainParticipant #73
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR solves an issue reported in eProsima/Fast-DDS-python#222.
If the user sets the type name manually using
TopicDataType::set_name(type_name_A)
, an error happens when trying to create the topic in the Plotjuggler side Participant.On the Publisher side, the
TypeObject
that is registered in theTypeObjectRegistry
is built with a type nametype_name_B
, hardcoded in the code generated by Fast DDS Gen.On the PlotJuggler side, the Participant reconstructs the
TypeSupport
from the registeredTypeObject
, soTypeSupport->get_name()
returnstype_name_B
instead oftype_name_A
, which is received an stored internally through theon_data_writer_discovery
callback implementation. Therefore, the Participant registers the type with the nametype_name_B
, while the topic is attempted to be created with type nametype_name_A
, causing an error.There are two possible solutions to fix the problem:
DomainParticipant
API to register the type withtype_name_A
.TypeSupport
type name to the type name discovered usingTypeSupport->set_name(type_name_A)
before registering the type.This PR uses the second approach.