Skip to content

Commit 8f39f14

Browse files
Set TopicDataType name before registering types in DomainParticipant (#73)
* Set TopicDataType name before registering TypeSupport in Participant. Signed-off-by: Carlosespicur <carlosespicur@proton.me> * Fix comment and warning Signed-off-by: Carlosespicur <carlosespicur@proton.me> --------- Signed-off-by: Carlosespicur <carlosespicur@proton.me>
1 parent cdd662a commit 8f39f14

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

plugins/datastreamer_plugin/datastreamer/FastDdsDataStreamer.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,6 @@ void FastDdsDataStreamer::on_topic_discovery(
213213
DEBUG("FastDdsDataStreamer topic_discovery_signal " << topic_name);
214214
bool type_info_available = fastdds_handler_.get_topic_data_base()->operator [](topic_name).second;
215215

216-
// __FLAG__
217-
DEBUG("topic discovery signal with type name " << type_name << " and type info available " << type_info_available);
218-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
219-
220216
// Emit signal to UI so it is handled from Qt thread
221217
emit select_topics_dialog_.topic_discovery_signal(
222218
utils::string_to_QString(topic_name),

plugins/datastreamer_plugin/fastdds/Participant.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -173,19 +173,17 @@ void Participant::create_subscription(
173173
DataTypeNameType type_name = discovery_database_->operator [](topic_name).first;
174174
DynamicType::_ref_type dyn_type;
175175

176-
// Check if type is already registered
176+
// Check if type info is available
177177
if (discovery_database_->operator [](topic_name).second == false)
178178
{
179-
WARNING("Type " << topic_name << " has not been registered yet");
179+
WARNING("Type " << topic_name << ": info not available yet");
180180
throw InconsistencyException("Trying to create Data Reader in a non registered type: " + topic_name);
181181
}
182182

183183
// Check if type is registered or not in participant. If not, register it
184184
if (!participant_->find_type(type_name))
185185
{
186-
// __FLAG__
187186
DEBUG("Type info not registered in participant for topic " << topic_name);
188-
//////////////////////////
189187

190188
// Type information is available but not registered in participant
191189
// Types manually loaded (through XML file) are registered in participant when loaded, so this case is not possible
@@ -204,6 +202,7 @@ void Participant::create_subscription(
204202
dyn_type = DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object(
205203
type_object)->build();
206204
TypeSupport dyn_type_support(new DynamicPubSubType(dyn_type));
205+
dyn_type_support->set_name(type_name);
207206
dyn_type_support.register_type(participant_);
208207
}
209208
else
@@ -307,9 +306,7 @@ void Participant::on_data_writer_discovery(
307306

308307
if (!info.type_information.assigned())
309308
{
310-
// __FLAG__
311309
DEBUG("Type information not assigned for topic " << topic_name);
312-
/////////////////////////////
313310
// If type info is not assigned, check if it can be generated through a xml
314311
on_topic_discovery_(topic_name, type_name);
315312
}
@@ -360,9 +357,7 @@ void Participant::on_topic_discovery_(
360357
const DataTypeId& type_id)
361358
{
362359
// TODO: check if mutex required
363-
// __FLAG__
364360
DEBUG("Calling on_topic_discovery with type id for topic " << topic_name);
365-
/////////////////
366361
bool is_already_discovered = false;
367362

368363
// Check if this topic has already been discovered
@@ -380,15 +375,9 @@ void Participant::on_topic_discovery_(
380375
if (!is_already_discovered)
381376
{
382377
// Add topic as discovered and save its type name and its type identifier to build DynamicType when DataReader is created
383-
// __FLAG__
384378
DEBUG("Topic " << topic_name << " discovered with type id");
385-
DEBUG("Updating databases...");
386-
DEBUG("...Updating discovery database...");
387379
discovery_database_->operator [](topic_name) = {type_name, true};
388-
DEBUG("...Updating dynamic types info database...");
389380
dyn_types_info_->operator [](topic_name) = {type_name, type_id};
390-
DEBUG("...Databases updated");
391-
/////////////////////////////////////////////
392381
}
393382

394383
// Call listener callback to notify new topic

0 commit comments

Comments
 (0)