Skip to content

Commit

Permalink
Add QoS getters from raw XML
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>
  • Loading branch information
juanlofer-eprosima committed Sep 24, 2024
1 parent 37cd84d commit 37c3e8f
Show file tree
Hide file tree
Showing 16 changed files with 484 additions and 4 deletions.
25 changes: 25 additions & 0 deletions include/fastdds/dds/domain/DomainParticipant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,11 @@ class DomainParticipant : public Entity
const std::string& profile_name,
PublisherQos& qos) const;

FASTDDS_EXPORTED_API ReturnCode_t get_publisher_qos_from_xml(
const std::string& xml,
PublisherQos& qos,
const std::string& profile_name = "") const;

/**
* This operation sets a default value of the Subscriber QoS policies that will be used for newly created
* Subscriber entities in the case where the QoS policies are defaulted in the create_subscriber operation.
Expand Down Expand Up @@ -601,6 +606,11 @@ class DomainParticipant : public Entity
const std::string& profile_name,
SubscriberQos& qos) const;

FASTDDS_EXPORTED_API ReturnCode_t get_subscriber_qos_from_xml(
const std::string& xml,
SubscriberQos& qos,
const std::string& profile_name = "") const;

/**
* This operation sets a default value of the Topic QoS policies which will be used for newly created
* Topic entities in the case where the QoS policies are defaulted in the create_topic operation.
Expand Down Expand Up @@ -655,6 +665,11 @@ class DomainParticipant : public Entity
const std::string& profile_name,
TopicQos& qos) const;

FASTDDS_EXPORTED_API ReturnCode_t get_topic_qos_from_xml(
const std::string& xml,
TopicQos& qos,
const std::string& profile_name = "") const;

/**
* Fills the ReplierQos with the values of the XML profile.
*
Expand All @@ -666,6 +681,11 @@ class DomainParticipant : public Entity
const std::string& profile_name,
ReplierQos& qos) const;

FASTDDS_EXPORTED_API ReturnCode_t get_replier_qos_from_xml(
const std::string& xml,
ReplierQos& qos,
const std::string& profile_name = "") const;

/**
* Fills the RequesterQos with the values of the XML profile.
*
Expand All @@ -677,6 +697,11 @@ class DomainParticipant : public Entity
const std::string& profile_name,
RequesterQos& qos) const;

FASTDDS_EXPORTED_API ReturnCode_t get_requester_qos_from_xml(
const std::string& xml,
RequesterQos& qos,
const std::string& profile_name = "") const;

/**
* Retrieves the list of DomainParticipants that have been discovered in the domain and are not "ignored".
*
Expand Down
5 changes: 5 additions & 0 deletions include/fastdds/dds/domain/DomainParticipantFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ class DomainParticipantFactory
const std::string& profile_name,
DomainParticipantQos& qos) const;

FASTDDS_EXPORTED_API ReturnCode_t get_participant_qos_from_xml(
const std::string& xml,
DomainParticipantQos& qos,
const std::string& profile_name = "") const;

/**
* Fills the DomainParticipantExtendedQos with the values of the XML profile.
*
Expand Down
6 changes: 6 additions & 0 deletions include/fastdds/dds/publisher/Publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,12 @@ class Publisher : public DomainEntity
const std::string& profile_name,
DataWriterQos& qos) const;

FASTDDS_EXPORTED_API ReturnCode_t get_datawriter_qos_from_xml(
const std::string& xml,
DataWriterQos& qos,
std::string& topic_name,
const std::string& profile_name = "") const;

/**
* Returns the Publisher's handle.
*
Expand Down
6 changes: 6 additions & 0 deletions include/fastdds/dds/subscriber/Subscriber.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@ class Subscriber : public DomainEntity
const std::string& profile_name,
DataReaderQos& qos) const;

FASTDDS_EXPORTED_API ReturnCode_t get_datareader_qos_from_xml(
const std::string& xml,
DataReaderQos& qos,
std::string& topic_name,
const std::string& profile_name = "") const;

/**
* @brief Copies TopicQos into the corresponding DataReaderQos
*
Expand Down
48 changes: 44 additions & 4 deletions src/cpp/fastdds/domain/DomainParticipant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,14 @@ ReturnCode_t DomainParticipant::get_publisher_qos_from_profile(
return impl_->get_publisher_qos_from_profile(profile_name, qos);
}

ReturnCode_t DomainParticipant::get_publisher_qos_from_xml(
const std::string& xml,
PublisherQos& qos,
const std::string& profile_name) const
{
return impl_->get_publisher_qos_from_xml(xml, qos, profile_name);
}

ReturnCode_t DomainParticipant::set_default_subscriber_qos(
const SubscriberQos& qos)
{
Expand All @@ -361,6 +369,14 @@ ReturnCode_t DomainParticipant::get_subscriber_qos_from_profile(
return impl_->get_subscriber_qos_from_profile(profile_name, qos);
}

ReturnCode_t DomainParticipant::get_subscriber_qos_from_xml(
const std::string& xml,
SubscriberQos& qos,
const std::string& profile_name) const
{
return impl_->get_subscriber_qos_from_xml(xml, qos, profile_name);
}

ReturnCode_t DomainParticipant::set_default_topic_qos(
const TopicQos& qos)
{
Expand All @@ -386,11 +402,12 @@ ReturnCode_t DomainParticipant::get_topic_qos_from_profile(
return impl_->get_topic_qos_from_profile(profile_name, qos);
}

ReturnCode_t DomainParticipant::get_replier_qos_from_profile(
const std::string& profile_name,
ReplierQos& qos) const
ReturnCode_t DomainParticipant::get_topic_qos_from_xml(
const std::string& xml,
TopicQos& qos,
const std::string& profile_name) const
{
return impl_->get_replier_qos_from_profile(profile_name, qos);
return impl_->get_topic_qos_from_xml(xml, qos, profile_name);
}

ReturnCode_t DomainParticipant::get_requester_qos_from_profile(
Expand All @@ -400,6 +417,29 @@ ReturnCode_t DomainParticipant::get_requester_qos_from_profile(
return impl_->get_requester_qos_from_profile(profile_name, qos);
}

ReturnCode_t DomainParticipant::get_requester_qos_from_xml(
const std::string& xml,
RequesterQos& qos,
const std::string& profile_name) const
{
return impl_->get_requester_qos_from_xml(xml, qos, profile_name);
}

ReturnCode_t DomainParticipant::get_replier_qos_from_profile(
const std::string& profile_name,
ReplierQos& qos) const
{
return impl_->get_replier_qos_from_profile(profile_name, qos);
}

ReturnCode_t DomainParticipant::get_replier_qos_from_xml(
const std::string& xml,
ReplierQos& qos,
const std::string& profile_name) const
{
return impl_->get_replier_qos_from_xml(xml, qos, profile_name);
}

ReturnCode_t DomainParticipant::get_discovered_participants(
std::vector<InstanceHandle_t>& participant_handles) const
{
Expand Down
16 changes: 16 additions & 0 deletions src/cpp/fastdds/domain/DomainParticipantFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,22 @@ ReturnCode_t DomainParticipantFactory::get_participant_qos_from_profile(
return RETCODE_BAD_PARAMETER;
}

ReturnCode_t DomainParticipantFactory::get_participant_qos_from_xml(
const std::string& xml,
DomainParticipantQos& qos,
const std::string& profile_name) const
{
ParticipantAttributes attr;
if (XMLP_ret::XML_OK == XMLProfileManager::fill_participant_attributes_from_xml(xml, attr, profile_name))
{
qos = default_participant_qos_;
utils::set_qos_from_attributes(qos, attr.rtps);
return RETCODE_OK;
}

return RETCODE_BAD_PARAMETER;
}

ReturnCode_t DomainParticipantFactory::get_participant_extended_qos_from_profile(
const std::string& profile_name,
DomainParticipantExtendedQos& extended_qos) const
Expand Down
78 changes: 78 additions & 0 deletions src/cpp/fastdds/domain/DomainParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,22 @@ ReturnCode_t DomainParticipantImpl::get_publisher_qos_from_profile(
return RETCODE_BAD_PARAMETER;
}

ReturnCode_t DomainParticipantImpl::get_publisher_qos_from_xml(
const std::string& xml,
PublisherQos& qos,
const std::string& profile_name) const
{
xmlparser::PublisherAttributes attr;
if (XMLP_ret::XML_OK == XMLProfileManager::fill_publisher_attributes_from_xml(xml, attr, profile_name))
{
qos = default_pub_qos_;
utils::set_qos_from_attributes(qos, attr);
return RETCODE_OK;
}

return RETCODE_BAD_PARAMETER;
}

ReturnCode_t DomainParticipantImpl::set_default_subscriber_qos(
const SubscriberQos& qos)
{
Expand Down Expand Up @@ -1092,6 +1108,22 @@ ReturnCode_t DomainParticipantImpl::get_subscriber_qos_from_profile(
return RETCODE_BAD_PARAMETER;
}

ReturnCode_t DomainParticipantImpl::get_subscriber_qos_from_xml(
const std::string& xml,
SubscriberQos& qos,
const std::string& profile_name) const
{
xmlparser::SubscriberAttributes attr;
if (XMLP_ret::XML_OK == XMLProfileManager::fill_subscriber_attributes_from_xml(xml, attr, profile_name))
{
qos = default_sub_qos_;
utils::set_qos_from_attributes(qos, attr);
return RETCODE_OK;
}

return RETCODE_BAD_PARAMETER;
}

ReturnCode_t DomainParticipantImpl::set_default_topic_qos(
const TopicQos& qos)
{
Expand Down Expand Up @@ -1140,6 +1172,22 @@ ReturnCode_t DomainParticipantImpl::get_topic_qos_from_profile(
return RETCODE_BAD_PARAMETER;
}

ReturnCode_t DomainParticipantImpl::get_topic_qos_from_xml(
const std::string& profile_name,
TopicQos& qos,
const std::string& xml) const
{
xmlparser::TopicAttributes attr;
if (XMLP_ret::XML_OK == XMLProfileManager::fill_topic_attributes_from_xml(xml, attr, profile_name))
{
qos = default_topic_qos_;
utils::set_qos_from_attributes(qos, attr);
return RETCODE_OK;
}

return RETCODE_BAD_PARAMETER;
}

ReturnCode_t DomainParticipantImpl::get_replier_qos_from_profile(
const std::string& profile_name,
ReplierQos& qos) const
Expand All @@ -1154,6 +1202,21 @@ ReturnCode_t DomainParticipantImpl::get_replier_qos_from_profile(
return RETCODE_BAD_PARAMETER;
}

ReturnCode_t DomainParticipantImpl::get_replier_qos_from_xml(
const std::string& xml,
ReplierQos& qos,
const std::string& profile_name) const
{
xmlparser::ReplierAttributes attr;
if (XMLP_ret::XML_OK == XMLProfileManager::fill_replier_attributes_from_xml(xml, attr, profile_name))
{
utils::set_qos_from_attributes(qos, attr);
return RETCODE_OK;
}

return RETCODE_BAD_PARAMETER;
}

ReturnCode_t DomainParticipantImpl::get_requester_qos_from_profile(
const std::string& profile_name,
RequesterQos& qos) const
Expand All @@ -1168,6 +1231,21 @@ ReturnCode_t DomainParticipantImpl::get_requester_qos_from_profile(
return RETCODE_BAD_PARAMETER;
}

ReturnCode_t DomainParticipantImpl::get_requester_qos_from_xml(
const std::string& xml,
RequesterQos& qos,
const std::string& profile_name) const
{
xmlparser::RequesterAttributes attr;
if (XMLP_ret::XML_OK == XMLProfileManager::fill_requester_attributes_from_xml(xml, attr, profile_name))
{
utils::set_qos_from_attributes(qos, attr);
return RETCODE_OK;
}

return RETCODE_BAD_PARAMETER;
}

/* TODO
bool DomainParticipantImpl::get_discovered_participants(
std::vector<InstanceHandle_t>& participant_handles) const
Expand Down
25 changes: 25 additions & 0 deletions src/cpp/fastdds/domain/DomainParticipantImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,11 @@ class DomainParticipantImpl
const std::string& profile_name,
PublisherQos& qos) const;

ReturnCode_t get_publisher_qos_from_xml(
const std::string& xml,
PublisherQos& qos,
const std::string& profile_name = "") const;

ReturnCode_t set_default_subscriber_qos(
const SubscriberQos& qos);

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

ReturnCode_t get_subscriber_qos_from_xml(
const std::string& xml,
SubscriberQos& qos,
const std::string& profile_name = "") const;

ReturnCode_t set_default_topic_qos(
const TopicQos& qos);

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

ReturnCode_t get_topic_qos_from_xml(
const std::string& xml,
TopicQos& qos,
const std::string& profile_name = "") const;

ReturnCode_t get_replier_qos_from_profile(
const std::string& profile_name,
ReplierQos& qos) const;

ReturnCode_t get_replier_qos_from_xml(
const std::string& xml,
ReplierQos& qos,
const std::string& profile_name = "") const;

ReturnCode_t get_requester_qos_from_profile(
const std::string& profile_name,
RequesterQos& qos) const;

ReturnCode_t get_requester_qos_from_xml(
const std::string& xml,
RequesterQos& qos,
const std::string& profile_name = "") const;

/* TODO
bool get_discovered_participants(
std::vector<InstanceHandle_t>& participant_handles) const;
Expand Down
9 changes: 9 additions & 0 deletions src/cpp/fastdds/publisher/Publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,15 @@ ReturnCode_t Publisher::get_datawriter_qos_from_profile(
return impl_->get_datawriter_qos_from_profile(profile_name, qos);
}

ReturnCode_t Publisher::get_datawriter_qos_from_xml(
const std::string& xml,
DataWriterQos& qos,
std::string& topic_name,
const std::string& profile_name) const
{
return impl_->get_datawriter_qos_from_xml(xml, qos, topic_name, profile_name);
}

} // namespace dds
} // namespace fastdds
} // namespace eprosima
Loading

0 comments on commit 37c3e8f

Please sign in to comment.