Skip to content

Commit 6ae5eaf

Browse files
Add QoS getters from raw XML
Signed-off-by: Juan Lopez Fernandez <[email protected]>
1 parent 37cd84d commit 6ae5eaf

16 files changed

+484
-4
lines changed

include/fastdds/dds/domain/DomainParticipant.hpp

+25
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,11 @@ class DomainParticipant : public Entity
547547
const std::string& profile_name,
548548
PublisherQos& qos) const;
549549

550+
FASTDDS_EXPORTED_API ReturnCode_t get_publisher_qos_from_xml(
551+
const std::string& xml,
552+
PublisherQos& qos,
553+
const std::string& profile_name = "") const;
554+
550555
/**
551556
* This operation sets a default value of the Subscriber QoS policies that will be used for newly created
552557
* Subscriber entities in the case where the QoS policies are defaulted in the create_subscriber operation.
@@ -601,6 +606,11 @@ class DomainParticipant : public Entity
601606
const std::string& profile_name,
602607
SubscriberQos& qos) const;
603608

609+
FASTDDS_EXPORTED_API ReturnCode_t get_subscriber_qos_from_xml(
610+
const std::string& xml,
611+
SubscriberQos& qos,
612+
const std::string& profile_name = "") const;
613+
604614
/**
605615
* This operation sets a default value of the Topic QoS policies which will be used for newly created
606616
* Topic entities in the case where the QoS policies are defaulted in the create_topic operation.
@@ -655,6 +665,11 @@ class DomainParticipant : public Entity
655665
const std::string& profile_name,
656666
TopicQos& qos) const;
657667

668+
FASTDDS_EXPORTED_API ReturnCode_t get_topic_qos_from_xml(
669+
const std::string& xml,
670+
TopicQos& qos,
671+
const std::string& profile_name = "") const;
672+
658673
/**
659674
* Fills the ReplierQos with the values of the XML profile.
660675
*
@@ -666,6 +681,11 @@ class DomainParticipant : public Entity
666681
const std::string& profile_name,
667682
ReplierQos& qos) const;
668683

684+
FASTDDS_EXPORTED_API ReturnCode_t get_replier_qos_from_xml(
685+
const std::string& xml,
686+
ReplierQos& qos,
687+
const std::string& profile_name = "") const;
688+
669689
/**
670690
* Fills the RequesterQos with the values of the XML profile.
671691
*
@@ -677,6 +697,11 @@ class DomainParticipant : public Entity
677697
const std::string& profile_name,
678698
RequesterQos& qos) const;
679699

700+
FASTDDS_EXPORTED_API ReturnCode_t get_requester_qos_from_xml(
701+
const std::string& xml,
702+
RequesterQos& qos,
703+
const std::string& profile_name = "") const;
704+
680705
/**
681706
* Retrieves the list of DomainParticipants that have been discovered in the domain and are not "ignored".
682707
*

include/fastdds/dds/domain/DomainParticipantFactory.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ class DomainParticipantFactory
229229
const std::string& profile_name,
230230
DomainParticipantQos& qos) const;
231231

232+
FASTDDS_EXPORTED_API ReturnCode_t get_participant_qos_from_xml(
233+
const std::string& xml,
234+
DomainParticipantQos& qos,
235+
const std::string& profile_name = "") const;
236+
232237
/**
233238
* Fills the DomainParticipantExtendedQos with the values of the XML profile.
234239
*

include/fastdds/dds/publisher/Publisher.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,12 @@ class Publisher : public DomainEntity
342342
const std::string& profile_name,
343343
DataWriterQos& qos) const;
344344

345+
FASTDDS_EXPORTED_API ReturnCode_t get_datawriter_qos_from_xml(
346+
const std::string& xml,
347+
DataWriterQos& qos,
348+
std::string& topic_name,
349+
const std::string& profile_name = "") const;
350+
345351
/**
346352
* Returns the Publisher's handle.
347353
*

include/fastdds/dds/subscriber/Subscriber.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@ class Subscriber : public DomainEntity
355355
const std::string& profile_name,
356356
DataReaderQos& qos) const;
357357

358+
FASTDDS_EXPORTED_API ReturnCode_t get_datareader_qos_from_xml(
359+
const std::string& xml,
360+
DataReaderQos& qos,
361+
std::string& topic_name,
362+
const std::string& profile_name = "") const;
363+
358364
/**
359365
* @brief Copies TopicQos into the corresponding DataReaderQos
360366
*

src/cpp/fastdds/domain/DomainParticipant.cpp

+44-4
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,14 @@ ReturnCode_t DomainParticipant::get_publisher_qos_from_profile(
336336
return impl_->get_publisher_qos_from_profile(profile_name, qos);
337337
}
338338

339+
ReturnCode_t DomainParticipant::get_publisher_qos_from_xml(
340+
const std::string& xml,
341+
PublisherQos& qos,
342+
const std::string& profile_name) const
343+
{
344+
return impl_->get_publisher_qos_from_xml(xml, qos, profile_name);
345+
}
346+
339347
ReturnCode_t DomainParticipant::set_default_subscriber_qos(
340348
const SubscriberQos& qos)
341349
{
@@ -361,6 +369,14 @@ ReturnCode_t DomainParticipant::get_subscriber_qos_from_profile(
361369
return impl_->get_subscriber_qos_from_profile(profile_name, qos);
362370
}
363371

372+
ReturnCode_t DomainParticipant::get_subscriber_qos_from_xml(
373+
const std::string& xml,
374+
SubscriberQos& qos,
375+
const std::string& profile_name) const
376+
{
377+
return impl_->get_subscriber_qos_from_xml(xml, qos, profile_name);
378+
}
379+
364380
ReturnCode_t DomainParticipant::set_default_topic_qos(
365381
const TopicQos& qos)
366382
{
@@ -386,11 +402,12 @@ ReturnCode_t DomainParticipant::get_topic_qos_from_profile(
386402
return impl_->get_topic_qos_from_profile(profile_name, qos);
387403
}
388404

389-
ReturnCode_t DomainParticipant::get_replier_qos_from_profile(
390-
const std::string& profile_name,
391-
ReplierQos& qos) const
405+
ReturnCode_t DomainParticipant::get_topic_qos_from_xml(
406+
const std::string& xml,
407+
TopicQos& qos,
408+
const std::string& profile_name) const
392409
{
393-
return impl_->get_replier_qos_from_profile(profile_name, qos);
410+
return impl_->get_topic_qos_from_xml(xml, qos, profile_name);
394411
}
395412

396413
ReturnCode_t DomainParticipant::get_requester_qos_from_profile(
@@ -400,6 +417,29 @@ ReturnCode_t DomainParticipant::get_requester_qos_from_profile(
400417
return impl_->get_requester_qos_from_profile(profile_name, qos);
401418
}
402419

420+
ReturnCode_t DomainParticipant::get_requester_qos_from_xml(
421+
const std::string& xml,
422+
RequesterQos& qos,
423+
const std::string& profile_name) const
424+
{
425+
return impl_->get_requester_qos_from_xml(xml, qos, profile_name);
426+
}
427+
428+
ReturnCode_t DomainParticipant::get_replier_qos_from_profile(
429+
const std::string& profile_name,
430+
ReplierQos& qos) const
431+
{
432+
return impl_->get_replier_qos_from_profile(profile_name, qos);
433+
}
434+
435+
ReturnCode_t DomainParticipant::get_replier_qos_from_xml(
436+
const std::string& xml,
437+
ReplierQos& qos,
438+
const std::string& profile_name) const
439+
{
440+
return impl_->get_replier_qos_from_xml(xml, qos, profile_name);
441+
}
442+
403443
ReturnCode_t DomainParticipant::get_discovered_participants(
404444
std::vector<InstanceHandle_t>& participant_handles) const
405445
{

src/cpp/fastdds/domain/DomainParticipantFactory.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,22 @@ ReturnCode_t DomainParticipantFactory::get_participant_qos_from_profile(
341341
return RETCODE_BAD_PARAMETER;
342342
}
343343

344+
ReturnCode_t DomainParticipantFactory::get_participant_qos_from_xml(
345+
const std::string& xml,
346+
DomainParticipantQos& qos,
347+
const std::string& profile_name) const
348+
{
349+
ParticipantAttributes attr;
350+
if (XMLP_ret::XML_OK == XMLProfileManager::fill_participant_attributes_from_xml(xml, attr, profile_name))
351+
{
352+
qos = default_participant_qos_;
353+
utils::set_qos_from_attributes(qos, attr.rtps);
354+
return RETCODE_OK;
355+
}
356+
357+
return RETCODE_BAD_PARAMETER;
358+
}
359+
344360
ReturnCode_t DomainParticipantFactory::get_participant_extended_qos_from_profile(
345361
const std::string& profile_name,
346362
DomainParticipantExtendedQos& extended_qos) const

src/cpp/fastdds/domain/DomainParticipantImpl.cpp

+78
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,22 @@ ReturnCode_t DomainParticipantImpl::get_publisher_qos_from_profile(
10441044
return RETCODE_BAD_PARAMETER;
10451045
}
10461046

1047+
ReturnCode_t DomainParticipantImpl::get_publisher_qos_from_xml(
1048+
const std::string& xml,
1049+
PublisherQos& qos,
1050+
const std::string& profile_name) const
1051+
{
1052+
xmlparser::PublisherAttributes attr;
1053+
if (XMLP_ret::XML_OK == XMLProfileManager::fill_publisher_attributes_from_xml(xml, attr, profile_name))
1054+
{
1055+
qos = default_pub_qos_;
1056+
utils::set_qos_from_attributes(qos, attr);
1057+
return RETCODE_OK;
1058+
}
1059+
1060+
return RETCODE_BAD_PARAMETER;
1061+
}
1062+
10471063
ReturnCode_t DomainParticipantImpl::set_default_subscriber_qos(
10481064
const SubscriberQos& qos)
10491065
{
@@ -1092,6 +1108,22 @@ ReturnCode_t DomainParticipantImpl::get_subscriber_qos_from_profile(
10921108
return RETCODE_BAD_PARAMETER;
10931109
}
10941110

1111+
ReturnCode_t DomainParticipantImpl::get_subscriber_qos_from_xml(
1112+
const std::string& xml,
1113+
SubscriberQos& qos,
1114+
const std::string& profile_name) const
1115+
{
1116+
xmlparser::SubscriberAttributes attr;
1117+
if (XMLP_ret::XML_OK == XMLProfileManager::fill_subscriber_attributes_from_xml(xml, attr, profile_name))
1118+
{
1119+
qos = default_sub_qos_;
1120+
utils::set_qos_from_attributes(qos, attr);
1121+
return RETCODE_OK;
1122+
}
1123+
1124+
return RETCODE_BAD_PARAMETER;
1125+
}
1126+
10951127
ReturnCode_t DomainParticipantImpl::set_default_topic_qos(
10961128
const TopicQos& qos)
10971129
{
@@ -1140,6 +1172,22 @@ ReturnCode_t DomainParticipantImpl::get_topic_qos_from_profile(
11401172
return RETCODE_BAD_PARAMETER;
11411173
}
11421174

1175+
ReturnCode_t DomainParticipantImpl::get_topic_qos_from_xml(
1176+
const std::string& profile_name,
1177+
TopicQos& qos,
1178+
const std::string& xml) const
1179+
{
1180+
xmlparser::TopicAttributes attr;
1181+
if (XMLP_ret::XML_OK == XMLProfileManager::fill_topic_attributes_from_xml(xml, attr, profile_name))
1182+
{
1183+
qos = default_topic_qos_;
1184+
utils::set_qos_from_attributes(qos, attr);
1185+
return RETCODE_OK;
1186+
}
1187+
1188+
return RETCODE_BAD_PARAMETER;
1189+
}
1190+
11431191
ReturnCode_t DomainParticipantImpl::get_replier_qos_from_profile(
11441192
const std::string& profile_name,
11451193
ReplierQos& qos) const
@@ -1154,6 +1202,21 @@ ReturnCode_t DomainParticipantImpl::get_replier_qos_from_profile(
11541202
return RETCODE_BAD_PARAMETER;
11551203
}
11561204

1205+
ReturnCode_t DomainParticipantImpl::get_replier_qos_from_xml(
1206+
const std::string& xml,
1207+
ReplierQos& qos,
1208+
const std::string& profile_name) const
1209+
{
1210+
xmlparser::ReplierAttributes attr;
1211+
if (XMLP_ret::XML_OK == XMLProfileManager::fill_replier_attributes_from_xml(xml, attr, profile_name))
1212+
{
1213+
utils::set_qos_from_attributes(qos, attr);
1214+
return RETCODE_OK;
1215+
}
1216+
1217+
return RETCODE_BAD_PARAMETER;
1218+
}
1219+
11571220
ReturnCode_t DomainParticipantImpl::get_requester_qos_from_profile(
11581221
const std::string& profile_name,
11591222
RequesterQos& qos) const
@@ -1168,6 +1231,21 @@ ReturnCode_t DomainParticipantImpl::get_requester_qos_from_profile(
11681231
return RETCODE_BAD_PARAMETER;
11691232
}
11701233

1234+
ReturnCode_t DomainParticipantImpl::get_requester_qos_from_xml(
1235+
const std::string& xml,
1236+
RequesterQos& qos,
1237+
const std::string& profile_name) const
1238+
{
1239+
xmlparser::RequesterAttributes attr;
1240+
if (XMLP_ret::XML_OK == XMLProfileManager::fill_requester_attributes_from_xml(xml, attr, profile_name))
1241+
{
1242+
utils::set_qos_from_attributes(qos, attr);
1243+
return RETCODE_OK;
1244+
}
1245+
1246+
return RETCODE_BAD_PARAMETER;
1247+
}
1248+
11711249
/* TODO
11721250
bool DomainParticipantImpl::get_discovered_participants(
11731251
std::vector<InstanceHandle_t>& participant_handles) const

src/cpp/fastdds/domain/DomainParticipantImpl.hpp

+25
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,11 @@ class DomainParticipantImpl
375375
const std::string& profile_name,
376376
PublisherQos& qos) const;
377377

378+
ReturnCode_t get_publisher_qos_from_xml(
379+
const std::string& xml,
380+
PublisherQos& qos,
381+
const std::string& profile_name = "") const;
382+
378383
ReturnCode_t set_default_subscriber_qos(
379384
const SubscriberQos& qos);
380385

@@ -386,6 +391,11 @@ class DomainParticipantImpl
386391
const std::string& profile_name,
387392
SubscriberQos& qos) const;
388393

394+
ReturnCode_t get_subscriber_qos_from_xml(
395+
const std::string& xml,
396+
SubscriberQos& qos,
397+
const std::string& profile_name = "") const;
398+
389399
ReturnCode_t set_default_topic_qos(
390400
const TopicQos& qos);
391401

@@ -397,14 +407,29 @@ class DomainParticipantImpl
397407
const std::string& profile_name,
398408
TopicQos& qos) const;
399409

410+
ReturnCode_t get_topic_qos_from_xml(
411+
const std::string& xml,
412+
TopicQos& qos,
413+
const std::string& profile_name = "") const;
414+
400415
ReturnCode_t get_replier_qos_from_profile(
401416
const std::string& profile_name,
402417
ReplierQos& qos) const;
403418

419+
ReturnCode_t get_replier_qos_from_xml(
420+
const std::string& xml,
421+
ReplierQos& qos,
422+
const std::string& profile_name = "") const;
423+
404424
ReturnCode_t get_requester_qos_from_profile(
405425
const std::string& profile_name,
406426
RequesterQos& qos) const;
407427

428+
ReturnCode_t get_requester_qos_from_xml(
429+
const std::string& xml,
430+
RequesterQos& qos,
431+
const std::string& profile_name = "") const;
432+
408433
/* TODO
409434
bool get_discovered_participants(
410435
std::vector<InstanceHandle_t>& participant_handles) const;

src/cpp/fastdds/publisher/Publisher.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,15 @@ ReturnCode_t Publisher::get_datawriter_qos_from_profile(
237237
return impl_->get_datawriter_qos_from_profile(profile_name, qos);
238238
}
239239

240+
ReturnCode_t Publisher::get_datawriter_qos_from_xml(
241+
const std::string& xml,
242+
DataWriterQos& qos,
243+
std::string& topic_name,
244+
const std::string& profile_name) const
245+
{
246+
return impl_->get_datawriter_qos_from_xml(xml, qos, topic_name, profile_name);
247+
}
248+
240249
} // namespace dds
241250
} // namespace fastdds
242251
} // namespace eprosima

0 commit comments

Comments
 (0)