@@ -166,22 +166,8 @@ void fill_complex_endpoint(
166
166
result.guid = endpoint.guid ;
167
167
result.topic .topic_name = endpoint.topic .m_topic_name ;
168
168
result.topic .topic_type = endpoint.topic .type_name ;
169
- if (endpoint.topic .topic_qos .durability_qos ) // TODO move to YamlWriter
170
- {
171
- result.qos .durability = " transient-local" ;
172
- }
173
- else
174
- {
175
- result.qos .durability = " volatile" ;
176
- }
177
- if (endpoint.topic .topic_qos .reliability_qos )
178
- {
179
- result.qos .reliability = " best-effort" ;
180
- }
181
- else
182
- {
183
- result.qos .reliability = " reliable" ;
184
- }
169
+ result.qos .durability = endpoint.topic .topic_qos .durability_qos ;
170
+ result.qos .reliability = endpoint.topic .topic_qos .reliability_qos ;
185
171
}
186
172
187
173
void set_endpoint_simple_information (
@@ -303,7 +289,7 @@ std::set<eprosima::ddspipe::core::types::DdsTopic> get_topics(
303
289
return result;
304
290
}
305
291
306
- ddspipe::core::types::DdsTopic get_topic (
292
+ ddspipe::core::types::DdsTopic ModelParser:: get_topic (
307
293
const SpyModel& model,
308
294
std::string topic_name)
309
295
{
@@ -349,7 +335,7 @@ std::vector<SimpleTopicData> ModelParser::topics(
349
335
datawriters,
350
336
datareaders,
351
337
{
352
- 10 , // TODO not implementated yet
338
+ model. get_topic_rate (topic),
353
339
" Hz"
354
340
}
355
341
});
@@ -377,42 +363,39 @@ ComplexTopicData ModelParser::topics(
377
363
const std::string& topic_name)
378
364
{
379
365
ComplexTopicData result;
380
- std::vector<ComplexTopicData::Endpoint> datareaders;
381
- std::vector<ComplexTopicData::Endpoint> datawriters;
382
366
383
- std::string type_name = " Not discovered yet" ;
367
+ // Lets check if topic exists
368
+ auto topic = get_topic (model, topic_name);
369
+
370
+ // If topic not found, return an empty Daa
371
+ if (topic.m_topic_name != topic_name)
372
+ {
373
+ result.name = " " ;
374
+ return result;
375
+ }
376
+
377
+ // Topic found, fill its information
378
+ result.name = topic.m_topic_name ;
379
+ result.type = topic.type_name ;
380
+ result.discovered = model.is_topic_type_discovered (topic);
381
+ result.rate .rate = model.get_topic_rate (topic);
382
+ result.rate .unit = " Hz" ;
384
383
385
384
for (const auto & it : model.endpoint_database_ )
386
385
{
387
- if (it. second . topic .m_topic_name == topic_name )
386
+ if (topic.m_topic_name == it. second . topic . m_topic_name )
388
387
{
389
- type_name = it.second .topic .type_name ;
390
388
if (it.second .is_reader ())
391
389
{
392
- datareaders.push_back ({it.first });
390
+ result. datareaders .push_back ({it.first });
393
391
}
394
392
if (it.second .is_writer ())
395
393
{
396
- datawriters.push_back ({it.first });
394
+ result. datawriters .push_back ({it.first });
397
395
}
398
396
}
399
397
}
400
398
401
- if (type_name == " Not discovered yet" )
402
- {
403
- result.name = " " ;
404
- }
405
- else
406
- {
407
- result.name = topic_name;
408
- }
409
- result.type = type_name;
410
- result.datawriters = datawriters;
411
- result.datareaders = datareaders;
412
- result.rate .rate = 10 ;
413
- result.rate .unit = " Hz" ; // TODO not implementated yet
414
- result.discovered = model.is_topic_type_discovered (get_topic (model, topic_name));
415
-
416
399
return result;
417
400
}
418
401
0 commit comments