From 7663e948ebfa709b777f9afa90283289f307d0af Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 14 May 2024 09:11:47 +0200 Subject: [PATCH 1/8] Create DomainParticipantExtendedQos Signed-off-by: Lucia Echevarria --- .../dds/domain/DomainParticipantFactory.hpp | 25 +++++ .../qos/DomainParticipantExtendedQos.hpp | 102 ++++++++++++++++++ .../dds/domain/qos/DomainParticipantQos.hpp | 4 +- .../domain/DomainParticipantFactory.cpp | 22 ++++ src/cpp/fastdds/utils/QosConverters.cpp | 16 +++ src/cpp/fastdds/utils/QosConverters.hpp | 30 ++++++ .../dds/participant/ParticipantTests.cpp | 74 ++++++++++++- 7 files changed, 271 insertions(+), 2 deletions(-) create mode 100644 include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp diff --git a/include/fastdds/dds/domain/DomainParticipantFactory.hpp b/include/fastdds/dds/domain/DomainParticipantFactory.hpp index e34afcf2f16..d336cbca537 100644 --- a/include/fastdds/dds/domain/DomainParticipantFactory.hpp +++ b/include/fastdds/dds/domain/DomainParticipantFactory.hpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -93,6 +94,19 @@ class DomainParticipantFactory DomainParticipantListener* listener = nullptr, const StatusMask& mask = StatusMask::all()); + /** + * Create a Participant. + * + * @param extended_qos DomainParticipantExtendedQos Reference. + * @param listener DomainParticipantListener Pointer (default: nullptr) + * @param mask StatusMask Reference (default: all) + * @return DomainParticipant pointer. (nullptr if not created.) + */ + FASTDDS_EXPORTED_API DomainParticipant* create_participant( + const DomainParticipantExtendedQos& extended_qos, + DomainParticipantListener* listener = nullptr, + const StatusMask& mask = StatusMask::all()); + /** * Create a Participant with default domain id and qos. * @@ -214,6 +228,17 @@ class DomainParticipantFactory const std::string& profile_name, DomainParticipantQos& qos) const; + /** + * Fills the DomainParticipantExtendedQos with the values of the XML profile. + * + * @param profile_name DomainParticipant profile name. + * @param extended_qos DomainParticipantExtendedQos object where the domain and qos are returned. + * @return RETCODE_OK if the profile exists. RETCODE_BAD_PARAMETER otherwise. + */ + FASTDDS_EXPORTED_API ReturnCode_t get_participant_extended_qos_from_profile( + const std::string& profile_name, + DomainParticipantExtendedQos& extended_qos) const; + /** * Remove a Participant and all associated publishers and subscribers. * diff --git a/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp b/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp new file mode 100644 index 00000000000..012742eaf2f --- /dev/null +++ b/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp @@ -0,0 +1,102 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file DomainParticipantExtendedQos.hpp + * + */ + +#ifndef _FASTDDS_PARTICIPANTEXTENDEDQOS_HPP_ +#define _FASTDDS_PARTICIPANTEXTENDEDQOS_HPP_ + +#include + +#include "DomainParticipantQos.hpp" + +namespace eprosima { +namespace fastdds { +namespace dds { + +class DomainParticipantExtendedQos : public DomainParticipantQos +{ +public: + + /** + * @brief Constructor + */ + FASTDDS_EXPORTED_API DomainParticipantExtendedQos() + { + } + + /** + * @brief Destructor + */ + FASTDDS_EXPORTED_API virtual ~DomainParticipantExtendedQos() + { + } + + DomainParticipantExtendedQos& operator=( + const DomainParticipantQos& qos) + { + static_cast(*this) = qos; + + return *this; + } + + bool operator ==( + const DomainParticipantExtendedQos& b) const + { + return (this->domainId_ == b.domainId()) && + (DomainParticipantQos::operator==(b)); + } + + bool operator ==( + const DomainParticipantQos& b) const override + { + return (DomainParticipantQos::operator==(b)); + } + + /** + * Getter for domainId + * + * @return domainId reference + */ + const uint32_t& domainId() const + { + return domainId_; + } + + /** + * Getter for domainId + * + * @return domainId reference + */ + uint32_t& domainId() + { + return domainId_; + } + +private: + + //! DomainId to be used by the associated RTPSParticipant (default: 0) + uint32_t domainId_ = 0; + +}; + + +} /* namespace dds */ +} /* namespace fastdds */ +} /* namespace eprosima */ + +#endif /* _FASTDDS_PARTICIPANTEXTENDEDQOS_HPP_ */ diff --git a/include/fastdds/dds/domain/qos/DomainParticipantQos.hpp b/include/fastdds/dds/domain/qos/DomainParticipantQos.hpp index 9fdb758501a..00ceb970ebc 100644 --- a/include/fastdds/dds/domain/qos/DomainParticipantQos.hpp +++ b/include/fastdds/dds/domain/qos/DomainParticipantQos.hpp @@ -42,6 +42,8 @@ class DomainParticipantQos { public: + friend class DomainParticipantExtendedQos; + /*! * User defined flow controllers to use alongside. * @@ -73,7 +75,7 @@ class DomainParticipantQos { } - bool operator ==( + virtual bool operator ==( const DomainParticipantQos& b) const { return (this->user_data_ == b.user_data()) && diff --git a/src/cpp/fastdds/domain/DomainParticipantFactory.cpp b/src/cpp/fastdds/domain/DomainParticipantFactory.cpp index 733087f5b9c..a024815185f 100644 --- a/src/cpp/fastdds/domain/DomainParticipantFactory.cpp +++ b/src/cpp/fastdds/domain/DomainParticipantFactory.cpp @@ -203,6 +203,14 @@ DomainParticipant* DomainParticipantFactory::create_participant( return dom_part; } +DomainParticipant* DomainParticipantFactory::create_participant( + const DomainParticipantExtendedQos& extended_qos, + DomainParticipantListener* listener, + const StatusMask& mask) +{ + return create_participant(extended_qos.domainId(), extended_qos, listener, mask); +} + DomainParticipant* DomainParticipantFactory::create_participant_with_default_profile() { return create_participant_with_default_profile(nullptr, StatusMask::none()); @@ -333,6 +341,20 @@ ReturnCode_t DomainParticipantFactory::get_participant_qos_from_profile( return RETCODE_BAD_PARAMETER; } +ReturnCode_t DomainParticipantFactory::get_participant_extended_qos_from_profile( + const std::string& profile_name, + DomainParticipantExtendedQos& extended_qos) const +{ + ParticipantAttributes attr; + if (XMLP_ret::XML_OK == XMLProfileManager::fillParticipantAttributes(profile_name, attr, false)) + { + utils::set_extended_qos_from_attributes(extended_qos, attr); + return RETCODE_OK; + } + + return RETCODE_BAD_PARAMETER; +} + ReturnCode_t DomainParticipantFactory::load_profiles() { // NOTE: This could be done with a bool atomic to avoid taking the mutex in most cases, however the use of diff --git a/src/cpp/fastdds/utils/QosConverters.cpp b/src/cpp/fastdds/utils/QosConverters.cpp index cfa1bbc7d30..fdb778bd94d 100644 --- a/src/cpp/fastdds/utils/QosConverters.cpp +++ b/src/cpp/fastdds/utils/QosConverters.cpp @@ -181,6 +181,14 @@ void set_qos_from_attributes( qos.properties().binary_properties() = attr.properties.binary_properties(); } +void set_extended_qos_from_attributes( + DomainParticipantExtendedQos& extended_qos, + const eprosima::fastdds::ParticipantAttributes& attr) +{ + extended_qos.domainId() = attr.domainId; + set_qos_from_attributes(extended_qos, attr.rtps); +} + void set_attributes_from_qos( fastdds::rtps::RTPSParticipantAttributes& attr, const DomainParticipantQos& qos) @@ -213,6 +221,14 @@ void set_attributes_from_qos( #endif // if HAVE_SECURITY } +void set_attributes_from_extended_qos( + eprosima::fastdds::ParticipantAttributes& attr, + const DomainParticipantExtendedQos& extended_qos) +{ + attr.domainId = extended_qos.domainId(); + set_attributes_from_qos(attr.rtps, extended_qos); +} + void set_qos_from_attributes( TopicQos& qos, const TopicAttributes& attr) diff --git a/src/cpp/fastdds/utils/QosConverters.hpp b/src/cpp/fastdds/utils/QosConverters.hpp index a49fd43106e..8490c69b87a 100644 --- a/src/cpp/fastdds/utils/QosConverters.hpp +++ b/src/cpp/fastdds/utils/QosConverters.hpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -29,6 +30,7 @@ #include #include +#include #include #include #include @@ -77,6 +79,24 @@ void set_qos_from_attributes( DomainParticipantQos& qos, const eprosima::fastdds::rtps::RTPSParticipantAttributes& attr); +/** + * @brief Fill DomainParticipantExtendedQos from a given attributes ParticipantAttributes object + * + * For the case of the non-binary properties, instead of the ParticipantAttributes overriding the + * property list in the DomainParticipantExtendedQos, a merge is performed in the following manner: + * + * - If any property from the ParticipantAttributes is not in the DomainParticipantExtendedQos, then it is appended + * to the DomainParticipantExtendedQos. + * - If any property from the ParticipantAttributes property is also in the DomainParticipantExtendedQos, then the + * value in the DomainParticipantExtendedQos is overridden with that of the ParticipantAttributes. + * + * @param[in, out] extended_qos The DomainParticipantExtendedQos to set + * @param[in] attr The ParticipantAttributes from which the @c extended_qos is set. + */ +void set_extended_qos_from_attributes( + DomainParticipantExtendedQos& extended_qos, + const eprosima::fastdds::ParticipantAttributes& attr); + /** * Obtains the RTPSParticipantAttributes from the DomainParticipantQos provided. * @@ -87,6 +107,16 @@ void set_attributes_from_qos( fastdds::rtps::RTPSParticipantAttributes& attr, const DomainParticipantQos& qos); +/** + * Obtains the ParticipantAttributes from the DomainParticipantExtendedQos provided. + * + * @param[out] attr Pointer to the attributes from which to obtain data + * @param[in] extended_qos Pointer to the QoS to write on + */ +void set_attributes_from_extended_qos( + eprosima::fastdds::ParticipantAttributes& attr, + const DomainParticipantExtendedQos& extended_qos); + /** * Obtains the TopicQos from the TopicAttributes provided. * diff --git a/test/unittest/dds/participant/ParticipantTests.cpp b/test/unittest/dds/participant/ParticipantTests.cpp index 311a63d5558..ef8ea7c5783 100644 --- a/test/unittest/dds/participant/ParticipantTests.cpp +++ b/test/unittest/dds/participant/ParticipantTests.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -464,7 +465,20 @@ TEST(ParticipantTests, CreateDomainParticipant) EXPECT_EQ(participant->get_listener(), nullptr); ASSERT_TRUE(DomainParticipantFactory::get_instance()->delete_participant(participant) == RETCODE_OK); +} + +TEST(ParticipantTests, CreateDomainParticipantWithExtendedQos) +{ + DomainParticipantExtendedQos extended_qos; + + DomainParticipant* participant = + DomainParticipantFactory::get_instance()->create_participant( + extended_qos); + ASSERT_NE(participant, nullptr); + EXPECT_EQ(participant->get_listener(), nullptr); + + ASSERT_TRUE(DomainParticipantFactory::get_instance()->delete_participant(participant) == RETCODE_OK); } /** @@ -496,7 +510,7 @@ void check_equivalent_qos( ASSERT_EQ(qos_1.flow_controllers(), qos_2.flow_controllers()); } -void check_participant_with_profile ( +void check_participant_with_profile( DomainParticipant* participant, const std::string& profile_name) { @@ -509,6 +523,29 @@ void check_participant_with_profile ( check_equivalent_qos(qos, profile_qos); } +void check_equivalent_extended_qos( + const DomainParticipantExtendedQos& extended_qos_1, + const DomainParticipantExtendedQos& extended_qos_2) +{ + ASSERT_EQ(extended_qos_1.domainId(), extended_qos_2.domainId()); + check_equivalent_qos(extended_qos_1, extended_qos_2); +} + +void check_participant_extended_qos_from_profile( + DomainParticipant* participant, + const std::string& profile_name) +{ + DomainParticipantExtendedQos extended_qos; + + extended_qos = participant->get_qos(); + extended_qos.domainId() = participant->get_domain_id(); + + DomainParticipantExtendedQos profile_extended_qos; + EXPECT_EQ(DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile(profile_name, profile_extended_qos), + RETCODE_OK); + check_equivalent_extended_qos(extended_qos, profile_extended_qos); +} + /** * This test checks two different things depending on whether FASTDDS_STATISTICS is defined when compiling the test: * @@ -568,6 +605,41 @@ TEST(ParticipantTests, CreateDomainParticipantWithProfile) ASSERT_TRUE(DomainParticipantFactory::get_instance()->delete_participant(participant) == RETCODE_OK); } +TEST(ParticipantTests, CreateDomainParticipantWithExtendedQosFromProfile) +{ + DomainParticipantFactory::get_instance()->load_XML_profiles_file("test_xml_profile.xml"); + uint32_t domain_id = 123u; // This is the domain ID set in the default profile above + + // Test create_participant_with_profile using the default profile + DomainParticipant* default_participant = + DomainParticipantFactory::get_instance()->create_participant_with_profile("test_default_participant_profile"); + ASSERT_NE(default_participant, nullptr); + ASSERT_EQ(default_participant->get_domain_id(), domain_id); //Keep the DID given to the method, not the one on the profile + check_participant_extended_qos_from_profile(default_participant, "test_default_participant_profile"); + ASSERT_TRUE(DomainParticipantFactory::get_instance()->delete_participant( + default_participant) == RETCODE_OK); + + // Test create_participant_with_profile using "test_participant_profile" + uint32_t did = 123u; // This is the domain ID set in the "test_participant_profile" + + DomainParticipant* participant = + DomainParticipantFactory::get_instance()->create_participant_with_profile("test_participant_profile"); + ASSERT_NE(participant, nullptr); + ASSERT_EQ(participant->get_domain_id(), did); //Keep the DID given to the method, not the one on the profile + check_participant_extended_qos_from_profile(participant, "test_participant_profile"); + ASSERT_TRUE(DomainParticipantFactory::get_instance()->delete_participant(participant) == RETCODE_OK); + + // Test get_participant_extended_qos_from_profile and create_participant with that extended_qos + DomainParticipantExtendedQos extended_qos; + ASSERT_TRUE(DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile( + "test_participant_profile", extended_qos) == RETCODE_OK); + + DomainParticipant* new_participant = + DomainParticipantFactory::get_instance()->create_participant(extended_qos); + check_participant_extended_qos_from_profile(new_participant, "test_participant_profile"); + ASSERT_TRUE(DomainParticipantFactory::get_instance()->delete_participant(new_participant) == RETCODE_OK); +} + TEST(ParticipantTests, CreateDomainParticipantWithDefaultProfile) { uint32_t domain_id = 123u; // This is the domain ID set in the default profile above From 9959cee1c9288daf9e58d1e1c669840a8339ef39 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 3 Jun 2024 15:25:02 +0200 Subject: [PATCH 2/8] Apply suggested changes Signed-off-by: Lucia Echevarria --- .../dds/domain/DomainParticipantFactory.hpp | 2 +- .../qos/DomainParticipantExtendedQos.hpp | 4 ++- src/cpp/CMakeLists.txt | 1 + .../domain/DomainParticipantFactory.cpp | 11 ++++++- .../qos/DomainParticipantExtendedQos.cpp | 32 +++++++++++++++++++ src/cpp/fastdds/utils/QosConverters.hpp | 2 +- .../dds/participant/ParticipantTests.cpp | 10 ++++-- test/unittest/dds/publisher/CMakeLists.txt | 1 + test/unittest/dds/status/CMakeLists.txt | 1 + test/unittest/statistics/dds/CMakeLists.txt | 2 ++ 10 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp diff --git a/include/fastdds/dds/domain/DomainParticipantFactory.hpp b/include/fastdds/dds/domain/DomainParticipantFactory.hpp index d336cbca537..0dfe8b62048 100644 --- a/include/fastdds/dds/domain/DomainParticipantFactory.hpp +++ b/include/fastdds/dds/domain/DomainParticipantFactory.hpp @@ -26,9 +26,9 @@ #include #include +#include #include #include -#include #include #include #include diff --git a/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp b/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp index 012742eaf2f..789a0e29476 100644 --- a/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp +++ b/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp @@ -89,11 +89,13 @@ class DomainParticipantExtendedQos : public DomainParticipantQos private: - //! DomainId to be used by the associated RTPSParticipant (default: 0) + //! DomainId to be used by the associated DomainParticipant (default: 0) uint32_t domainId_ = 0; }; +FASTDDS_EXPORTED_API extern const DomainParticipantExtendedQos PARTICIPANT_EXTENDED_QOS_DEFAULT; + } /* namespace dds */ } /* namespace fastdds */ diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index f66218305c8..2f696c3a6cf 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -57,6 +57,7 @@ set(${PROJECT_NAME}_source_files fastdds/domain/DomainParticipant.cpp fastdds/domain/DomainParticipantFactory.cpp fastdds/domain/DomainParticipantImpl.cpp + fastdds/domain/qos/DomainParticipantExtendedQos.cpp fastdds/domain/qos/DomainParticipantFactoryQos.cpp fastdds/domain/qos/DomainParticipantQos.cpp fastdds/log/FileConsumer.cpp diff --git a/src/cpp/fastdds/domain/DomainParticipantFactory.cpp b/src/cpp/fastdds/domain/DomainParticipantFactory.cpp index a024815185f..46020f2c6c5 100644 --- a/src/cpp/fastdds/domain/DomainParticipantFactory.cpp +++ b/src/cpp/fastdds/domain/DomainParticipantFactory.cpp @@ -208,7 +208,15 @@ DomainParticipant* DomainParticipantFactory::create_participant( DomainParticipantListener* listener, const StatusMask& mask) { - return create_participant(extended_qos.domainId(), extended_qos, listener, mask); + if (&extended_qos == &PARTICIPANT_EXTENDED_QOS_DEFAULT) + { + load_profiles(); // load profile so the default domain id is updated + return create_participant(default_domain_id_, PARTICIPANT_QOS_DEFAULT, listener, mask); + } + else + { + return create_participant(extended_qos.domainId(), extended_qos, listener, mask); + } } DomainParticipant* DomainParticipantFactory::create_participant_with_default_profile() @@ -345,6 +353,7 @@ ReturnCode_t DomainParticipantFactory::get_participant_extended_qos_from_profile const std::string& profile_name, DomainParticipantExtendedQos& extended_qos) const { + extended_qos = default_participant_extended_qos_; ParticipantAttributes attr; if (XMLP_ret::XML_OK == XMLProfileManager::fillParticipantAttributes(profile_name, attr, false)) { diff --git a/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp b/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp new file mode 100644 index 00000000000..19998947014 --- /dev/null +++ b/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp @@ -0,0 +1,32 @@ +// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file DomainParticipantExtendedQos.cpp + * + */ + +#include + + +namespace eprosima { +namespace fastdds { +namespace dds { + +const DomainParticipantExtendedQos PARTICIPANT_EXTENDED_QOS_DEFAULT; + + +} /* namespace dds */ +} /* namespace fastdds */ +} /* namespace eprosima */ diff --git a/src/cpp/fastdds/utils/QosConverters.hpp b/src/cpp/fastdds/utils/QosConverters.hpp index 8490c69b87a..a71ec4bc1cb 100644 --- a/src/cpp/fastdds/utils/QosConverters.hpp +++ b/src/cpp/fastdds/utils/QosConverters.hpp @@ -21,8 +21,8 @@ #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC #include -#include #include +#include #include #include #include diff --git a/test/unittest/dds/participant/ParticipantTests.cpp b/test/unittest/dds/participant/ParticipantTests.cpp index ef8ea7c5783..7f82567e759 100644 --- a/test/unittest/dds/participant/ParticipantTests.cpp +++ b/test/unittest/dds/participant/ParticipantTests.cpp @@ -30,8 +30,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -42,8 +42,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -467,6 +467,9 @@ TEST(ParticipantTests, CreateDomainParticipant) ASSERT_TRUE(DomainParticipantFactory::get_instance()->delete_participant(participant) == RETCODE_OK); } +/** + * This test checks the creation and deletion of DomainParticipant instances using Extended QoS default profile. + */ TEST(ParticipantTests, CreateDomainParticipantWithExtendedQos) { DomainParticipantExtendedQos extended_qos; @@ -605,6 +608,9 @@ TEST(ParticipantTests, CreateDomainParticipantWithProfile) ASSERT_TRUE(DomainParticipantFactory::get_instance()->delete_participant(participant) == RETCODE_OK); } +/** + * This test checks the creation and deletion of DomainParticipant instances using Extended QoS from XML profiles. + */ TEST(ParticipantTests, CreateDomainParticipantWithExtendedQosFromProfile) { DomainParticipantFactory::get_instance()->load_XML_profiles_file("test_xml_profile.xml"); diff --git a/test/unittest/dds/publisher/CMakeLists.txt b/test/unittest/dds/publisher/CMakeLists.txt index 348eab958bf..2464a8edce5 100644 --- a/test/unittest/dds/publisher/CMakeLists.txt +++ b/test/unittest/dds/publisher/CMakeLists.txt @@ -48,6 +48,7 @@ set(DATAWRITERTESTS_SOURCE DataWriterTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipant.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipantFactory.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipantImpl.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantFactoryQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/publisher/DataWriter.cpp diff --git a/test/unittest/dds/status/CMakeLists.txt b/test/unittest/dds/status/CMakeLists.txt index be2d7bf2916..3e3b7f8948b 100644 --- a/test/unittest/dds/status/CMakeLists.txt +++ b/test/unittest/dds/status/CMakeLists.txt @@ -27,6 +27,7 @@ set(LISTENERTESTS_SOURCE ListenerTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipant.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipantFactory.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipantImpl.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantFactoryQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/publisher/DataWriter.cpp diff --git a/test/unittest/statistics/dds/CMakeLists.txt b/test/unittest/statistics/dds/CMakeLists.txt index b08d33f54ec..0e6db6559c1 100644 --- a/test/unittest/statistics/dds/CMakeLists.txt +++ b/test/unittest/statistics/dds/CMakeLists.txt @@ -145,6 +145,7 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX) ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/core/policy/QosPolicyUtils.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipant.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipantFactory.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantFactoryQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/log/FileConsumer.cpp @@ -330,6 +331,7 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX) ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/core/policy/QosPolicyUtils.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipant.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipantFactory.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantFactoryQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/publisher/DataWriter.cpp From 7fa515a0fd461faf238a7380fc88ba12ba38132d Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 3 Jun 2024 15:57:41 +0200 Subject: [PATCH 3/8] Check uncrustify Signed-off-by: Lucia Echevarria --- .../fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp b/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp index 789a0e29476..44491ddc088 100644 --- a/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp +++ b/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp @@ -46,7 +46,7 @@ class DomainParticipantExtendedQos : public DomainParticipantQos { } - DomainParticipantExtendedQos& operator=( + DomainParticipantExtendedQos& operator =( const DomainParticipantQos& qos) { static_cast(*this) = qos; @@ -58,13 +58,13 @@ class DomainParticipantExtendedQos : public DomainParticipantQos const DomainParticipantExtendedQos& b) const { return (this->domainId_ == b.domainId()) && - (DomainParticipantQos::operator==(b)); + (DomainParticipantQos::operator ==(b)); } bool operator ==( const DomainParticipantQos& b) const override { - return (DomainParticipantQos::operator==(b)); + return (DomainParticipantQos::operator ==(b)); } /** From 441ccb42c2ad2c2ccfef541b0ab3bf98c3ca94c4 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 4 Jun 2024 08:32:11 +0200 Subject: [PATCH 4/8] Remove default_participant_extended_qos_ Signed-off-by: Lucia Echevarria --- .../qos/DomainParticipantExtendedQos.hpp | 2 -- src/cpp/CMakeLists.txt | 1 - .../domain/DomainParticipantFactory.cpp | 12 ++----- .../qos/DomainParticipantExtendedQos.cpp | 32 ------------------- test/unittest/dds/publisher/CMakeLists.txt | 1 - test/unittest/dds/status/CMakeLists.txt | 1 - test/unittest/statistics/dds/CMakeLists.txt | 2 -- 7 files changed, 2 insertions(+), 49 deletions(-) delete mode 100644 src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp diff --git a/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp b/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp index 44491ddc088..eeaa9daad43 100644 --- a/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp +++ b/include/fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp @@ -94,8 +94,6 @@ class DomainParticipantExtendedQos : public DomainParticipantQos }; -FASTDDS_EXPORTED_API extern const DomainParticipantExtendedQos PARTICIPANT_EXTENDED_QOS_DEFAULT; - } /* namespace dds */ } /* namespace fastdds */ diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 2f696c3a6cf..f66218305c8 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -57,7 +57,6 @@ set(${PROJECT_NAME}_source_files fastdds/domain/DomainParticipant.cpp fastdds/domain/DomainParticipantFactory.cpp fastdds/domain/DomainParticipantImpl.cpp - fastdds/domain/qos/DomainParticipantExtendedQos.cpp fastdds/domain/qos/DomainParticipantFactoryQos.cpp fastdds/domain/qos/DomainParticipantQos.cpp fastdds/log/FileConsumer.cpp diff --git a/src/cpp/fastdds/domain/DomainParticipantFactory.cpp b/src/cpp/fastdds/domain/DomainParticipantFactory.cpp index 46020f2c6c5..ff832218032 100644 --- a/src/cpp/fastdds/domain/DomainParticipantFactory.cpp +++ b/src/cpp/fastdds/domain/DomainParticipantFactory.cpp @@ -208,15 +208,7 @@ DomainParticipant* DomainParticipantFactory::create_participant( DomainParticipantListener* listener, const StatusMask& mask) { - if (&extended_qos == &PARTICIPANT_EXTENDED_QOS_DEFAULT) - { - load_profiles(); // load profile so the default domain id is updated - return create_participant(default_domain_id_, PARTICIPANT_QOS_DEFAULT, listener, mask); - } - else - { - return create_participant(extended_qos.domainId(), extended_qos, listener, mask); - } + return create_participant(extended_qos.domainId(), extended_qos, listener, mask); } DomainParticipant* DomainParticipantFactory::create_participant_with_default_profile() @@ -353,7 +345,7 @@ ReturnCode_t DomainParticipantFactory::get_participant_extended_qos_from_profile const std::string& profile_name, DomainParticipantExtendedQos& extended_qos) const { - extended_qos = default_participant_extended_qos_; + extended_qos = default_participant_qos_; ParticipantAttributes attr; if (XMLP_ret::XML_OK == XMLProfileManager::fillParticipantAttributes(profile_name, attr, false)) { diff --git a/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp b/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp deleted file mode 100644 index 19998947014..00000000000 --- a/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @file DomainParticipantExtendedQos.cpp - * - */ - -#include - - -namespace eprosima { -namespace fastdds { -namespace dds { - -const DomainParticipantExtendedQos PARTICIPANT_EXTENDED_QOS_DEFAULT; - - -} /* namespace dds */ -} /* namespace fastdds */ -} /* namespace eprosima */ diff --git a/test/unittest/dds/publisher/CMakeLists.txt b/test/unittest/dds/publisher/CMakeLists.txt index 2464a8edce5..348eab958bf 100644 --- a/test/unittest/dds/publisher/CMakeLists.txt +++ b/test/unittest/dds/publisher/CMakeLists.txt @@ -48,7 +48,6 @@ set(DATAWRITERTESTS_SOURCE DataWriterTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipant.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipantFactory.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipantImpl.cpp - ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantFactoryQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/publisher/DataWriter.cpp diff --git a/test/unittest/dds/status/CMakeLists.txt b/test/unittest/dds/status/CMakeLists.txt index 3e3b7f8948b..be2d7bf2916 100644 --- a/test/unittest/dds/status/CMakeLists.txt +++ b/test/unittest/dds/status/CMakeLists.txt @@ -27,7 +27,6 @@ set(LISTENERTESTS_SOURCE ListenerTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipant.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipantFactory.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipantImpl.cpp - ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantFactoryQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/publisher/DataWriter.cpp diff --git a/test/unittest/statistics/dds/CMakeLists.txt b/test/unittest/statistics/dds/CMakeLists.txt index 0e6db6559c1..b08d33f54ec 100644 --- a/test/unittest/statistics/dds/CMakeLists.txt +++ b/test/unittest/statistics/dds/CMakeLists.txt @@ -145,7 +145,6 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX) ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/core/policy/QosPolicyUtils.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipant.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipantFactory.cpp - ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantFactoryQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/log/FileConsumer.cpp @@ -331,7 +330,6 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX) ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/core/policy/QosPolicyUtils.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipant.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/DomainParticipantFactory.cpp - ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantExtendedQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantFactoryQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/domain/qos/DomainParticipantQos.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/publisher/DataWriter.cpp From 60fa17d4f0f4e6a0e2673ae0cdf41124e6261aad Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 4 Jun 2024 10:50:21 +0200 Subject: [PATCH 5/8] Remove unnecessary domain_id in CreateDomainParticipantWithExtendedQosFromProfile test Signed-off-by: Lucia Echevarria --- test/unittest/dds/participant/ParticipantTests.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/unittest/dds/participant/ParticipantTests.cpp b/test/unittest/dds/participant/ParticipantTests.cpp index 7f82567e759..c27e8a24af8 100644 --- a/test/unittest/dds/participant/ParticipantTests.cpp +++ b/test/unittest/dds/participant/ParticipantTests.cpp @@ -626,12 +626,10 @@ TEST(ParticipantTests, CreateDomainParticipantWithExtendedQosFromProfile) default_participant) == RETCODE_OK); // Test create_participant_with_profile using "test_participant_profile" - uint32_t did = 123u; // This is the domain ID set in the "test_participant_profile" - DomainParticipant* participant = DomainParticipantFactory::get_instance()->create_participant_with_profile("test_participant_profile"); ASSERT_NE(participant, nullptr); - ASSERT_EQ(participant->get_domain_id(), did); //Keep the DID given to the method, not the one on the profile + ASSERT_EQ(participant->get_domain_id(), domain_id); //Keep the DID given to the method, not the one on the profile check_participant_extended_qos_from_profile(participant, "test_participant_profile"); ASSERT_TRUE(DomainParticipantFactory::get_instance()->delete_participant(participant) == RETCODE_OK); From 3631bedcab99ada70e858c043347a3196749cf5e Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 4 Jun 2024 10:56:33 +0200 Subject: [PATCH 6/8] Fix uncrustify Signed-off-by: Lucia Echevarria --- test/unittest/dds/participant/ParticipantTests.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unittest/dds/participant/ParticipantTests.cpp b/test/unittest/dds/participant/ParticipantTests.cpp index c27e8a24af8..4baa812e860 100644 --- a/test/unittest/dds/participant/ParticipantTests.cpp +++ b/test/unittest/dds/participant/ParticipantTests.cpp @@ -544,7 +544,8 @@ void check_participant_extended_qos_from_profile( extended_qos.domainId() = participant->get_domain_id(); DomainParticipantExtendedQos profile_extended_qos; - EXPECT_EQ(DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile(profile_name, profile_extended_qos), + EXPECT_EQ(DomainParticipantFactory::get_instance()->get_participant_extended_qos_from_profile(profile_name, + profile_extended_qos), RETCODE_OK); check_equivalent_extended_qos(extended_qos, profile_extended_qos); } From f4bb27c5f88ec61b77f52b9133efe08ff6747bb0 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Tue, 18 Jun 2024 11:10:07 +0200 Subject: [PATCH 7/8] Update versions.md Signed-off-by: Lucia Echevarria --- versions.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/versions.md b/versions.md index a48ac95e29e..d7c8c6e9bdc 100644 --- a/versions.md +++ b/versions.md @@ -59,7 +59,12 @@ Forthcoming * `SenderResource` and Transport APIs now receive a collection of `NetworkBuffer` on their `send` method. * Migrate fastrtps namespace to fastdds * Migrate fastrtps `ResourceManagement` API from `rtps/resources` to `rtps/attributes`. +<<<<<<< HEAD * `const` qualify all data related inputs in DataWriter APIs +======= +* New `DomainParticipantExtendedQos` that includes both `DomainId` and `DomainParticipantQos` (extends `DomainParticipantFactory` API). + +>>>>>>> 463834195 (Update versions.md) Version 2.14.0 -------------- From f1f16ac2734b51207b7a89ac65a27929e84337c4 Mon Sep 17 00:00:00 2001 From: Lucia Echevarria Date: Mon, 24 Jun 2024 09:03:37 +0200 Subject: [PATCH 8/8] Fix versions.md Signed-off-by: Lucia Echevarria --- versions.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/versions.md b/versions.md index d7c8c6e9bdc..455d062c479 100644 --- a/versions.md +++ b/versions.md @@ -59,13 +59,9 @@ Forthcoming * `SenderResource` and Transport APIs now receive a collection of `NetworkBuffer` on their `send` method. * Migrate fastrtps namespace to fastdds * Migrate fastrtps `ResourceManagement` API from `rtps/resources` to `rtps/attributes`. -<<<<<<< HEAD * `const` qualify all data related inputs in DataWriter APIs -======= * New `DomainParticipantExtendedQos` that includes both `DomainId` and `DomainParticipantQos` (extends `DomainParticipantFactory` API). ->>>>>>> 463834195 (Update versions.md) - Version 2.14.0 --------------