diff --git a/include/fastdds/dds/domain/qos/DomainParticipantQos.hpp b/include/fastdds/dds/domain/qos/DomainParticipantQos.hpp index e64d0159adb..18c68598834 100644 --- a/include/fastdds/dds/domain/qos/DomainParticipantQos.hpp +++ b/include/fastdds/dds/domain/qos/DomainParticipantQos.hpp @@ -78,25 +78,6 @@ class DomainParticipantQos virtual bool operator ==( const DomainParticipantQos& b) const { - auto compare_flow_controllers = [](const DomainParticipantQos& lhs, const DomainParticipantQos& rhs) -> bool - { - const auto& lhs_flow_controllers = lhs.flow_controllers(); - const auto& rhs_flow_controllers = rhs.flow_controllers(); - - if (lhs_flow_controllers.size() != rhs_flow_controllers.size()) - { - return false; - } - - return std::equal(lhs_flow_controllers.begin(), lhs_flow_controllers.end(), - rhs_flow_controllers.begin(), - [](const std::shared_ptr& a, - const std::shared_ptr& b) - { - return *a == *b; - }); - }; - return (this->user_data_ == b.user_data()) && (this->entity_factory_ == b.entity_factory()) && (this->allocation_ == b.allocation()) && @@ -111,7 +92,7 @@ class DomainParticipantQos #if HAVE_SECURITY (this->security_log_thread_ == b.security_log_thread()) && #endif // if HAVE_SECURITY - (compare_flow_controllers(*this, b)); + (compare_flow_controllers(b)); } /** @@ -341,6 +322,15 @@ class DomainParticipantQos return flow_controllers_; } + /** + * Compares the flow controllers of two DomainParticipantQos element-wise. + * + * @param qos The DomainParticipantQos to compare with. + * @return true if the flow controllers are the same, false otherwise. + */ + FASTDDS_EXPORTED_API bool compare_flow_controllers( + const DomainParticipantQos& qos) const; + /** * Getter for FlowControllerDescriptorList * diff --git a/src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp b/src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp index 90c94e159d3..77816eb71a4 100644 --- a/src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp +++ b/src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp @@ -41,6 +41,26 @@ void DomainParticipantQos::setup_transports( utils::set_qos_from_attributes(*this, attr); } +bool DomainParticipantQos::compare_flow_controllers( + const DomainParticipantQos& qos) const +{ + const auto& lhs_flow_controllers = flow_controllers(); + const auto& rhs_flow_controllers = qos.flow_controllers(); + + if (lhs_flow_controllers.size() != rhs_flow_controllers.size()) + { + return false; + } + + return std::equal(lhs_flow_controllers.begin(), lhs_flow_controllers.end(), + rhs_flow_controllers.begin(), + [](const std::shared_ptr& a, + const std::shared_ptr& b) + { + return *a == *b; + }); +} + } /* namespace dds */ } /* namespace fastdds */ } /* namespace eprosima */ diff --git a/test/unittest/dds/participant/ParticipantTests.cpp b/test/unittest/dds/participant/ParticipantTests.cpp index 0e50fa56e17..ab0dee59a07 100644 --- a/test/unittest/dds/participant/ParticipantTests.cpp +++ b/test/unittest/dds/participant/ParticipantTests.cpp @@ -500,26 +500,7 @@ void check_equivalent_qos( ASSERT_EQ(qos_1.security_log_thread(), qos_2.security_log_thread()); #endif // if HAVE_SECURITY - auto compare_flow_controllers = [](const DomainParticipantQos& lhs, const DomainParticipantQos& rhs) -> bool - { - const auto& lhs_flow_controllers = lhs.flow_controllers(); - const auto& rhs_flow_controllers = rhs.flow_controllers(); - - if (lhs_flow_controllers.size() != rhs_flow_controllers.size()) - { - return false; - } - - return std::equal(lhs_flow_controllers.begin(), lhs_flow_controllers.end(), - rhs_flow_controllers.begin(), - [](const std::shared_ptr& a, - const std::shared_ptr& b) - { - return *a == *b; - }); - }; - - ASSERT_TRUE(compare_flow_controllers(qos_1, qos_2)); + ASSERT_TRUE(qos_1.compare_flow_controllers(qos_2)); } void check_participant_with_profile(