diff --git a/examples/cpp/discovery_server/ClientPublisherApp.cpp b/examples/cpp/discovery_server/ClientPublisherApp.cpp index 953259d07c1..52422d14afe 100644 --- a/examples/cpp/discovery_server/ClientPublisherApp.cpp +++ b/examples/cpp/discovery_server/ClientPublisherApp.cpp @@ -198,6 +198,11 @@ ClientPublisherApp::ClientPublisherApp( wqos.durability().kind = VOLATILE_DURABILITY_QOS; } + // So as not to overwriter the first sample + // if we publish inmediately after the discovery + // and the suscription is not prepared yet + wqos.history().depth = 5; + writer_ = publisher_->create_datawriter(topic_, wqos, this); if (writer_ == nullptr) diff --git a/examples/cpp/rtps/ReaderApp.cpp b/examples/cpp/rtps/ReaderApp.cpp index 1c150835a6d..fd7f5a71f73 100644 --- a/examples/cpp/rtps/ReaderApp.cpp +++ b/examples/cpp/rtps/ReaderApp.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -114,17 +114,16 @@ ReaderApp::ReaderApp( std::cout << "Registering RTPS Reader" << std::endl; - TopicAttributes topic_att; - topic_att.topicKind = NO_KEY; - topic_att.topicDataType = "HelloWorld"; - topic_att.topicName = topic_name; + TopicDescription topic_desc; + topic_desc.topic_name = topic_name; + topic_desc.type_name = "HelloWorld"; eprosima::fastdds::dds::ReaderQos reader_qos; reader_qos.m_durability.kind = eprosima::fastdds::dds::TRANSIENT_LOCAL_DURABILITY_QOS; reader_qos.m_reliability.kind = eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS; // Register entity - if (!rtps_participant_->registerReader(rtps_reader_, topic_att, reader_qos)) + if (!rtps_participant_->register_reader(rtps_reader_, topic_desc, reader_qos)) { throw std::runtime_error("Entity registration failed"); } diff --git a/examples/cpp/rtps/WriterApp.cpp b/examples/cpp/rtps/WriterApp.cpp index 6929d1b37ec..75acf558f23 100644 --- a/examples/cpp/rtps/WriterApp.cpp +++ b/examples/cpp/rtps/WriterApp.cpp @@ -28,8 +28,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -105,17 +105,16 @@ WriterApp::WriterApp( std::cout << "Registering RTPS Writer" << std::endl; - TopicAttributes topic_att; - topic_att.topicKind = NO_KEY; - topic_att.topicDataType = "HelloWorld"; - topic_att.topicName = topic_name; + TopicDescription topic_desc; + topic_desc.type_name = "HelloWorld"; + topic_desc.topic_name = topic_name; eprosima::fastdds::dds::WriterQos writer_qos; writer_qos.m_durability.kind = eprosima::fastdds::dds::TRANSIENT_LOCAL_DURABILITY_QOS; writer_qos.m_reliability.kind = eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS; // Register entity - if (!rtps_participant_->registerWriter(rtps_writer_, topic_att, writer_qos)) + if (!rtps_participant_->register_writer(rtps_writer_, topic_desc, writer_qos)) { throw std::runtime_error("Entity registration failed"); } diff --git a/include/fastdds/dds/publisher/DataWriter.hpp b/include/fastdds/dds/publisher/DataWriter.hpp index c7f6227b094..a81dc314ac5 100644 --- a/include/fastdds/dds/publisher/DataWriter.hpp +++ b/include/fastdds/dds/publisher/DataWriter.hpp @@ -19,6 +19,7 @@ #ifndef FASTDDS_DDS_PUBLISHER__DATAWRITER_HPP #define FASTDDS_DDS_PUBLISHER__DATAWRITER_HPP +#include #include #include #include @@ -28,9 +29,9 @@ #include #include #include +#include #include #include -#include namespace eprosima { namespace fastdds { @@ -584,6 +585,17 @@ class DataWriter : public DomainEntity const InstanceHandle_t& handle, const fastdds::dds::Duration_t& max_wait); + /** + * Retrieve the publication data discovery information. + * + * @param [out] publication_data The publication data discovery information. + * + * @return NOT_ENABLED if the writer has not been enabled. + * @return OK if the publication data is returned. + */ + FASTDDS_EXPORTED_API ReturnCode_t get_publication_builtin_topic_data( + PublicationBuiltinTopicData& publication_data) const; + protected: DataWriterImpl* impl_; diff --git a/include/fastdds/dds/publisher/Publisher.hpp b/include/fastdds/dds/publisher/Publisher.hpp index d5812b129d5..a29deab4541 100644 --- a/include/fastdds/dds/publisher/Publisher.hpp +++ b/include/fastdds/dds/publisher/Publisher.hpp @@ -37,9 +37,6 @@ class Publisher; namespace eprosima { namespace fastdds { - -class TopicAttributes; - namespace rtps { class IPayloadPool; diff --git a/include/fastdds/dds/subscriber/DataReader.hpp b/include/fastdds/dds/subscriber/DataReader.hpp index 0a2222b7eb1..b14d50ba7fe 100644 --- a/include/fastdds/dds/subscriber/DataReader.hpp +++ b/include/fastdds/dds/subscriber/DataReader.hpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -1076,6 +1077,17 @@ class DataReader : public DomainEntity FASTDDS_EXPORTED_API ReturnCode_t get_listening_locators( rtps::LocatorList& locators) const; + /** + * Retrieve the subscription data discovery information. + * + * @param [out] subscription_data The subscription data discovery information. + * + * @return NOT_ENABLED if the reader has not been enabled. + * @return OK if the subscription data is returned. + */ + FASTDDS_EXPORTED_API ReturnCode_t get_subscription_builtin_topic_data( + SubscriptionBuiltinTopicData& subscription_data) const; + protected: DataReaderImpl* impl_; diff --git a/include/fastdds/dds/subscriber/Subscriber.hpp b/include/fastdds/dds/subscriber/Subscriber.hpp index 738c9207eab..eba91b2c44d 100644 --- a/include/fastdds/dds/subscriber/Subscriber.hpp +++ b/include/fastdds/dds/subscriber/Subscriber.hpp @@ -40,9 +40,6 @@ class Subscriber; namespace eprosima { namespace fastdds { - -class TopicAttributes; - namespace rtps { class IPayloadPool; diff --git a/include/fastdds/dds/subscriber/qos/DataReaderQos.hpp b/include/fastdds/dds/subscriber/qos/DataReaderQos.hpp index 60c75f41862..4f51984c208 100644 --- a/include/fastdds/dds/subscriber/qos/DataReaderQos.hpp +++ b/include/fastdds/dds/subscriber/qos/DataReaderQos.hpp @@ -25,15 +25,12 @@ #include #include #include -#include #include namespace eprosima { namespace fastdds { namespace dds { -using TopicAttributesQos = fastdds::TopicAttributes; - //! Qos Policy to configure the DisablePositiveACKsQos and the reader attributes class RTPSReliableReaderQos { diff --git a/include/fastdds/dds/topic/qos/TopicQos.hpp b/include/fastdds/dds/topic/qos/TopicQos.hpp index f469d28897c..78898e1c332 100644 --- a/include/fastdds/dds/topic/qos/TopicQos.hpp +++ b/include/fastdds/dds/topic/qos/TopicQos.hpp @@ -21,7 +21,6 @@ #define FASTDDS_DDS_TOPIC_QOS__TOPICQOS_HPP #include -#include #include diff --git a/include/fastdds/rtps/RTPSDomain.hpp b/include/fastdds/rtps/RTPSDomain.hpp index 55eb3766361..6f2935dd25e 100644 --- a/include/fastdds/rtps/RTPSDomain.hpp +++ b/include/fastdds/rtps/RTPSDomain.hpp @@ -29,7 +29,6 @@ #include #include #include -#include namespace eprosima { namespace fastdds { @@ -251,18 +250,6 @@ class RTPSDomain FASTDDS_EXPORTED_API static bool set_library_settings( const fastdds::LibrarySettings& library_settings); - /** - * @brief Get the TopicAttributes from XML profile. - * - * @param profile_name Topic profile name. - * @param topic_att TopicAttributes object where the attributes are returned. - * @return bool true if the profile exists. - * false otherwise. - */ - FASTDDS_EXPORTED_API static bool get_topic_attributes_from_profile( - const std::string& profile_name, - TopicAttributes& topic_att); - private: RTPSDomain() = delete; diff --git a/include/fastdds/rtps/builtin/data/PublicationBuiltinTopicData.hpp b/include/fastdds/rtps/builtin/data/PublicationBuiltinTopicData.hpp index 5fe3f9a1616..0e75bbbe265 100644 --- a/include/fastdds/rtps/builtin/data/PublicationBuiltinTopicData.hpp +++ b/include/fastdds/rtps/builtin/data/PublicationBuiltinTopicData.hpp @@ -37,11 +37,16 @@ namespace rtps { /// Structure PublicationBuiltinTopicData, contains the information on a discovered publication. struct PublicationBuiltinTopicData { + PublicationBuiltinTopicData() + { + reliability.kind = dds::RELIABLE_RELIABILITY_QOS; + } + /// Builtin topic Key - BuiltinTopicKey_t key; + BuiltinTopicKey_t key{{0, 0, 0}}; /// Builtin participant topic Key - BuiltinTopicKey_t participant_key; + BuiltinTopicKey_t participant_key{{0, 0, 0}}; /// Topic name fastcdr::string_255 topic_name; diff --git a/include/fastdds/rtps/builtin/data/SubscriptionBuiltinTopicData.hpp b/include/fastdds/rtps/builtin/data/SubscriptionBuiltinTopicData.hpp index 136242a4dd2..4227009b395 100644 --- a/include/fastdds/rtps/builtin/data/SubscriptionBuiltinTopicData.hpp +++ b/include/fastdds/rtps/builtin/data/SubscriptionBuiltinTopicData.hpp @@ -36,10 +36,10 @@ namespace rtps { struct SubscriptionBuiltinTopicData { /// Builtin topic Key - BuiltinTopicKey_t key; + BuiltinTopicKey_t key{{0, 0, 0}}; /// Builtin participant topic Key - BuiltinTopicKey_t participant_key; + BuiltinTopicKey_t participant_key{{0, 0, 0}}; /// Topic name fastcdr::string_255 topic_name; diff --git a/include/fastdds/rtps/builtin/data/TopicDescription.hpp b/include/fastdds/rtps/builtin/data/TopicDescription.hpp new file mode 100644 index 00000000000..e8d445d1506 --- /dev/null +++ b/include/fastdds/rtps/builtin/data/TopicDescription.hpp @@ -0,0 +1,51 @@ +// 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 TopicDescription.hpp + */ + +#ifndef FASTDDS_RTPS_BUILTIN_DATA__TOPICDESCRIPTION_HPP +#define FASTDDS_RTPS_BUILTIN_DATA__TOPICDESCRIPTION_HPP + +#include +#include + +#include + +#include + +namespace eprosima { +namespace fastdds { +namespace rtps { + +/// Structure TopicDescription, used to register an endpoint on a topic. +struct TopicDescription +{ + /// Topic name + fastcdr::string_255 topic_name; + + /// Type name + fastcdr::string_255 type_name; + + /// Type information + dds::xtypes::TypeInformationParameter type_information; + +}; + +} // namespace rtps +} // namespace fastdds +} // namespace eprosima + +#endif // FASTDDS_RTPS_BUILTIN_DATA__TOPICDESCRIPTION_HPP diff --git a/include/fastdds/rtps/common/LocatorList.hpp b/include/fastdds/rtps/common/LocatorList.hpp index 149eac8e10b..3779cc4beed 100644 --- a/include/fastdds/rtps/common/LocatorList.hpp +++ b/include/fastdds/rtps/common/LocatorList.hpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -376,6 +377,16 @@ class LocatorList return false; } + // Copy the inner locator list to a ResourceLimitedVector locator list. + FASTDDS_EXPORTED_API void copy_to( + eprosima::fastdds::ResourceLimitedVector& locator_list) const + { + for (auto& locator : m_locators) + { + locator_list.emplace_back(locator); + } + } + private: std::vector m_locators; diff --git a/include/fastdds/rtps/participant/RTPSParticipant.hpp b/include/fastdds/rtps/participant/RTPSParticipant.hpp index 46c618c954e..30f27ac906d 100644 --- a/include/fastdds/rtps/participant/RTPSParticipant.hpp +++ b/include/fastdds/rtps/participant/RTPSParticipant.hpp @@ -53,9 +53,6 @@ struct IStatusObserver; #endif //FASTDDS_STATISTICS namespace fastdds { - -class TopicAttributes; - namespace rtps { struct PublicationBuiltinTopicData; @@ -64,6 +61,7 @@ class RTPSParticipantListener; class RTPSWriter; class RTPSReader; struct SubscriptionBuiltinTopicData; +struct TopicDescription; class EndpointAttributes; class WriterAttributes; class ReaderAttributes; @@ -139,29 +137,33 @@ class FASTDDS_EXPORTED_API RTPSParticipant uint32_t getRTPSParticipantID() const; /** - * Register a RTPSWriter in the builtin Protocols. - * @param Writer Pointer to the RTPSWriter. - * @param topicAtt Topic Attributes where you want to register it. - * @param wqos WriterQos. + * Register a Writer in the BuiltinProtocols. + * + * @param rtps_writer Pointer to the RTPSWriter. + * @param topic Information regarding the topic where the writer is registering. + * @param qos Qos policies of the writer. + * * @return True if correctly registered. */ - bool registerWriter( - RTPSWriter* Writer, - const TopicAttributes& topicAtt, - const fastdds::dds::WriterQos& wqos); + bool register_writer( + RTPSWriter* rtps_writer, + const TopicDescription& topic, + const fastdds::dds::WriterQos& qos); /** - * Register a RTPSReader in the builtin Protocols. - * @param Reader Pointer to the RTPSReader. - * @param topicAtt Topic Attributes where you want to register it. - * @param rqos ReaderQos. + * Register a Reader in the BuiltinProtocols. + * + * @param rtps_reader Pointer to the RTPSReader. + * @param topic Information regarding the topic where the reader is registering. + * @param qos Qos policies of the reader. * @param content_filter Optional content filtering information. + * * @return True if correctly registered. */ - bool registerReader( - RTPSReader* Reader, - const TopicAttributes& topicAtt, - const fastdds::dds::ReaderQos& rqos, + bool register_reader( + RTPSReader* rtps_reader, + const TopicDescription& topic, + const fastdds::dds::ReaderQos& qos, const ContentFilterProperty* content_filter = nullptr); /** @@ -172,28 +174,24 @@ class FASTDDS_EXPORTED_API RTPSParticipant const RTPSParticipantAttributes& patt); /** - * Update writer QOS - * @param Writer to update - * @param topicAtt Topic Attributes where you want to register it. - * @param wqos New writer QoS - * @return true on success + * Update local writer QoS + * @param rtps_writer Writer to update. + * @param wqos New QoS for the writer. + * @return True on success */ - bool updateWriter( - RTPSWriter* Writer, - const TopicAttributes& topicAtt, + bool update_writer( + RTPSWriter* rtps_writer, const fastdds::dds::WriterQos& wqos); /** - * Update reader QOS - * @param Reader Pointer to the RTPSReader to update - * @param topicAtt Topic Attributes where you want to register it. - * @param rqos New reader QoS - * @param content_filter Optional content filtering information. - * @return true on success + * Update local reader QoS + * @param rtps_reader Reader to update. + * @param rqos New QoS for the reader. + * @param content_filter Optional content filtering information. + * @return True on success */ - bool updateReader( - RTPSReader* Reader, - const TopicAttributes& topicAtt, + bool update_reader( + RTPSReader* rtps_reader, const fastdds::dds::ReaderQos& rqos, const ContentFilterProperty* content_filter = nullptr); diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 394b67cbd34..e0be0a759a3 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -116,7 +116,6 @@ set(${PROJECT_NAME}_source_files rtps/attributes/RTPSParticipantAttributes.cpp rtps/attributes/ServerAttributes.cpp rtps/attributes/ThreadSettings.cpp - rtps/attributes/TopicAttributes.cpp rtps/builtin/BuiltinProtocols.cpp rtps/builtin/data/ParticipantProxyData.cpp rtps/builtin/data/ProxyDataConverters.cpp @@ -237,6 +236,7 @@ set(${PROJECT_NAME}_source_files utils/SystemInfo.cpp utils/TimedConditionVariable.cpp utils/UnitsParser.cpp + xmlparser/attributes/TopicAttributes.cpp xmlparser/XMLDynamicParser.cpp xmlparser/XMLElementParser.cpp xmlparser/XMLEndpointParser.cpp diff --git a/src/cpp/fastdds/domain/DomainParticipantImpl.cpp b/src/cpp/fastdds/domain/DomainParticipantImpl.cpp index 6449cef4677..1fa326eedba 100644 --- a/src/cpp/fastdds/domain/DomainParticipantImpl.cpp +++ b/src/cpp/fastdds/domain/DomainParticipantImpl.cpp @@ -67,6 +67,7 @@ #include #include #include +#include #include namespace eprosima { @@ -116,7 +117,7 @@ DomainParticipantImpl::DomainParticipantImpl( XMLProfileManager::getDefaultSubscriberAttributes(sub_attr); utils::set_qos_from_attributes(default_sub_qos_, sub_attr); - TopicAttributes top_attr; + xmlparser::TopicAttributes top_attr; XMLProfileManager::getDefaultTopicAttributes(top_attr); utils::set_qos_from_attributes(default_topic_qos_, top_attr); @@ -1114,7 +1115,7 @@ void DomainParticipantImpl::reset_default_topic_qos() { // TODO (ILG): Change when we have full XML support for DDS QoS profiles TopicImpl::set_qos(default_topic_qos_, TOPIC_QOS_DEFAULT, true); - TopicAttributes attr; + xmlparser::TopicAttributes attr; XMLProfileManager::getDefaultTopicAttributes(attr); utils::set_qos_from_attributes(default_topic_qos_, attr); } @@ -1128,7 +1129,7 @@ ReturnCode_t DomainParticipantImpl::get_topic_qos_from_profile( const std::string& profile_name, TopicQos& qos) const { - TopicAttributes attr; + xmlparser::TopicAttributes attr; if (XMLP_ret::XML_OK == XMLProfileManager::fillTopicAttributes(profile_name, attr)) { qos = default_topic_qos_; @@ -1405,7 +1406,7 @@ Topic* DomainParticipantImpl::create_topic_with_profile( const StatusMask& mask) { // TODO (ILG): Change when we have full XML support for DDS QoS profiles - TopicAttributes attr; + xmlparser::TopicAttributes attr; if (XMLP_ret::XML_OK == XMLProfileManager::fillTopicAttributes(profile_name, attr)) { TopicQos qos = default_topic_qos_; @@ -1884,6 +1885,55 @@ DomainParticipantListener* DomainParticipantImpl::get_listener_for( return nullptr; } +bool DomainParticipantImpl::fill_type_information( + const TypeSupport& type, + xtypes::TypeInformationParameter& type_information) +{ + using utils::to_type_propagation; + using utils::TypePropagation; + + auto properties = qos_.properties(); + auto type_propagation = to_type_propagation(properties); + bool should_assign_type_information = + (TypePropagation::TYPEPROPAGATION_ENABLED == type_propagation) || + (TypePropagation::TYPEPROPAGATION_MINIMAL_BANDWIDTH == type_propagation); + + if (should_assign_type_information && (xtypes::TK_NONE != type->type_identifiers().type_identifier1()._d())) + { + xtypes::TypeInformation type_info; + + if (RETCODE_OK == + fastdds::rtps::RTPSDomainImpl::get_instance()->type_object_registry_observer().get_type_information( + type->type_identifiers(), type_info)) + { + switch (type_propagation) + { + case TypePropagation::TYPEPROPAGATION_ENABLED: + { + // Use both complete and minimal type information + type_information.type_information = type_info; + break; + } + case TypePropagation::TYPEPROPAGATION_MINIMAL_BANDWIDTH: + { + // Use minimal type information only + type_information.type_information.minimal() = type_info.minimal(); + break; + } + default: + // This should never happen as other cases are protected by should_assign_type_information + assert(false); + break; + } + + type_information.assigned(true); + return true; + } + } + + return false; +} + } // namespace dds } // namespace fastdds } // namespace eprosima diff --git a/src/cpp/fastdds/domain/DomainParticipantImpl.hpp b/src/cpp/fastdds/domain/DomainParticipantImpl.hpp index ba481ff0717..58e40721bef 100644 --- a/src/cpp/fastdds/domain/DomainParticipantImpl.hpp +++ b/src/cpp/fastdds/domain/DomainParticipantImpl.hpp @@ -508,6 +508,18 @@ class DomainParticipantImpl return id_counter_; } + /** + * @brief Fill a TypeInformationParameter with the type information of a TypeSupport. + * + * @param type TypeSupport to get the type information from. + * @param type_information TypeInformationParameter to fill. + * + * @return true if the constraints for propagating the type information are met. + */ + bool fill_type_information( + const TypeSupport& type, + xtypes::TypeInformationParameter& type_information); + protected: //!Domain id diff --git a/src/cpp/fastdds/publisher/DataWriter.cpp b/src/cpp/fastdds/publisher/DataWriter.cpp index aca2229dfef..7ca2dbda822 100644 --- a/src/cpp/fastdds/publisher/DataWriter.cpp +++ b/src/cpp/fastdds/publisher/DataWriter.cpp @@ -308,6 +308,12 @@ ReturnCode_t DataWriter::wait_for_acknowledgments( return impl_->wait_for_acknowledgments(instance, handle, max_wait); } +ReturnCode_t DataWriter::get_publication_builtin_topic_data( + PublicationBuiltinTopicData& publication_data) const +{ + return impl_->get_publication_builtin_topic_data(publication_data); +} + } // namespace dds } // namespace fastdds } // namespace eprosima diff --git a/src/cpp/fastdds/publisher/DataWriterHistory.cpp b/src/cpp/fastdds/publisher/DataWriterHistory.cpp index 4a5342ca44f..963ae6c3c39 100644 --- a/src/cpp/fastdds/publisher/DataWriterHistory.cpp +++ b/src/cpp/fastdds/publisher/DataWriterHistory.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -35,20 +36,22 @@ namespace dds { using namespace eprosima::fastdds::rtps; HistoryAttributes DataWriterHistory::to_history_attributes( - const TopicAttributes& topic_att, + const HistoryQosPolicy& history_qos, + const ResourceLimitsQosPolicy& resource_limits_qos, + const rtps::TopicKind_t& topic_kind, uint32_t payloadMaxSize, MemoryManagementPolicy_t mempolicy) { - auto initial_samples = topic_att.resourceLimitsQos.allocated_samples; - auto max_samples = topic_att.resourceLimitsQos.max_samples; - auto extra_samples = topic_att.resourceLimitsQos.extra_samples; + auto initial_samples = resource_limits_qos.allocated_samples; + auto max_samples = resource_limits_qos.max_samples; + auto extra_samples = resource_limits_qos.extra_samples; - if (topic_att.historyQos.kind != KEEP_ALL_HISTORY_QOS) + if (history_qos.kind != KEEP_ALL_HISTORY_QOS) { - max_samples = topic_att.historyQos.depth; - if (topic_att.getTopicKind() != NO_KEY) + max_samples = history_qos.depth; + if (topic_kind != NO_KEY) { - max_samples *= topic_att.resourceLimitsQos.max_instances; + max_samples *= resource_limits_qos.max_instances; } initial_samples = std::min(initial_samples, max_samples); @@ -60,14 +63,17 @@ HistoryAttributes DataWriterHistory::to_history_attributes( DataWriterHistory::DataWriterHistory( const std::shared_ptr& payload_pool, const std::shared_ptr& change_pool, - const TopicAttributes& topic_att, + const HistoryQosPolicy& history_qos, + const ResourceLimitsQosPolicy& resource_limits_qos, + const rtps::TopicKind_t& topic_kind, uint32_t payloadMaxSize, MemoryManagementPolicy_t mempolicy, std::function unack_sample_remove_functor) - : WriterHistory(to_history_attributes(topic_att, payloadMaxSize, mempolicy), payload_pool, change_pool) - , history_qos_(topic_att.historyQos) - , resource_limited_qos_(topic_att.resourceLimitsQos) - , topic_att_(topic_att) + : WriterHistory(to_history_attributes(history_qos, resource_limits_qos, topic_kind, payloadMaxSize, + mempolicy), payload_pool, change_pool) + , history_qos_(history_qos) + , resource_limited_qos_(resource_limits_qos) + , topic_kind_(topic_kind) , unacknowledged_sample_removed_functor_(unack_sample_remove_functor) { if (resource_limited_qos_.max_samples <= 0) @@ -92,7 +98,7 @@ DataWriterHistory::~DataWriterHistory() void DataWriterHistory::rebuild_instances() { - if (topic_att_.getTopicKind() == WITH_KEY) + if (topic_kind_ == WITH_KEY) { for (CacheChange_t* change : m_changes) { @@ -114,7 +120,7 @@ bool DataWriterHistory::register_instance( payload = nullptr; /// Preconditions - if (topic_att_.getTopicKind() == NO_KEY) + if (topic_kind_ == NO_KEY) { return false; } @@ -148,7 +154,7 @@ bool DataWriterHistory::prepare_change( { bool ret = false; bool is_acked = change_is_acked_or_fully_delivered(m_changes.front()); - InstanceHandle_t instance = topic_att_.getTopicKind() == NO_KEY ? + InstanceHandle_t instance = topic_kind_ == NO_KEY ? HANDLE_NIL : m_changes.front()->instanceHandle; if (history_qos_.kind == KEEP_ALL_HISTORY_QOS) @@ -168,7 +174,7 @@ bool DataWriterHistory::prepare_change( else if (!ret) { EPROSIMA_LOG_WARNING(RTPS_HISTORY, - "Attempting to add Data to Full WriterCache: " << topic_att_.getTopicDataType()); + "Attempting to add Data to Full WriterCache."); return false; } } @@ -176,8 +182,8 @@ bool DataWriterHistory::prepare_change( assert(!m_isHistoryFull); // For NO_KEY we can directly add the change - bool add = (topic_att_.getTopicKind() == NO_KEY); - if (topic_att_.getTopicKind() == WITH_KEY) + bool add = (topic_kind_ == NO_KEY); + if (topic_kind_ == WITH_KEY) { t_m_Inst_Caches::iterator vit; @@ -272,9 +278,8 @@ bool DataWriterHistory::add_pub_change( #endif // if HAVE_STRICT_REALTIME { EPROSIMA_LOG_INFO(RTPS_HISTORY, - topic_att_.getTopicDataType() - << " Change " << change->sequenceNumber << " added with key: " << change->instanceHandle - << " and " << change->serializedPayload.length << " bytes"); + " Change " << change->sequenceNumber << " added with key: " << change->instanceHandle + << " and " << change->serializedPayload.length << " bytes"); returnedValue = true; } } @@ -380,7 +385,7 @@ bool DataWriterHistory::remove_change_pub( std::lock_guard guard(*this->mp_mutex); #endif // if HAVE_STRICT_REALTIME - if (topic_att_.getTopicKind() == NO_KEY) + if (topic_kind_ == NO_KEY) { if (remove_change(change, max_blocking_time)) { @@ -439,7 +444,7 @@ bool DataWriterHistory::remove_instance_changes( return false; } - if (topic_att_.getTopicKind() == NO_KEY) + if (topic_kind_ == NO_KEY) { EPROSIMA_LOG_ERROR(RTPS_HISTORY, "Cannot be removed instance changes of a NO_KEY DataType"); return false; @@ -484,12 +489,12 @@ bool DataWriterHistory::set_next_deadline( } std::lock_guard guard(*this->mp_mutex); - if (topic_att_.getTopicKind() == NO_KEY) + if (topic_kind_ == NO_KEY) { next_deadline_us_ = next_deadline_us; return true; } - else if (topic_att_.getTopicKind() == WITH_KEY) + else if (topic_kind_ == WITH_KEY) { if (keyed_changes_.find(handle) == keyed_changes_.end()) { @@ -514,7 +519,7 @@ bool DataWriterHistory::get_next_deadline( } std::lock_guard guard(*this->mp_mutex); - if (topic_att_.getTopicKind() == WITH_KEY) + if (topic_kind_ == WITH_KEY) { auto min = std::min_element( keyed_changes_.begin(), @@ -530,7 +535,7 @@ bool DataWriterHistory::get_next_deadline( next_deadline_us = min->second.next_deadline_us; return true; } - else if (topic_att_.getTopicKind() == NO_KEY) + else if (topic_kind_ == NO_KEY) { next_deadline_us = next_deadline_us_; return true; @@ -558,7 +563,7 @@ bool DataWriterHistory::wait_for_acknowledgement_last_change( std::unique_lock& lock, const std::chrono::time_point& max_blocking_time) { - if (WITH_KEY == topic_att_.getTopicKind()) + if (WITH_KEY == topic_kind_) { // Find the instance t_m_Inst_Caches::iterator vit = keyed_changes_.find(handle); diff --git a/src/cpp/fastdds/publisher/DataWriterHistory.hpp b/src/cpp/fastdds/publisher/DataWriterHistory.hpp index c10245ca03e..f941581ed1f 100644 --- a/src/cpp/fastdds/publisher/DataWriterHistory.hpp +++ b/src/cpp/fastdds/publisher/DataWriterHistory.hpp @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -48,21 +47,30 @@ class DataWriterHistory : public rtps::WriterHistory public: static rtps::HistoryAttributes to_history_attributes( - const TopicAttributes& topic_att, + const HistoryQosPolicy& history_qos, + const ResourceLimitsQosPolicy& resource_limits_qos, + const rtps::TopicKind_t& topic_kind, uint32_t payloadMaxSize, rtps::MemoryManagementPolicy_t mempolicy); /** * Constructor of the DataWriterHistory. - * @param topic_att TopicAttributed - * @param payloadMax Maximum payload size. - * @param mempolicy Set whether the payloads can dynamically resized or not. - * @param unack_sample_remove_functor Functor to call DDS listener callback on_unacknowledged_sample_removed + * + * @param payload_pool Pool to use for allocation of payloads. + * @param change_pool Pool to use for allocation of changes. + * @param history_qos HistoryQosPolicy of the DataWriter creating this history. + * @param resource_limits_qos ResourceLimitsQosPolicy of the DataWriter creating this history. + * @param topic_kind TopicKind of the DataWriter creating this history. + * @param payloadMax Maximum payload size. + * @param mempolicy Set whether the payloads can dynamically resized or not. + * @param unack_sample_remove_functor Functor to call DDS listener callback on_unacknowledged_sample_removed */ DataWriterHistory( const std::shared_ptr& payload_pool, const std::shared_ptr& change_pool, - const TopicAttributes& topic_att, + const HistoryQosPolicy& history_qos, + const ResourceLimitsQosPolicy& resource_limits_qos, + const rtps::TopicKind_t& topic_kind, uint32_t payloadMax, rtps::MemoryManagementPolicy_t mempolicy, std::function unack_sample_remove_functor); @@ -152,9 +160,8 @@ class DataWriterHistory : public rtps::WriterHistory #endif // if HAVE_STRICT_REALTIME { EPROSIMA_LOG_INFO(RTPS_HISTORY, - topic_att_.getTopicDataType() - << " Change " << change->sequenceNumber << " added with key: " << change->instanceHandle - << " and " << change->serializedPayload.length << " bytes"); + " Change " << change->sequenceNumber << " added with key: " << change->instanceHandle + << " and " << change->serializedPayload.length << " bytes"); returnedValue = true; } } @@ -257,8 +264,8 @@ class DataWriterHistory : public rtps::WriterHistory HistoryQosPolicy history_qos_; //!ResourceLimitsQosPolicy values. ResourceLimitsQosPolicy resource_limited_qos_; - //!Topic Attributes - TopicAttributes topic_att_; + //!TopicKind + rtps::TopicKind_t topic_kind_; //! Unacknowledged sample removed functor std::function unacknowledged_sample_removed_functor_; diff --git a/src/cpp/fastdds/publisher/DataWriterImpl.cpp b/src/cpp/fastdds/publisher/DataWriterImpl.cpp index 406155d8f09..c3900f5324c 100644 --- a/src/cpp/fastdds/publisher/DataWriterImpl.cpp +++ b/src/cpp/fastdds/publisher/DataWriterImpl.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include @@ -53,6 +53,7 @@ #include #include #include +#include #ifdef FASTDDS_STATISTICS #include #include @@ -228,7 +229,9 @@ void DataWriterImpl::create_history( { history_.reset(new DataWriterHistory( payload_pool, change_pool, - get_topic_attributes(qos_, *topic_, type_), + qos_.history(), + qos_.resource_limits(), + (type_->is_compute_key_provided ? WITH_KEY : NO_KEY), type_->max_serialized_type_size, qos_.endpoint().history_memory_policy, [this]( @@ -245,9 +248,10 @@ ReturnCode_t DataWriterImpl::enable() { assert(writer_ == nullptr); - auto topic_att = get_topic_attributes(qos_, *topic_, type_); auto history_att = DataWriterHistory::to_history_attributes( - topic_att, type_->max_serialized_type_size, qos_.endpoint().history_memory_policy); + qos_.history(), + qos_.resource_limits(), (type_->is_compute_key_provided ? WITH_KEY : NO_KEY), type_->max_serialized_type_size, + qos_.endpoint().history_memory_policy); pool_config_ = PoolConfig::from_history_attributes(history_att); // When the user requested PREALLOCATED_WITH_REALLOC, but we know the type cannot @@ -454,6 +458,11 @@ ReturnCode_t DataWriterImpl::enable() } // REGISTER THE WRITER + fastdds::rtps::TopicDescription topic_desc; + topic_desc.topic_name = topic_->get_name(); + topic_desc.type_name = topic_->get_type_name(); + publisher_->get_participant_impl()->fill_type_information(type_, topic_desc.type_information); + WriterQos wqos = qos_.get_writerqos(get_publisher()->get_qos(), topic_->get_qos()); if (!is_data_sharing_compatible_) { @@ -470,7 +479,7 @@ ReturnCode_t DataWriterImpl::enable() wqos.m_partition.push_back(partition_name.c_str()); } } - publisher_->rtps_participant()->registerWriter(writer_, get_topic_attributes(qos_, *topic_, type_), wqos); + publisher_->rtps_participant()->register_writer(writer_, topic_desc, wqos); return RETCODE_OK; } @@ -1176,7 +1185,7 @@ void DataWriterImpl::publisher_qos_updated() { //NOTIFY THE BUILTIN PROTOCOLS THAT THE WRITER HAS CHANGED WriterQos wqos = qos_.get_writerqos(get_publisher()->get_qos(), topic_->get_qos()); - publisher_->rtps_participant()->updateWriter(writer_, get_topic_attributes(qos_, *topic_, type_), wqos); + publisher_->rtps_participant()->update_writer(writer_, wqos); } } @@ -1225,9 +1234,8 @@ ReturnCode_t DataWriterImpl::set_qos( } //Notify the participant that a Writer has changed its QOS - fastdds::TopicAttributes topic_att = get_topic_attributes(qos_, *topic_, type_); WriterQos wqos = qos_.get_writerqos(get_publisher()->get_qos(), topic_->get_qos()); - publisher_->rtps_participant()->updateWriter(writer_, topic_att, wqos); + publisher_->rtps_participant()->update_writer(writer_, wqos); // Deadline if (qos_.deadline().period != dds::c_TimeInfinite) @@ -1677,59 +1685,97 @@ ReturnCode_t DataWriterImpl::assert_liveliness() return RETCODE_OK; } -fastdds::TopicAttributes DataWriterImpl::get_topic_attributes( - const DataWriterQos& qos, - const Topic& topic, - const TypeSupport& type) +ReturnCode_t DataWriterImpl::get_publication_builtin_topic_data( + PublicationBuiltinTopicData& publication_data) const { - fastdds::TopicAttributes topic_att; - topic_att.historyQos = qos.history(); - topic_att.resourceLimitsQos = qos.resource_limits(); - topic_att.topicName = topic.get_name(); - topic_att.topicDataType = topic.get_type_name(); - topic_att.topicKind = type->is_compute_key_provided ? WITH_KEY : NO_KEY; + if (nullptr == writer_) + { + return RETCODE_NOT_ENABLED; + } + + // sanity checks + assert(nullptr != publisher_); + assert(nullptr != topic_); + assert(nullptr != publisher_->get_participant()); + assert(nullptr != writer_->get_participant_impl()); + + publication_data = PublicationBuiltinTopicData{}; + + from_proxy_to_builtin(guid_.entityId, publication_data.key.value); + from_proxy_to_builtin(publisher_->get_participant()->guid().guidPrefix, publication_data.participant_key.value); - using utils::to_type_propagation; - using utils::TypePropagation; + publication_data.topic_name = topic_->get_name(); + publication_data.type_name = topic_->get_type_name(); + publication_data.topic_data = topic_->get_qos().topic_data(); - auto properties = publisher_->get_participant()->get_qos().properties(); - auto type_propagation = to_type_propagation(properties); - bool should_assign_type_information = - (TypePropagation::TYPEPROPAGATION_ENABLED == type_propagation) || - (TypePropagation::TYPEPROPAGATION_MINIMAL_BANDWIDTH == type_propagation); + // DataWriter qos + publication_data.durability = qos_.durability(); + publication_data.durability_service = qos_.durability_service(); + publication_data.deadline = qos_.deadline(); + publication_data.latency_budget = qos_.latency_budget(); + publication_data.liveliness = qos_.liveliness(); + publication_data.reliability = qos_.reliability(); + publication_data.lifespan = qos_.lifespan(); + publication_data.user_data = qos_.user_data(); + publication_data.ownership = qos_.ownership(); + publication_data.ownership_strength = qos_.ownership_strength(); + publication_data.destination_order = qos_.destination_order(); - if (should_assign_type_information && (xtypes::TK_NONE != type->type_identifiers().type_identifier1()._d())) + // Publisher qos + publication_data.presentation = publisher_->qos_.presentation(); + publication_data.partition = publisher_->qos_.partition(); + publication_data.group_data = publisher_->qos_.group_data(); + + // XTypes 1.3 + publisher_->get_participant_impl()->fill_type_information(type_, publication_data.type_information); + publication_data.representation = qos_.representation(); + + // eProsima extensions + + publication_data.disable_positive_acks = qos_.reliable_writer_qos().disable_positive_acks; + publication_data.data_sharing = qos_.data_sharing(); + + if (publication_data.data_sharing.kind() != OFF && + publication_data.data_sharing.domain_ids().empty()) { - xtypes::TypeInformation type_info; + publication_data.data_sharing.add_domain_id(utils::default_domain_id()); + } - if (RETCODE_OK == - fastdds::rtps::RTPSDomainImpl::get_instance()->type_object_registry_observer().get_type_information( - type->type_identifiers(), type_info)) - { - switch (type_propagation) - { - case TypePropagation::TYPEPROPAGATION_ENABLED: - { - // Use both complete and minimal type information - topic_att.type_information.type_information = type_info; - break; - } - case TypePropagation::TYPEPROPAGATION_MINIMAL_BANDWIDTH: - { - // Use minimal type information only - topic_att.type_information.type_information.minimal() = type_info.minimal(); - break; - } - default: - // This should never happen as other cases are protected by should_assign_type_information - assert(false); - break; - } + publication_data.guid = guid(); + publication_data.participant_guid = publisher_->get_participant()->guid(); + + const std::string* pers_guid = PropertyPolicyHelper::find_property(qos_.properties(), "dds.persistence.guid"); + if (pers_guid) + { + // Load persistence_guid from property + std::istringstream(pers_guid->c_str()) >> publication_data.persistence_guid; + } + + qos_.endpoint().unicast_locator_list.copy_to(publication_data.remote_locators.unicast); + qos_.endpoint().multicast_locator_list.copy_to(publication_data.remote_locators.multicast); + publication_data.max_serialized_size = type_->max_serialized_type_size; + publication_data.loopback_transformation = + writer_->get_participant_impl()->network_factory().network_configuration(); + + if (!is_data_sharing_compatible_) + { + publication_data.data_sharing.off(); + } - topic_att.type_information.assigned(true); + const std::string* endpoint_partitions = PropertyPolicyHelper::find_property(qos_.properties(), "partitions"); + if (endpoint_partitions) + { + std::istringstream partition_string(*endpoint_partitions); + std::string partition_name; + publication_data.partition.clear(); + + while (std::getline(partition_string, partition_name, ';')) + { + publication_data.partition.push_back(partition_name.c_str()); } } - return topic_att; + + return RETCODE_OK; } OfferedIncompatibleQosStatus& DataWriterImpl::update_offered_incompatible_qos( diff --git a/src/cpp/fastdds/publisher/DataWriterImpl.hpp b/src/cpp/fastdds/publisher/DataWriterImpl.hpp index d735c737a3b..7ddd8927e24 100644 --- a/src/cpp/fastdds/publisher/DataWriterImpl.hpp +++ b/src/cpp/fastdds/publisher/DataWriterImpl.hpp @@ -21,6 +21,7 @@ #include +#include #include #include #include @@ -33,8 +34,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -380,6 +381,17 @@ class DataWriterImpl : protected rtps::IReaderDataFilter void filter_is_being_removed( const char* filter_class_name); + /** + * Retrieve the publication data discovery information. + * + * @param [out] publication_data The publication data discovery information. + * + * @return NOT_ENABLED if the writer has not been enabled. + * @return OK if the publication data is returned. + */ + ReturnCode_t get_publication_builtin_topic_data( + PublicationBuiltinTopicData& publication_data) const; + protected: using IChangePool = eprosima::fastdds::rtps::IChangePool; @@ -585,11 +597,6 @@ class DataWriterImpl : protected rtps::IReaderDataFilter fastdds::rtps::WriteParams& wparams, const InstanceHandle_t& handle); - fastdds::TopicAttributes get_topic_attributes( - const DataWriterQos& qos, - const Topic& topic, - const TypeSupport& type); - static void set_qos( DataWriterQos& to, const DataWriterQos& from, diff --git a/src/cpp/fastdds/subscriber/DataReader.cpp b/src/cpp/fastdds/subscriber/DataReader.cpp index 4c20043805d..9e93b84ee03 100644 --- a/src/cpp/fastdds/subscriber/DataReader.cpp +++ b/src/cpp/fastdds/subscriber/DataReader.cpp @@ -488,6 +488,12 @@ ReturnCode_t DataReader::get_listening_locators( return impl_->get_listening_locators(locators); } +ReturnCode_t DataReader::get_subscription_builtin_topic_data( + SubscriptionBuiltinTopicData& subscription_data) const +{ + return impl_->get_subscription_builtin_topic_data(subscription_data); +} + } /* namespace dds */ } /* namespace fastdds */ } /* namespace eprosima */ diff --git a/src/cpp/fastdds/subscriber/DataReaderImpl.cpp b/src/cpp/fastdds/subscriber/DataReaderImpl.cpp index ced294f57e8..10e9e8de36a 100644 --- a/src/cpp/fastdds/subscriber/DataReaderImpl.cpp +++ b/src/cpp/fastdds/subscriber/DataReaderImpl.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -53,6 +54,7 @@ #include #include #include +#include #ifdef FASTDDS_STATISTICS #include #include @@ -214,13 +216,13 @@ ReturnCode_t DataReaderImpl::enable() att.endpoint.properties.properties().push_back(std::move(property)); } - bool is_datasharing_compatible = false; - ReturnCode_t ret_code = check_datasharing_compatible(att, is_datasharing_compatible); + is_data_sharing_compatible_ = false; + ReturnCode_t ret_code = check_datasharing_compatible(att, is_data_sharing_compatible_); if (ret_code != RETCODE_OK) { return ret_code; } - if (is_datasharing_compatible) + if (is_data_sharing_compatible_) { DataSharingQosPolicy datasharing(qos_.data_sharing()); if (datasharing.domain_ids().empty()) @@ -275,8 +277,13 @@ ReturnCode_t DataReaderImpl::enable() qos_.lifespan().duration.to_ns() * 1e-6); // Register the reader + fastdds::rtps::TopicDescription topic_desc; + topic_desc.topic_name = topic_->get_impl()->get_rtps_topic_name(); + topic_desc.type_name = topic_->get_type_name(); + subscriber_->get_participant_impl()->fill_type_information(type_, topic_desc.type_information); + ReaderQos rqos = qos_.get_readerqos(subscriber_->get_qos()); - if (!is_datasharing_compatible) + if (!is_data_sharing_compatible_) { rqos.data_sharing.off(); } @@ -297,7 +304,11 @@ ReturnCode_t DataReaderImpl::enable() { filter_property = &content_topic->filter_property; } - if (!subscriber_->rtps_participant()->registerReader(reader_, topic_attributes(), rqos, filter_property)) + if (!subscriber_->rtps_participant()->register_reader( + reader_, + topic_desc, + rqos, + filter_property)) { EPROSIMA_LOG_ERROR(DATA_READER, "Could not register reader on discovery protocols"); @@ -834,7 +845,7 @@ void DataReaderImpl::update_rtps_reader_qos() filter_property = &content_topic->filter_property; } ReaderQos rqos = qos_.get_readerqos(get_subscriber()->get_qos()); - subscriber_->rtps_participant()->updateReader(reader_, topic_attributes(), rqos, filter_property); + subscriber_->rtps_participant()->update_reader(reader_, rqos, filter_property); // TODO(eduponz): RTPSReader attributes must be updated here } } @@ -1771,59 +1782,6 @@ void DataReaderImpl::set_qos( } } -fastdds::TopicAttributes DataReaderImpl::topic_attributes() const -{ - fastdds::TopicAttributes topic_att; - topic_att.topicKind = type_->is_compute_key_provided ? WITH_KEY : NO_KEY; - topic_att.topicName = topic_->get_impl()->get_rtps_topic_name(); - topic_att.topicDataType = topic_->get_type_name(); - topic_att.historyQos = qos_.history(); - topic_att.resourceLimitsQos = qos_.resource_limits(); - - using utils::to_type_propagation; - using utils::TypePropagation; - - auto properties = subscriber_->get_participant()->get_qos().properties(); - auto type_propagation = to_type_propagation(properties); - bool should_assign_type_information = - (TypePropagation::TYPEPROPAGATION_ENABLED == type_propagation) || - (TypePropagation::TYPEPROPAGATION_MINIMAL_BANDWIDTH == type_propagation); - - if (should_assign_type_information && (xtypes::TK_NONE != type_->type_identifiers().type_identifier1()._d())) - { - xtypes::TypeInformation type_info; - - if (RETCODE_OK == - fastdds::rtps::RTPSDomainImpl::get_instance()->type_object_registry_observer().get_type_information( - type_->type_identifiers(), type_info)) - { - switch (type_propagation) - { - case TypePropagation::TYPEPROPAGATION_ENABLED: - { - // Use both complete and minimal type information - topic_att.type_information.type_information = type_info; - break; - } - case TypePropagation::TYPEPROPAGATION_MINIMAL_BANDWIDTH: - { - // Use minimal type information only - topic_att.type_information.type_information.minimal() = type_info.minimal(); - break; - } - default: - // This should never happen as other cases are protected by should_assign_type_information - assert(false); - break; - } - - topic_att.type_information.assigned(true); - } - } - - return topic_att; -} - DataReaderListener* DataReaderImpl::get_listener_for( const StatusMask& status) { @@ -2233,6 +2191,89 @@ void DataReaderImpl::try_notify_read_conditions() noexcept } } +ReturnCode_t DataReaderImpl::get_subscription_builtin_topic_data( + SubscriptionBuiltinTopicData& subscription_data) const +{ + if (nullptr == reader_) + { + return RETCODE_NOT_ENABLED; + } + + // sanity checks + assert(nullptr != subscriber_); + assert(nullptr != topic_); + assert(nullptr != subscriber_->get_participant()); + + subscription_data = SubscriptionBuiltinTopicData{}; + + from_proxy_to_builtin(guid_.entityId, subscription_data.key.value); + from_proxy_to_builtin(subscriber_->get_participant()->guid().guidPrefix, + subscription_data.participant_key.value); + + subscription_data.topic_name = topic_->get_impl()->get_rtps_topic_name(); + subscription_data.type_name = topic_->get_type_name(); + + // DataReader qos + subscription_data.durability = qos_.durability(); + subscription_data.deadline = qos_.deadline(); + subscription_data.latency_budget = qos_.latency_budget(); + subscription_data.lifespan = qos_.lifespan(); + subscription_data.liveliness = qos_.liveliness(); + subscription_data.reliability = qos_.reliability(); + subscription_data.ownership = qos_.ownership(); + subscription_data.destination_order = qos_.destination_order(); + subscription_data.user_data = qos_.user_data(); + subscription_data.time_based_filter = qos_.time_based_filter(); + + // Subscriber qos + subscription_data.presentation = subscriber_->qos_.presentation(); + subscription_data.partition = subscriber_->qos_.partition(); + subscription_data.group_data = subscriber_->qos_.group_data(); + + // X-Types 1.3 + if (subscriber_->get_participant_impl()->fill_type_information(type_, subscription_data.type_information)) + { + subscription_data.type_consistency = qos_.type_consistency(); + } + subscription_data.representation = qos_.representation(); + + // eProsima Extensions + + subscription_data.disable_positive_acks = qos_.reliable_reader_qos().disable_positive_acks; + subscription_data.data_sharing = qos_.data_sharing(); + + if (subscription_data.data_sharing.kind() != OFF && + subscription_data.data_sharing.domain_ids().empty()) + { + subscription_data.data_sharing.add_domain_id(utils::default_domain_id()); + } + + subscription_data.guid = guid(); + subscription_data.participant_guid = subscriber_->get_participant()->guid(); + qos_.endpoint().unicast_locator_list.copy_to(subscription_data.remote_locators.unicast); + qos_.endpoint().multicast_locator_list.copy_to(subscription_data.remote_locators.multicast); + subscription_data.expects_inline_qos = qos_.expects_inline_qos(); + + if (!is_data_sharing_compatible_) + { + subscription_data.data_sharing.off(); + } + const std::string* endpoint_partitions = PropertyPolicyHelper::find_property(qos_.properties(), "partitions"); + if (endpoint_partitions) + { + std::istringstream partition_string(*endpoint_partitions); + std::string partition_name; + subscription_data.partition.clear(); + + while (std::getline(partition_string, partition_name, ';')) + { + subscription_data.partition.push_back(partition_name.c_str()); + } + } + + return RETCODE_OK; +} + } // namespace dds } // namespace fastdds } // namespace eprosima diff --git a/src/cpp/fastdds/subscriber/DataReaderImpl.hpp b/src/cpp/fastdds/subscriber/DataReaderImpl.hpp index 66503d09cbf..9b5856c4058 100644 --- a/src/cpp/fastdds/subscriber/DataReaderImpl.hpp +++ b/src/cpp/fastdds/subscriber/DataReaderImpl.hpp @@ -17,9 +17,8 @@ * */ -#ifndef _FASTDDS_DATAREADERIMPL_HPP_ -#define _FASTDDS_DATAREADERIMPL_HPP_ -#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC +#ifndef FASTDDS_SUBSCRIBER__DATAREADERIMPL_HPP +#define FASTDDS_SUBSCRIBER__DATAREADERIMPL_HPP #include @@ -34,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -46,6 +44,7 @@ #include #include #include +#include #include namespace eprosima { @@ -375,6 +374,17 @@ class DataReaderImpl std::recursive_mutex& get_conditions_mutex() const noexcept; + /** + * Retrieve the subscription data discovery information. + * + * @param [out] subscription_data The subscription data discovery information. + * + * @return NOT_ENABLED if the reader has not been enabled. + * @return OK if the subscription data is returned. + */ + ReturnCode_t get_subscription_builtin_topic_data( + SubscriptionBuiltinTopicData& subscription_data) const; + protected: //!Subscriber @@ -600,8 +610,6 @@ class DataReaderImpl */ bool lifespan_expired(); - fastdds::TopicAttributes topic_attributes() const; - void subscriber_qos_updated(); RequestedIncompatibleQosStatus& update_requested_incompatible_qos( @@ -647,6 +655,7 @@ class DataReaderImpl DataReaderQos get_datareader_qos_from_settings( const DataReaderQos& qos); + bool is_data_sharing_compatible_ = false; }; @@ -654,5 +663,4 @@ class DataReaderImpl } /* namespace fastdds */ } /* namespace eprosima */ -#endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif /* _FASTDDS_DATAREADERIMPL_HPP_*/ +#endif /* FASTDDS_SUBSCRIBER__DATAREADERIMPL_HPP*/ diff --git a/src/cpp/fastdds/subscriber/SubscriberImpl.cpp b/src/cpp/fastdds/subscriber/SubscriberImpl.cpp index 03ecc74ebf0..077e0ca323c 100644 --- a/src/cpp/fastdds/subscriber/SubscriberImpl.cpp +++ b/src/cpp/fastdds/subscriber/SubscriberImpl.cpp @@ -564,7 +564,7 @@ bool SubscriberImpl::type_in_use( { for (DataReaderImpl* reader : it.second) { - if (reader->topic_attributes().getTopicDataType() == type_name) + if (reader->get_topicdescription()->get_type_name() == type_name) { return true; // Is in use } diff --git a/src/cpp/fastdds/utils/QosConverters.cpp b/src/cpp/fastdds/utils/QosConverters.cpp index 9b0afb104ae..3ec726ab75e 100644 --- a/src/cpp/fastdds/utils/QosConverters.cpp +++ b/src/cpp/fastdds/utils/QosConverters.cpp @@ -231,7 +231,7 @@ void set_attributes_from_extended_qos( void set_qos_from_attributes( TopicQos& qos, - const TopicAttributes& attr) + const xmlparser::TopicAttributes& attr) { qos.history() = attr.historyQos; qos.resource_limits() = attr.resourceLimitsQos; diff --git a/src/cpp/fastdds/utils/QosConverters.hpp b/src/cpp/fastdds/utils/QosConverters.hpp index ef728a53cc5..69a4df86cc7 100644 --- a/src/cpp/fastdds/utils/QosConverters.hpp +++ b/src/cpp/fastdds/utils/QosConverters.hpp @@ -28,13 +28,13 @@ #include #include #include -#include #include #include #include #include #include +#include namespace eprosima { namespace fastdds { @@ -125,7 +125,7 @@ void set_attributes_from_extended_qos( */ void set_qos_from_attributes( TopicQos& qos, - const TopicAttributes& attr); + const xmlparser::TopicAttributes& attr); /** * Obtains the SubscriberQos from the SubscriberAttributes provided. diff --git a/src/cpp/rtps/RTPSDomain.cpp b/src/cpp/rtps/RTPSDomain.cpp index 1be97cf6697..e9a789df432 100644 --- a/src/cpp/rtps/RTPSDomain.cpp +++ b/src/cpp/rtps/RTPSDomain.cpp @@ -820,25 +820,6 @@ bool RTPSDomainImpl::set_library_settings( return true; } -bool RTPSDomain::get_topic_attributes_from_profile( - const std::string& profile_name, - TopicAttributes& topic_attributes) -{ - return RTPSDomainImpl::get_topic_attributes_from_profile(profile_name, topic_attributes); -} - -bool RTPSDomainImpl::get_topic_attributes_from_profile( - const std::string& profile_name, - TopicAttributes& topic_attributes) -{ - if (xmlparser::XMLP_ret::XML_OK == - xmlparser::XMLProfileManager::fillTopicAttributes(profile_name, topic_attributes)) - { - return true; - } - return false; -} - fastdds::dds::xtypes::ITypeObjectRegistry& RTPSDomainImpl::type_object_registry() { return get_instance()->type_object_registry_; diff --git a/src/cpp/rtps/RTPSDomainImpl.hpp b/src/cpp/rtps/RTPSDomainImpl.hpp index 35e2d398d10..605d2ed1461 100644 --- a/src/cpp/rtps/RTPSDomainImpl.hpp +++ b/src/cpp/rtps/RTPSDomainImpl.hpp @@ -236,18 +236,6 @@ class RTPSDomainImpl static bool set_library_settings( const fastdds::LibrarySettings& library_settings); - /** - * @brief Get the TopicAttributes from XML profile. - * - * @param profile_name Topic profile name. - * @param topic_att TopicAttributes object where the attributes are returned. - * @return bool true if the profile exists. - * false otherwise. - */ - static bool get_topic_attributes_from_profile( - const std::string& profile_name, - TopicAttributes& topic_attributes); - /** * @brief Return the ITypeObjectRegistry member to access the interface for the public API. * diff --git a/src/cpp/rtps/builtin/BuiltinProtocols.cpp b/src/cpp/rtps/builtin/BuiltinProtocols.cpp index 9e36ab50266..dc6416da062 100644 --- a/src/cpp/rtps/builtin/BuiltinProtocols.cpp +++ b/src/cpp/rtps/builtin/BuiltinProtocols.cpp @@ -195,16 +195,16 @@ void BuiltinProtocols::filter_server_remote_locators( m_DiscoveryServers.swap(allowed_locators); } -bool BuiltinProtocols::addLocalWriter( - RTPSWriter* w, - const fastdds::TopicAttributes& topicAtt, - const fastdds::dds::WriterQos& wqos) +bool BuiltinProtocols::add_writer( + RTPSWriter* rtps_writer, + const TopicDescription& topic, + const fastdds::dds::WriterQos& qos) { bool ok = true; if (nullptr != mp_PDP) { - ok = mp_PDP->getEDP()->newLocalWriterProxyData(w, topicAtt, wqos); + ok = mp_PDP->get_edp()->new_writer_proxy_data(rtps_writer, topic, qos); if (!ok) { @@ -219,7 +219,7 @@ bool BuiltinProtocols::addLocalWriter( if (nullptr != mp_WLP) { - ok &= mp_WLP->add_local_writer(w, wqos); + ok &= mp_WLP->add_local_writer(rtps_writer, qos.m_liveliness); } else { @@ -229,17 +229,17 @@ bool BuiltinProtocols::addLocalWriter( return ok; } -bool BuiltinProtocols::addLocalReader( - RTPSReader* R, - const fastdds::TopicAttributes& topicAtt, - const fastdds::dds::ReaderQos& rqos, +bool BuiltinProtocols::add_reader( + RTPSReader* rtps_reader, + const TopicDescription& topic, + const fastdds::dds::ReaderQos& qos, const fastdds::rtps::ContentFilterProperty* content_filter) { bool ok = true; if (nullptr != mp_PDP) { - ok = mp_PDP->getEDP()->newLocalReaderProxyData(R, topicAtt, rqos, content_filter); + ok = mp_PDP->get_edp()->new_reader_proxy_data(rtps_reader, topic, qos, content_filter); if (!ok) { @@ -254,65 +254,63 @@ bool BuiltinProtocols::addLocalReader( if (nullptr != mp_WLP) { - ok &= mp_WLP->add_local_reader(R, rqos); + ok &= mp_WLP->add_local_reader(rtps_reader, qos.m_liveliness); } return ok; } -bool BuiltinProtocols::updateLocalWriter( - RTPSWriter* W, - const TopicAttributes& topicAtt, +bool BuiltinProtocols::update_writer( + RTPSWriter* rtps_writer, const fastdds::dds::WriterQos& wqos) { bool ok = false; - if ((nullptr != mp_PDP) && (nullptr != mp_PDP->getEDP())) + if ((nullptr != mp_PDP) && (nullptr != mp_PDP->get_edp())) { - ok = mp_PDP->getEDP()->updatedLocalWriter(W, topicAtt, wqos); + ok = mp_PDP->get_edp()->update_writer(rtps_writer, wqos); } return ok; } -bool BuiltinProtocols::updateLocalReader( - RTPSReader* R, - const TopicAttributes& topicAtt, +bool BuiltinProtocols::update_reader( + RTPSReader* rtps_reader, const fastdds::dds::ReaderQos& rqos, const fastdds::rtps::ContentFilterProperty* content_filter) { bool ok = false; - if ((nullptr != mp_PDP) && (nullptr != mp_PDP->getEDP())) + if ((nullptr != mp_PDP) && (nullptr != mp_PDP->get_edp())) { - ok = mp_PDP->getEDP()->updatedLocalReader(R, topicAtt, rqos, content_filter); + ok = mp_PDP->get_edp()->update_reader(rtps_reader, rqos, content_filter); } return ok; } -bool BuiltinProtocols::removeLocalWriter( - RTPSWriter* W) +bool BuiltinProtocols::remove_writer( + RTPSWriter* rtps_writer) { bool ok = false; if (nullptr != mp_WLP) { - ok |= mp_WLP->remove_local_writer(W); + ok |= mp_WLP->remove_local_writer(rtps_writer); } - if ((nullptr != mp_PDP) && (nullptr != mp_PDP->getEDP())) + if ((nullptr != mp_PDP) && (nullptr != mp_PDP->get_edp())) { - ok |= mp_PDP->getEDP()->removeLocalWriter(W); + ok |= mp_PDP->get_edp()->remove_writer(rtps_writer); } return ok; } -bool BuiltinProtocols::removeLocalReader( - RTPSReader* R) +bool BuiltinProtocols::remove_reader( + RTPSReader* rtps_reader) { bool ok = false; if (nullptr != mp_WLP) { - ok |= mp_WLP->remove_local_reader(R); + ok |= mp_WLP->remove_local_reader(rtps_reader); } - if ((nullptr != mp_PDP) && (nullptr != mp_PDP->getEDP())) + if ((nullptr != mp_PDP) && (nullptr != mp_PDP->get_edp())) { - ok |= mp_PDP->getEDP()->removeLocalReader(R); + ok |= mp_PDP->get_edp()->remove_reader(rtps_reader); } return ok; } diff --git a/src/cpp/rtps/builtin/BuiltinProtocols.h b/src/cpp/rtps/builtin/BuiltinProtocols.h index 07b79135977..d167a44a4e8 100644 --- a/src/cpp/rtps/builtin/BuiltinProtocols.h +++ b/src/cpp/rtps/builtin/BuiltinProtocols.h @@ -25,6 +25,7 @@ #include #include +#include #include @@ -53,6 +54,8 @@ class RTPSParticipantImpl; class RTPSWriter; class RTPSReader; class NetworkFactory; +struct PublicationBuiltinTopicData; +struct SubscriptionBuiltinTopicData; /** * Class BuiltinProtocols that contains builtin endpoints implementing the discovery and liveliness protocols. @@ -126,68 +129,67 @@ class BuiltinProtocols LocatorList_t m_DiscoveryServers; /** - * Add a local Writer to the BuiltinProtocols. - * @param w Pointer to the RTPSWriter - * @param topicAtt Attributes of the associated topic - * @param wqos QoS policies dictated by the publisher + * Add a local writer to the BuiltinProtocols. + * + * @param writer Pointer to the RTPSWriter + * @param topic Information regarding the topic where the writer is registering + * @param qos QoS policies dictated by the publisher + * * @return True if correct. */ - bool addLocalWriter( - RTPSWriter* w, - const TopicAttributes& topicAtt, - const fastdds::dds::WriterQos& wqos); + bool add_writer( + RTPSWriter* rtps_writer, + const TopicDescription& topic, + const fastdds::dds::WriterQos& qos); /** - * Add a local Reader to the BuiltinProtocols. - * @param R Pointer to the RTPSReader. - * @param topicAtt Attributes of the associated topic - * @param rqos QoS policies dictated by the subscriber + * Add a local reader to the BuiltinProtocols. + * + * @param rtps_reader Pointer to the RTPSReader. + * @param topic Information regarding the topic where the writer is registering + * @param qos QoS policies dictated by the subscriber * @param content_filter Optional content filtering information. * @return True if correct. */ - bool addLocalReader( - RTPSReader* R, - const TopicAttributes& topicAtt, - const fastdds::dds::ReaderQos& rqos, + bool add_reader( + RTPSReader* rtps_reader, + const TopicDescription& topic, + const fastdds::dds::ReaderQos& qos, const fastdds::rtps::ContentFilterProperty* content_filter = nullptr); /** * Update a local Writer QOS - * @param W Writer to update - * @param topicAtt Attributes of the associated topic - * @param wqos New Writer QoS + * @param rtps_writer Writer to update + * @param wqos New Writer QoS * @return */ - bool updateLocalWriter( - RTPSWriter* W, - const TopicAttributes& topicAtt, + bool update_writer( + RTPSWriter* rtps_writer, const fastdds::dds::WriterQos& wqos); /** * Update a local Reader QOS - * @param R Reader to update - * @param topicAtt Attributes of the associated topic - * @param qos New Reader QoS - * @param content_filter Optional content filtering information. + * @param rtps_reader Reader to update + * @param rqos New Reader QoS + * @param content_filter Optional content filtering information. * @return */ - bool updateLocalReader( - RTPSReader* R, - const TopicAttributes& topicAtt, - const fastdds::dds::ReaderQos& qos, + bool update_reader( + RTPSReader* rtps_reader, + const fastdds::dds::ReaderQos& rqos, const fastdds::rtps::ContentFilterProperty* content_filter = nullptr); /** * Remove a local Writer from the builtinProtocols. * @param W Pointer to the writer. * @return True if correctly removed. */ - bool removeLocalWriter( - RTPSWriter* W); + bool remove_writer( + RTPSWriter* rtps_writer); /** * Remove a local Reader from the builtinProtocols. * @param R Pointer to the reader. * @return True if correctly removed. */ - bool removeLocalReader( - RTPSReader* R); + bool remove_reader( + RTPSReader* rtps_reader); //! Announce RTPSParticipantState (force the sending of a DPD message.) void announceRTPSParticipantState(); diff --git a/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp b/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp index d5f2d5dc002..0c91e9c1cf5 100644 --- a/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp +++ b/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include #include @@ -32,14 +34,13 @@ #include #include #include +#include namespace eprosima { namespace fastdds { namespace rtps { -typedef uint32_t BuiltinTopicKeyValue[3]; - -static void from_proxy_to_builtin( +void from_proxy_to_builtin( const EntityId_t& entity_id, BuiltinTopicKeyValue& builtin_key_value) { @@ -51,7 +52,7 @@ static void from_proxy_to_builtin( | static_cast(entity_id.value[3]); } -static void from_proxy_to_builtin( +void from_proxy_to_builtin( const GuidPrefix_t& guid_prefix, BuiltinTopicKeyValue& dds_key) { @@ -69,7 +70,7 @@ static void from_proxy_to_builtin( | static_cast(guid_prefix.value[11]); } -static void from_builtin_to_proxy( +void from_builtin_to_proxy( const BuiltinTopicKeyValue& dds_key, EntityId_t& entity_id) { @@ -79,7 +80,7 @@ static void from_builtin_to_proxy( entity_id.value[3] = static_cast(dds_key[2] & 0xFF); } -static void from_builtin_to_proxy( +void from_builtin_to_proxy( const BuiltinTopicKeyValue& dds_key, GuidPrefix_t& guid_prefix) { @@ -204,78 +205,87 @@ void from_builtin_to_proxy( const PublicationBuiltinTopicData& builtin_data, WriterProxyData& proxy_data) { + fastdds::dds::WriterQos qos{}; + from_builtin_to_proxy(builtin_data.participant_key.value, proxy_data.guid().guidPrefix); from_builtin_to_proxy(builtin_data.key.value, proxy_data.guid().entityId); proxy_data.topicName(builtin_data.topic_name); proxy_data.typeName(builtin_data.type_name); - proxy_data.m_qos.m_durability = builtin_data.durability; - proxy_data.m_qos.m_durabilityService = builtin_data.durability_service; - proxy_data.m_qos.m_deadline = builtin_data.deadline; - proxy_data.m_qos.m_latencyBudget = builtin_data.latency_budget; - proxy_data.m_qos.m_liveliness = builtin_data.liveliness; - proxy_data.m_qos.m_reliability = builtin_data.reliability; - proxy_data.m_qos.m_lifespan = builtin_data.lifespan; - proxy_data.m_qos.m_userData = builtin_data.user_data; - proxy_data.m_qos.m_ownership = builtin_data.ownership; - proxy_data.m_qos.m_ownershipStrength = builtin_data.ownership_strength; - proxy_data.m_qos.m_destinationOrder = builtin_data.destination_order; - - proxy_data.m_qos.m_presentation = builtin_data.presentation; - proxy_data.m_qos.m_partition = builtin_data.partition; - proxy_data.m_qos.m_topicData = builtin_data.topic_data; - proxy_data.m_qos.m_groupData = builtin_data.group_data; + + qos.m_durability = builtin_data.durability; + qos.m_durabilityService = builtin_data.durability_service; + qos.m_deadline = builtin_data.deadline; + qos.m_latencyBudget = builtin_data.latency_budget; + qos.m_liveliness = builtin_data.liveliness; + qos.m_reliability = builtin_data.reliability; + qos.m_lifespan = builtin_data.lifespan; + qos.m_userData = builtin_data.user_data; + qos.m_ownership = builtin_data.ownership; + qos.m_ownershipStrength = builtin_data.ownership_strength; + qos.m_destinationOrder = builtin_data.destination_order; + + qos.m_presentation = builtin_data.presentation; + qos.m_partition = builtin_data.partition; + qos.m_topicData = builtin_data.topic_data; + qos.m_groupData = builtin_data.group_data; proxy_data.type_information(builtin_data.type_information); - proxy_data.m_qos.representation = builtin_data.representation; + qos.representation = builtin_data.representation; - proxy_data.m_qos.m_disablePositiveACKs = builtin_data.disable_positive_acks; - proxy_data.m_qos.data_sharing = builtin_data.data_sharing; + qos.m_disablePositiveACKs = builtin_data.disable_positive_acks; + qos.data_sharing = builtin_data.data_sharing; proxy_data.guid(builtin_data.guid); proxy_data.persistence_guid(builtin_data.persistence_guid); proxy_data.RTPSParticipantKey(builtin_data.participant_guid); proxy_data.set_locators(builtin_data.remote_locators); proxy_data.typeMaxSerialized(builtin_data.max_serialized_size); proxy_data.networkConfiguration(builtin_data.loopback_transformation); + + proxy_data.m_qos.setQos(qos, true); } void from_builtin_to_proxy( const SubscriptionBuiltinTopicData& builtin_data, ReaderProxyData& proxy_data) { + fastdds::dds::ReaderQos qos{}; + from_builtin_to_proxy(builtin_data.participant_key.value, proxy_data.guid().guidPrefix); from_builtin_to_proxy(builtin_data.key.value, proxy_data.guid().entityId); proxy_data.topicName(builtin_data.topic_name); proxy_data.typeName(builtin_data.type_name); - proxy_data.m_qos.m_durability = builtin_data.durability; - proxy_data.m_qos.m_deadline = builtin_data.deadline; - proxy_data.m_qos.m_latencyBudget = builtin_data.latency_budget; - proxy_data.m_qos.m_lifespan = builtin_data.lifespan; - proxy_data.m_qos.m_liveliness = builtin_data.liveliness; - proxy_data.m_qos.m_reliability = builtin_data.reliability; - proxy_data.m_qos.m_ownership = builtin_data.ownership; - proxy_data.m_qos.m_destinationOrder = builtin_data.destination_order; - proxy_data.m_qos.m_userData = builtin_data.user_data; - proxy_data.m_qos.m_timeBasedFilter = builtin_data.time_based_filter; - - proxy_data.m_qos.m_presentation = builtin_data.presentation; - proxy_data.m_qos.m_partition = builtin_data.partition; - proxy_data.m_qos.m_topicData = builtin_data.topic_data; - proxy_data.m_qos.m_groupData = builtin_data.group_data; + qos.m_durability = builtin_data.durability; + qos.m_deadline = builtin_data.deadline; + qos.m_latencyBudget = builtin_data.latency_budget; + qos.m_lifespan = builtin_data.lifespan; + qos.m_liveliness = builtin_data.liveliness; + qos.m_reliability = builtin_data.reliability; + qos.m_ownership = builtin_data.ownership; + qos.m_destinationOrder = builtin_data.destination_order; + qos.m_userData = builtin_data.user_data; + qos.m_timeBasedFilter = builtin_data.time_based_filter; + + qos.m_presentation = builtin_data.presentation; + qos.m_partition = builtin_data.partition; + qos.m_topicData = builtin_data.topic_data; + qos.m_groupData = builtin_data.group_data; proxy_data.type_information(builtin_data.type_information); - proxy_data.m_qos.representation = builtin_data.representation; - proxy_data.m_qos.type_consistency = builtin_data.type_consistency; + qos.representation = builtin_data.representation; + qos.type_consistency = builtin_data.type_consistency; proxy_data.content_filter(builtin_data.content_filter); - proxy_data.m_qos.m_disablePositiveACKs = builtin_data.disable_positive_acks; - proxy_data.m_qos.data_sharing = builtin_data.data_sharing; + qos.m_disablePositiveACKs = builtin_data.disable_positive_acks; + qos.data_sharing = builtin_data.data_sharing; proxy_data.guid(builtin_data.guid); proxy_data.RTPSParticipantKey(builtin_data.participant_guid); proxy_data.set_locators(builtin_data.remote_locators); proxy_data.networkConfiguration(builtin_data.loopback_transformation); proxy_data.m_expectsInlineQos = builtin_data.expects_inline_qos; + + proxy_data.m_qos.setQos(qos, true); } } // namespace rtps diff --git a/src/cpp/rtps/builtin/data/ReaderProxyData.hpp b/src/cpp/rtps/builtin/data/ReaderProxyData.hpp index 73d60d93d75..7712ef2ea61 100644 --- a/src/cpp/rtps/builtin/data/ReaderProxyData.hpp +++ b/src/cpp/rtps/builtin/data/ReaderProxyData.hpp @@ -28,7 +28,6 @@ #include #include #include -#include namespace eprosima { namespace fastdds { diff --git a/src/cpp/rtps/builtin/data/WriterProxyData.hpp b/src/cpp/rtps/builtin/data/WriterProxyData.hpp index e64273bf7ea..7eb674628a3 100644 --- a/src/cpp/rtps/builtin/data/WriterProxyData.hpp +++ b/src/cpp/rtps/builtin/data/WriterProxyData.hpp @@ -23,7 +23,6 @@ #include #include -#include #include #include #include diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp index 53e1da5ab9c..bfd74046dc3 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp @@ -27,7 +27,8 @@ #include #include -#include +#include +#include #include #include #include @@ -94,15 +95,17 @@ EDP::~EDP() // TODO Auto-generated destructor stub } -bool EDP::newLocalReaderProxyData( - RTPSReader* reader, - const TopicAttributes& att, - const fastdds::dds::ReaderQos& rqos, +bool EDP::new_reader_proxy_data( + RTPSReader* rtps_reader, + const TopicDescription& topic, + const fastdds::dds::ReaderQos& qos, const fastdds::rtps::ContentFilterProperty* content_filter) { - EPROSIMA_LOG_INFO(RTPS_EDP, "Adding " << reader->getGuid().entityId << " in topic " << att.topicName); + EPROSIMA_LOG_INFO(RTPS_EDP, + "Adding " << rtps_reader->getGuid().entityId << " in topic " << + topic.topic_name.to_string()); - auto init_fun = [this, reader, &att, &rqos, content_filter]( + auto init_fun = [this, rtps_reader, &topic, &qos, content_filter]( ReaderProxyData* rpd, bool updating, const ParticipantProxyData& participant_data) @@ -110,17 +113,17 @@ bool EDP::newLocalReaderProxyData( if (updating) { EPROSIMA_LOG_ERROR(RTPS_EDP, - "Adding already existent reader " << reader->getGuid().entityId << " in topic " - << att.topicName); + "Adding already existent reader " << rtps_reader->getGuid().entityId << " in topic " + << topic.topic_name.to_string()); return false; } const NetworkFactory& network = mp_RTPSParticipant->network_factory(); - const auto& ratt = reader->getAttributes(); + const auto& ratt = rtps_reader->getAttributes(); rpd->isAlive(true); - rpd->m_expectsInlineQos = reader->expects_inline_qos(); - rpd->guid(reader->getGuid()); + rpd->m_expectsInlineQos = rtps_reader->expects_inline_qos(); + rpd->guid(rtps_reader->getGuid()); rpd->key() = rpd->guid(); if (ratt.multicastLocatorList.empty() && ratt.unicastLocatorList.empty()) { @@ -134,9 +137,9 @@ bool EDP::newLocalReaderProxyData( ratt.external_unicast_locators); } rpd->RTPSParticipantKey() = mp_RTPSParticipant->getGuid(); - rpd->topicName(att.getTopicName()); - rpd->typeName(att.getTopicDataType()); - rpd->topicKind(att.getTopicKind()); + rpd->topicName(topic.topic_name); + rpd->typeName(topic.type_name); + rpd->topicKind((rpd->guid().entityId.value[3] & 0x0F) == 0x07 ? WITH_KEY : NO_KEY); using dds::utils::TypePropagation; using dds::xtypes::TypeInformationParameter; @@ -144,19 +147,20 @@ bool EDP::newLocalReaderProxyData( auto type_propagation = mp_RTPSParticipant->type_propagation(); assert(TypePropagation::TYPEPROPAGATION_UNKNOWN != type_propagation); - if (att.type_information.assigned()) + const auto& type_info = topic.type_information; + if (type_info.assigned()) { switch (type_propagation) { case TypePropagation::TYPEPROPAGATION_ENABLED: { - rpd->type_information(att.type_information); + rpd->type_information(type_info); break; } case TypePropagation::TYPEPROPAGATION_MINIMAL_BANDWIDTH: { TypeInformationParameter minimal; - minimal.type_information.minimal(att.type_information.type_information.minimal()); + minimal.type_information.minimal(type_info.type_information.minimal()); minimal.assigned(true); rpd->type_information(minimal); break; @@ -173,7 +177,7 @@ bool EDP::newLocalReaderProxyData( } } - rpd->m_qos.setQos(rqos, true); + rpd->m_qos.setQos(qos, true); rpd->userDefinedId(ratt.getUserDefinedID()); if (nullptr != content_filter) { @@ -209,7 +213,7 @@ bool EDP::newLocalReaderProxyData( //ADD IT TO THE LIST OF READERPROXYDATA GUID_t participant_guid; ReaderProxyData* reader_data = this->mp_PDP->addReaderProxyData( - reader->getGuid(), participant_guid, init_fun); + rtps_reader->getGuid(), participant_guid, init_fun); if (reader_data == nullptr) { return false; @@ -228,20 +232,22 @@ bool EDP::newLocalReaderProxyData( { pairing_reader_proxy_with_any_local_writer(participant_guid, reader_data); } - pairingReader(reader, participant_guid, *reader_data); + pairingReader(rtps_reader, participant_guid, *reader_data); //DO SOME PROCESSING DEPENDING ON THE IMPLEMENTATION (SIMPLE OR STATIC) - processLocalReaderProxyData(reader, reader_data); + process_reader_proxy_data(rtps_reader, reader_data); return true; } -bool EDP::newLocalWriterProxyData( - RTPSWriter* writer, - const TopicAttributes& att, - const fastdds::dds::WriterQos& wqos) +bool EDP::new_writer_proxy_data( + RTPSWriter* rtps_writer, + const TopicDescription& topic, + const fastdds::dds::WriterQos& qos) { - EPROSIMA_LOG_INFO(RTPS_EDP, "Adding " << writer->getGuid().entityId << " in topic " << att.topicName); + EPROSIMA_LOG_INFO(RTPS_EDP, + "Adding " << rtps_writer->getGuid().entityId << " in topic " << + topic.topic_name.to_string()); - auto init_fun = [this, writer, &att, &wqos]( + auto init_fun = [this, rtps_writer, &topic, &qos]( WriterProxyData* wpd, bool updating, const ParticipantProxyData& participant_data) @@ -249,15 +255,15 @@ bool EDP::newLocalWriterProxyData( if (updating) { EPROSIMA_LOG_ERROR(RTPS_EDP, - "Adding already existent writer " << writer->getGuid().entityId << " in topic " - << att.topicName); + "Adding already existent writer " << rtps_writer->getGuid().entityId << " in topic " + << topic.topic_name.to_string()); return false; } const NetworkFactory& network = mp_RTPSParticipant->network_factory(); - const auto& watt = writer->getAttributes(); + const auto& watt = rtps_writer->getAttributes(); - wpd->guid(writer->getGuid()); + wpd->guid(rtps_writer->getGuid()); wpd->key() = wpd->guid(); if (watt.multicastLocatorList.empty() && watt.unicastLocatorList.empty()) { @@ -271,9 +277,9 @@ bool EDP::newLocalWriterProxyData( watt.external_unicast_locators); } wpd->RTPSParticipantKey() = mp_RTPSParticipant->getGuid(); - wpd->topicName(att.getTopicName()); - wpd->typeName(att.getTopicDataType()); - wpd->topicKind(att.getTopicKind()); + wpd->topicName(topic.topic_name); + wpd->typeName(topic.type_name); + wpd->topicKind((wpd->guid().entityId.value[3] & 0x0F) == 0x02 ? WITH_KEY : NO_KEY); using dds::utils::TypePropagation; using dds::xtypes::TypeInformationParameter; @@ -281,19 +287,20 @@ bool EDP::newLocalWriterProxyData( auto type_propagation = mp_RTPSParticipant->type_propagation(); assert(TypePropagation::TYPEPROPAGATION_UNKNOWN != type_propagation); - if (att.type_information.assigned()) + const auto& type_info = topic.type_information; + if (type_info.assigned()) { switch (type_propagation) { case TypePropagation::TYPEPROPAGATION_ENABLED: { - wpd->type_information(att.type_information); + wpd->type_information(type_info); break; } case TypePropagation::TYPEPROPAGATION_MINIMAL_BANDWIDTH: { TypeInformationParameter minimal; - minimal.type_information.minimal(att.type_information.type_information.minimal()); + minimal.type_information.minimal(type_info.type_information.minimal()); minimal.assigned(true); wpd->type_information(minimal); break; @@ -310,10 +317,10 @@ bool EDP::newLocalWriterProxyData( } } - BaseWriter* base_writer = BaseWriter::downcast(writer); + BaseWriter* base_writer = BaseWriter::downcast(rtps_writer); assert(base_writer->get_history() != nullptr); wpd->typeMaxSerialized(base_writer->get_history()->getTypeMaxSerialized()); - wpd->m_qos.setQos(wqos, true); + wpd->m_qos.setQos(qos, true); wpd->userDefinedId(watt.getUserDefinedID()); wpd->persistence_guid(watt.persistence_guid); #if HAVE_SECURITY @@ -334,7 +341,7 @@ bool EDP::newLocalWriterProxyData( //ADD IT TO THE LIST OF READERPROXYDATA GUID_t participant_guid; - WriterProxyData* writer_data = this->mp_PDP->addWriterProxyData(writer->getGuid(), participant_guid, init_fun); + WriterProxyData* writer_data = this->mp_PDP->addWriterProxyData(rtps_writer->getGuid(), participant_guid, init_fun); if (writer_data == nullptr) { return false; @@ -353,19 +360,18 @@ bool EDP::newLocalWriterProxyData( { pairing_writer_proxy_with_any_local_reader(participant_guid, writer_data); } - pairingWriter(writer, participant_guid, *writer_data); + pairingWriter(rtps_writer, participant_guid, *writer_data); //DO SOME PROCESSING DEPENDING ON THE IMPLEMENTATION (SIMPLE OR STATIC) - processLocalWriterProxyData(writer, writer_data); + process_writer_proxy_data(rtps_writer, writer_data); return true; } -bool EDP::updatedLocalReader( - RTPSReader* reader, - const TopicAttributes&, +bool EDP::update_reader( + RTPSReader* rtps_reader, const fastdds::dds::ReaderQos& rqos, const fastdds::rtps::ContentFilterProperty* content_filter) { - auto init_fun = [this, reader, &rqos, content_filter]( + auto init_fun = [this, rtps_reader, &rqos, content_filter]( ReaderProxyData* rdata, bool updating, const ParticipantProxyData& participant_data) @@ -375,15 +381,15 @@ bool EDP::updatedLocalReader( assert(updating); const NetworkFactory& network = mp_RTPSParticipant->network_factory(); - if (reader->getAttributes().multicastLocatorList.empty() && - reader->getAttributes().unicastLocatorList.empty()) + if (rtps_reader->getAttributes().multicastLocatorList.empty() && + rtps_reader->getAttributes().unicastLocatorList.empty()) { rdata->set_locators(participant_data.default_locators); } else { - rdata->set_multicast_locators(reader->getAttributes().multicastLocatorList, network); - rdata->set_announced_unicast_locators(reader->getAttributes().unicastLocatorList); + rdata->set_multicast_locators(rtps_reader->getAttributes().multicastLocatorList, network); + rdata->set_announced_unicast_locators(rtps_reader->getAttributes().unicastLocatorList); } rdata->m_qos.setQos(rqos, false); if (nullptr != content_filter) @@ -406,16 +412,16 @@ bool EDP::updatedLocalReader( rdata->content_filter().filter_expression = ""; } rdata->isAlive(true); - rdata->m_expectsInlineQos = reader->expects_inline_qos(); + rdata->m_expectsInlineQos = rtps_reader->expects_inline_qos(); return true; }; GUID_t participant_guid; - ReaderProxyData* reader_data = this->mp_PDP->addReaderProxyData(reader->getGuid(), participant_guid, init_fun); + ReaderProxyData* reader_data = this->mp_PDP->addReaderProxyData(rtps_reader->getGuid(), participant_guid, init_fun); if (reader_data != nullptr) { - processLocalReaderProxyData(reader, reader_data); + process_reader_proxy_data(rtps_reader, reader_data); #ifdef FASTDDS_STATISTICS // notify monitor service about the new local entity proxy update if (nullptr != this->mp_PDP->get_proxy_observer()) @@ -427,15 +433,14 @@ bool EDP::updatedLocalReader( { pairing_reader_proxy_with_any_local_writer(participant_guid, reader_data); } - pairingReader(reader, participant_guid, *reader_data); + pairingReader(rtps_reader, participant_guid, *reader_data); return true; } return false; } -bool EDP::updatedLocalWriter( +bool EDP::update_writer( RTPSWriter* writer, - const TopicAttributes&, const fastdds::dds::WriterQos& wqos) { auto init_fun = [this, writer, &wqos]( @@ -467,7 +472,7 @@ bool EDP::updatedLocalWriter( WriterProxyData* writer_data = this->mp_PDP->addWriterProxyData(writer->getGuid(), participant_guid, init_fun); if (writer_data != nullptr) { - processLocalWriterProxyData(writer, writer_data); + process_writer_proxy_data(writer, writer_data); #ifdef FASTDDS_STATISTICS // notify monitor service about the new local entity proxy update diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDP.h b/src/cpp/rtps/builtin/discovery/endpoint/EDP.h index 10bd9435f3f..df585a607f9 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDP.h +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDP.h @@ -17,9 +17,8 @@ * */ -#ifndef FASTDDS_RTPS_BUILTIN_DISCOVERY_ENDPOINT_EDP_H -#define FASTDDS_RTPS_BUILTIN_DISCOVERY_ENDPOINT_EDP_H -#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC +#ifndef FASTDDS_RTPS_BUILTIN_DISCOVERY_ENDPOINT__EDP_H +#define FASTDDS_RTPS_BUILTIN_DISCOVERY_ENDPOINT__EDP_H #include #include @@ -44,7 +43,6 @@ class TypeIdentifier; } // namespace xtypes } // namespace dds -class TopicAttributes; namespace rtps { @@ -54,6 +52,7 @@ class RTPSWriter; class RTPSReader; class WriterProxyData; class RTPSParticipantImpl; +struct TopicDescription; /** * Class EDP, base class for Endpoint Discovery Protocols. It contains generic methods used by the two EDP implemented (EDPSimple and EDPStatic), as well as abstract methods @@ -131,18 +130,18 @@ class EDP /** * Abstract method that removes a local Reader from the discovery method - * @param R Pointer to the Reader to remove. + * @param rtps_reader Pointer to the Reader to remove. * @return True if correctly removed. */ - virtual bool removeLocalReader( - RTPSReader* R) = 0; + virtual bool remove_reader( + RTPSReader* rtps_reader) = 0; /** * Abstract method that removes a local Writer from the discovery method - * @param W Pointer to the Writer to remove. + * @param rtps_writer Pointer to the Writer to remove. * @return True if correctly removed. */ - virtual bool removeLocalWriter( - RTPSWriter* W) = 0; + virtual bool remove_writer( + RTPSWriter* rtps_writer) = 0; /** * After a new local ReaderProxyData has been created some processing is needed (depends on the implementation). @@ -150,7 +149,7 @@ class EDP * @param rdata Pointer to the ReaderProxyData object. * @return True if correct. */ - virtual bool processLocalReaderProxyData( + virtual bool process_reader_proxy_data( RTPSReader* reader, ReaderProxyData* rdata) = 0; @@ -160,57 +159,57 @@ class EDP * @param wdata Pointer to the Writer ProxyData object. * @return True if correct. */ - virtual bool processLocalWriterProxyData( + virtual bool process_writer_proxy_data( RTPSWriter* writer, WriterProxyData* wdata) = 0; /** * Create a new ReaderPD for a local Reader. - * @param R Pointer to the RTPSReader. - * @param att Attributes of the associated topic - * @param qos QoS policies dictated by the subscriber + * + * @param rtps_reader Pointer to the RTPSReader. + * @param topic Information regarding the topic where the writer is registering. + * @param qos QoS policies dictated by the subscriber. * @param content_filter Optional content filtering information. + * * @return True if correct. */ - bool newLocalReaderProxyData( - RTPSReader* R, - const TopicAttributes& att, + bool new_reader_proxy_data( + RTPSReader* rtps_reader, + const TopicDescription& topic, const fastdds::dds::ReaderQos& qos, const fastdds::rtps::ContentFilterProperty* content_filter = nullptr); /** - * Create a new ReaderPD for a local Writer. - * @param W Pointer to the RTPSWriter. - * @param att Attributes of the associated topic - * @param qos QoS policies dictated by the publisher + * Create a new WriterPD for a local Writer. + * + * @param rtps_writer Pointer to the RTPSWriter. + * @param topic Information regarding the topic where the writer is registering. + * @param qos QoS policies dictated by the publisher. + * * @return True if correct. */ - bool newLocalWriterProxyData( - RTPSWriter* W, - const TopicAttributes& att, + bool new_writer_proxy_data( + RTPSWriter* rtps_writer, + const TopicDescription& topic, const fastdds::dds::WriterQos& qos); /** * A previously created Reader has been updated - * @param R Pointer to the reader - * @param att Attributes of the associated topic - * @param qos QoS policies dictated by the subscriber - * @param content_filter Optional content filtering information. + * @param rtps_reader Pointer to the RTPSReader. + * @param qos QoS policies dictated by the subscriber. + * @param content_filter Optional content filtering information. * @return True if correctly updated */ - bool updatedLocalReader( - RTPSReader* R, - const TopicAttributes& att, + bool update_reader( + RTPSReader* rtps_reader, const fastdds::dds::ReaderQos& qos, const fastdds::rtps::ContentFilterProperty* content_filter = nullptr); /** * A previously created Writer has been updated - * @param W Pointer to the Writer - * @param att Attributes of the associated topic - * @param qos QoS policies dictated by the publisher + * @param rtps_writer Pointer to the RTPSWriter. + * @param qos QoS policies dictated by the publisher. * @return True if correctly updated */ - bool updatedLocalWriter( - RTPSWriter* W, - const TopicAttributes& att, + bool update_writer( + RTPSWriter* rtps_writer, const fastdds::dds::WriterQos& qos); /** @@ -392,5 +391,4 @@ class EDP } // namespace fastdds } // namespace eprosima -#endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // FASTDDS_RTPS_BUILTIN_DISCOVERY_ENDPOINT_EDP_H +#endif // FASTDDS_RTPS_BUILTIN_DISCOVERY_ENDPOINT__EDP_H diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.cpp index 7a8e39ba2eb..097d3fef1d3 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.cpp @@ -38,7 +38,7 @@ namespace eprosima { namespace fastdds { namespace rtps { -bool EDPClient::processLocalReaderProxyData( +bool EDPClient::process_reader_proxy_data( RTPSReader* local_reader, ReaderProxyData* rdata) { @@ -71,17 +71,17 @@ bool EDPClient::processLocalReaderProxyData( return ret_val; } -bool EDPClient::processLocalWriterProxyData( - RTPSWriter* local_writer, +bool EDPClient::process_writer_proxy_data( + RTPSWriter* rtps_writer, WriterProxyData* wdata) { EPROSIMA_LOG_INFO(RTPS_EDP, wdata->guid().entityId); - (void)local_writer; + (void)rtps_writer; auto* writer = &publications_writer_; #if HAVE_SECURITY - if (local_writer->getAttributes().security_attributes().is_discovery_protected) + if (rtps_writer->getAttributes().security_attributes().is_discovery_protected) { writer = &publications_secure_writer_; } @@ -104,15 +104,15 @@ bool EDPClient::processLocalWriterProxyData( return ret_val; } -bool EDPClient::removeLocalWriter( - RTPSWriter* W) +bool EDPClient::remove_writer( + RTPSWriter* rtps_writer) { - EPROSIMA_LOG_INFO(RTPS_EDP, W->getGuid().entityId); + EPROSIMA_LOG_INFO(RTPS_EDP, rtps_writer->getGuid().entityId); auto* writer = &publications_writer_; #if HAVE_SECURITY - if (W->getAttributes().security_attributes().is_discovery_protected) + if (rtps_writer->getAttributes().security_attributes().is_discovery_protected) { writer = &publications_secure_writer_; } @@ -121,7 +121,7 @@ bool EDPClient::removeLocalWriter( if (writer->first != nullptr) { InstanceHandle_t iH; - iH = W->getGuid(); + iH = rtps_writer->getGuid(); CacheChange_t* change = EDPUtils::create_change(*writer, NOT_ALIVE_DISPOSED_UNREGISTERED, iH, mp_PDP->builtin_attributes().writerPayloadSize); if (change != nullptr) @@ -150,18 +150,18 @@ bool EDPClient::removeLocalWriter( writer->second->add_change(change, wp); } } - return mp_PDP->removeWriterProxyData(W->getGuid()); + return mp_PDP->removeWriterProxyData(rtps_writer->getGuid()); } -bool EDPClient::removeLocalReader( - RTPSReader* R) +bool EDPClient::remove_reader( + RTPSReader* rtps_reader) { - EPROSIMA_LOG_INFO(RTPS_EDP, R->getGuid().entityId); + EPROSIMA_LOG_INFO(RTPS_EDP, rtps_reader->getGuid().entityId); auto* writer = &subscriptions_writer_; #if HAVE_SECURITY - if (R->getAttributes().security_attributes().is_discovery_protected) + if (rtps_reader->getAttributes().security_attributes().is_discovery_protected) { writer = &subscriptions_secure_writer_; } @@ -170,7 +170,7 @@ bool EDPClient::removeLocalReader( if (writer->first != nullptr) { InstanceHandle_t iH; - iH = (R->getGuid()); + iH = (rtps_reader->getGuid()); CacheChange_t* change = EDPUtils::create_change(*writer, NOT_ALIVE_DISPOSED_UNREGISTERED, iH, mp_PDP->builtin_attributes().writerPayloadSize); if (change != nullptr) @@ -198,7 +198,7 @@ bool EDPClient::removeLocalReader( writer->second->add_change(change, wp); } } - return mp_PDP->removeReaderProxyData(R->getGuid()); + return mp_PDP->removeReaderProxyData(rtps_reader->getGuid()); } } /* namespace rtps */ diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.h b/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.h index e0c92ea8cf1..7b37f236f82 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.h +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPClient.h @@ -49,36 +49,36 @@ class EDPClient : public EDPSimple /** * This method generates the corresponding change in the subscription writer and send it to all known remote endpoints. - * @param reader Pointer to the Reader object. + * @param rtps_reader Pointer to the Reader object. * @param rdata Pointer to the ReaderProxyData object. * @return true if correct. */ - bool processLocalReaderProxyData( - RTPSReader* reader, + bool process_reader_proxy_data( + RTPSReader* rtps_reader, ReaderProxyData* rdata) override; /** * This method generates the corresponding change in the publciations writer and send it to all known remote endpoints. - * @param writer Pointer to the Writer object. + * @param rtps_writer Pointer to the Writer object. * @param wdata Pointer to the WriterProxyData object. * @return true if correct. */ - bool processLocalWriterProxyData( - RTPSWriter* writer, + bool process_writer_proxy_data( + RTPSWriter* rtps_writer, WriterProxyData* wdata) override; /** * This methods generates the change disposing of the local Reader and calls the unpairing and removal methods of the base class. - * @param R Pointer to the RTPSReader object. + * @param rtps_reader Pointer to the RTPSReader object. * @return True if correct. */ - bool removeLocalReader( - RTPSReader* R) override; + bool remove_reader( + RTPSReader* rtps_reader) override; /** * This methods generates the change disposing of the local Writer and calls the unpairing and removal methods of the base class. - * @param W Pointer to the RTPSWriter object. + * @param rtps_writer Pointer to the RTPSWriter object. * @return True if correct. */ - bool removeLocalWriter( - RTPSWriter* W) override; + bool remove_writer( + RTPSWriter* rtps_writer) override; }; diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPServer.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPServer.cpp index a347b7e857a..dc423a3bec3 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPServer.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPServer.cpp @@ -214,14 +214,14 @@ bool EDPServer::createSEDPEndpoints() return created; } -bool EDPServer::removeLocalReader( - RTPSReader* R) +bool EDPServer::remove_reader( + RTPSReader* rtps_reader) { - EPROSIMA_LOG_INFO(RTPS_EDP, "Removing local reader: " << R->getGuid().entityId); + EPROSIMA_LOG_INFO(RTPS_EDP, "Removing local reader: " << rtps_reader->getGuid().entityId); // Get subscriptions writer and reader guid auto* writer = &subscriptions_writer_; - GUID_t guid = R->getGuid(); + GUID_t guid = rtps_reader->getGuid(); // Recover reader information std::string topic_name; @@ -269,14 +269,14 @@ bool EDPServer::removeLocalReader( return false; } -bool EDPServer::removeLocalWriter( - RTPSWriter* W) +bool EDPServer::remove_writer( + RTPSWriter* rtps_writer) { - EPROSIMA_LOG_INFO(RTPS_EDP, "Removing local writer: " << W->getGuid().entityId); + EPROSIMA_LOG_INFO(RTPS_EDP, "Removing local writer: " << rtps_writer->getGuid().entityId); // Get publications writer and writer guid auto* writer = &publications_writer_; - GUID_t guid = W->getGuid(); + GUID_t guid = rtps_writer->getGuid(); // Recover writer information std::string topic_name; @@ -325,7 +325,7 @@ bool EDPServer::removeLocalWriter( return false; } -bool EDPServer::processLocalWriterProxyData( +bool EDPServer::process_writer_proxy_data( RTPSWriter* local_writer, WriterProxyData* wdata) { @@ -375,7 +375,7 @@ bool EDPServer::processLocalWriterProxyData( return false; } -bool EDPServer::processLocalReaderProxyData( +bool EDPServer::process_reader_proxy_data( RTPSReader* local_reader, ReaderProxyData* rdata) { diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPServer.hpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPServer.hpp index a06e6c1497d..a1d36293934 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPServer.hpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPServer.hpp @@ -78,7 +78,7 @@ class EDPServer : public EDPSimple * @param rdata Pointer to the ReaderProxyData object. * @return true if correct. */ - bool processLocalReaderProxyData( + bool process_reader_proxy_data( RTPSReader* reader, ReaderProxyData* rdata) override; /** @@ -87,7 +87,7 @@ class EDPServer : public EDPSimple * @param wdata Pointer to the WriterProxyData object. * @return true if correct. */ - bool processLocalWriterProxyData( + bool process_writer_proxy_data( RTPSWriter* writer, WriterProxyData* wdata) override; /** @@ -95,14 +95,14 @@ class EDPServer : public EDPSimple * @param R Pointer to the RTPSReader object. * @return True if correct. */ - bool removeLocalReader( + bool remove_reader( RTPSReader* R) override; /** * This methods generates the change disposing of the local Writer and calls the unpairing and removal methods of the base class. * @param W Pointer to the RTPSWriter object. * @return True if correct. */ - bool removeLocalWriter( + bool remove_writer( RTPSWriter* W) override; /** diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp index bc2a8e6e581..861b47a0d76 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp @@ -521,17 +521,17 @@ bool EDPSimple::create_sedp_secure_endpoints() #endif // if HAVE_SECURITY -bool EDPSimple::processLocalReaderProxyData( - RTPSReader* local_reader, +bool EDPSimple::process_reader_proxy_data( + RTPSReader* rtps_reader, ReaderProxyData* rdata) { EPROSIMA_LOG_INFO(RTPS_EDP, rdata->guid().entityId); - (void)local_reader; + (void)rtps_reader; auto* writer = &subscriptions_writer_; #if HAVE_SECURITY - if (local_reader->getAttributes().security_attributes().is_discovery_protected) + if (rtps_reader->getAttributes().security_attributes().is_discovery_protected) { writer = &subscriptions_secure_writer_; } @@ -545,17 +545,17 @@ bool EDPSimple::processLocalReaderProxyData( return ret_val; } -bool EDPSimple::processLocalWriterProxyData( - RTPSWriter* local_writer, +bool EDPSimple::process_writer_proxy_data( + RTPSWriter* rtps_writer, WriterProxyData* wdata) { EPROSIMA_LOG_INFO(RTPS_EDP, wdata->guid().entityId); - (void)local_writer; + (void)rtps_writer; auto* writer = &publications_writer_; #if HAVE_SECURITY - if (local_writer->getAttributes().security_attributes().is_discovery_protected) + if (rtps_writer->getAttributes().security_attributes().is_discovery_protected) { writer = &publications_secure_writer_; } @@ -637,15 +637,15 @@ bool EDPSimple::serialize_proxy_data( return true; } -bool EDPSimple::removeLocalWriter( - RTPSWriter* W) +bool EDPSimple::remove_writer( + RTPSWriter* rtps_writer) { - EPROSIMA_LOG_INFO(RTPS_EDP, W->getGuid().entityId); + EPROSIMA_LOG_INFO(RTPS_EDP, rtps_writer->getGuid().entityId); auto* writer = &publications_writer_; #if HAVE_SECURITY - if (W->getAttributes().security_attributes().is_discovery_protected) + if (rtps_writer->getAttributes().security_attributes().is_discovery_protected) { writer = &publications_secure_writer_; } @@ -654,7 +654,7 @@ bool EDPSimple::removeLocalWriter( if (writer->first != nullptr) { InstanceHandle_t iH; - iH = W->getGuid(); + iH = rtps_writer->getGuid(); CacheChange_t* change = EDPUtils::create_change(*writer, NOT_ALIVE_DISPOSED_UNREGISTERED, iH, mp_PDP->builtin_attributes().writerPayloadSize); if (change != nullptr) @@ -680,22 +680,22 @@ bool EDPSimple::removeLocalWriter( // notify monitor service about the new local entity proxy update if (nullptr != this->mp_PDP->get_proxy_observer()) { - this->mp_PDP->get_proxy_observer()->on_local_entity_change(W->getGuid(), false); + this->mp_PDP->get_proxy_observer()->on_local_entity_change(rtps_writer->getGuid(), false); } #endif //FASTDDS_STATISTICS - return mp_PDP->removeWriterProxyData(W->getGuid()); + return mp_PDP->removeWriterProxyData(rtps_writer->getGuid()); } -bool EDPSimple::removeLocalReader( - RTPSReader* R) +bool EDPSimple::remove_reader( + RTPSReader* rtps_reader) { - EPROSIMA_LOG_INFO(RTPS_EDP, R->getGuid().entityId); + EPROSIMA_LOG_INFO(RTPS_EDP, rtps_reader->getGuid().entityId); auto* writer = &subscriptions_writer_; #if HAVE_SECURITY - if (R->getAttributes().security_attributes().is_discovery_protected) + if (rtps_reader->getAttributes().security_attributes().is_discovery_protected) { writer = &subscriptions_secure_writer_; } @@ -704,7 +704,7 @@ bool EDPSimple::removeLocalReader( if (writer->first != nullptr) { InstanceHandle_t iH; - iH = (R->getGuid()); + iH = (rtps_reader->getGuid()); CacheChange_t* change = EDPUtils::create_change(*writer, NOT_ALIVE_DISPOSED_UNREGISTERED, iH, mp_PDP->builtin_attributes().writerPayloadSize); if (change != nullptr) @@ -729,11 +729,11 @@ bool EDPSimple::removeLocalReader( // notify monitor service about the new local entity proxy update if (nullptr != this->mp_PDP->get_proxy_observer()) { - this->mp_PDP->get_proxy_observer()->on_local_entity_change(R->getGuid(), false); + this->mp_PDP->get_proxy_observer()->on_local_entity_change(rtps_reader->getGuid(), false); } #endif //FASTDDS_STATISTICS - return mp_PDP->removeReaderProxyData(R->getGuid()); + return mp_PDP->removeReaderProxyData(rtps_reader->getGuid()); } void EDPSimple::assignRemoteEndpoints( diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.h b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.h index 480259bbc86..feff00d9d4f 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.h +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.h @@ -17,9 +17,8 @@ * */ -#ifndef _FASTDDS_RTPS_EDPSIMPLE_H_ -#define _FASTDDS_RTPS_EDPSIMPLE_H_ -#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC +#ifndef FASTDDS_RTPS_BUILTIN_DISCOVERY_ENDPOINT__EDPSIMPLE_H +#define FASTDDS_RTPS_BUILTIN_DISCOVERY_ENDPOINT__EDPSIMPLE_H #include #include @@ -123,36 +122,36 @@ class EDPSimple : public EDP /** * This method generates the corresponding change in the subscription writer and send it to all known remote endpoints. - * @param reader Pointer to the Reader object. - * @param rdata Pointer to the ReaderProxyData object. + * @param rtps_reader Pointer to the Reader object. + * @param rdata Pointer to the ReaderProxyData object. * @return true if correct. */ - bool processLocalReaderProxyData( - RTPSReader* reader, + bool process_reader_proxy_data( + RTPSReader* rtps_reader, ReaderProxyData* rdata) override; /** * This method generates the corresponding change in the publciations writer and send it to all known remote endpoints. - * @param writer Pointer to the Writer object. - * @param wdata Pointer to the WriterProxyData object. + * @param rtps_writer Pointer to the Writer object. + * @param wdata Pointer to the WriterProxyData object. * @return true if correct. */ - bool processLocalWriterProxyData( - RTPSWriter* writer, + bool process_writer_proxy_data( + RTPSWriter* rtps_writer, WriterProxyData* wdata) override; /** * This methods generates the change disposing of the local Reader and calls the unpairing and removal methods of the base class. - * @param R Pointer to the RTPSReader object. + * @param rtps_reader Pointer to the RTPSReader object. * @return True if correct. */ - bool removeLocalReader( - RTPSReader* R) override; + bool remove_reader( + RTPSReader* rtps_reader) override; /** * This methods generates the change disposing of the local Writer and calls the unpairing and removal methods of the base class. - * @param W Pointer to the RTPSWriter object. + * @param rtps_writer Pointer to the RTPSWriter object. * @return True if correct. */ - bool removeLocalWriter( - RTPSWriter* W) override; + bool remove_writer( + RTPSWriter* rtps_writer) override; protected: @@ -287,5 +286,4 @@ class EDPSimple : public EDP } /* namespace fastdds */ } /* namespace eprosima */ -#endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif /* _FASTDDS_RTPS_EDPSIMPLE_H_ */ +#endif /* FASTDDS_RTPS_BUILTIN_DISCOVERY_ENDPOINT__EDPSIMPLE_H */ diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp index c54219c60b7..39b23506f6f 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp @@ -322,7 +322,7 @@ bool EDPStaticProperty::fromProperty( return false; } -bool EDPStatic::processLocalReaderProxyData( +bool EDPStatic::process_reader_proxy_data( RTPSReader*, ReaderProxyData* rdata) { @@ -337,7 +337,7 @@ bool EDPStatic::processLocalReaderProxyData( return true; } -bool EDPStatic::processLocalWriterProxyData( +bool EDPStatic::process_writer_proxy_data( RTPSWriter*, WriterProxyData* wdata) { @@ -352,8 +352,8 @@ bool EDPStatic::processLocalWriterProxyData( return true; } -bool EDPStatic::removeLocalReader( - RTPSReader* R) +bool EDPStatic::remove_reader( + RTPSReader* rtps_reader) { std::lock_guard guard(*mp_PDP->getMutex()); ParticipantProxyData* localpdata = this->mp_PDP->getLocalParticipantProxyData(); @@ -363,10 +363,10 @@ bool EDPStatic::removeLocalReader( EDPStaticProperty staticproperty; if (staticproperty.fromProperty((*pit).pair())) { - if (staticproperty.m_entityId == R->getGuid().entityId) + if (staticproperty.m_entityId == rtps_reader->getGuid().entityId) { auto new_property = EDPStaticProperty::toProperty(exchange_format_, "Reader", "ENDED", - R->getAttributes().getUserDefinedID(), R->getGuid().entityId); + rtps_reader->getAttributes().getUserDefinedID(), rtps_reader->getGuid().entityId); if (!pit->modify(new_property)) { EPROSIMA_LOG_ERROR(RTPS_EDP, "Failed to change property <" @@ -379,8 +379,8 @@ bool EDPStatic::removeLocalReader( return false; } -bool EDPStatic::removeLocalWriter( - RTPSWriter* W) +bool EDPStatic::remove_writer( + RTPSWriter* rtps_writer) { std::lock_guard guard(*mp_PDP->getMutex()); ParticipantProxyData* localpdata = this->mp_PDP->getLocalParticipantProxyData(); @@ -390,10 +390,10 @@ bool EDPStatic::removeLocalWriter( EDPStaticProperty staticproperty; if (staticproperty.fromProperty((*pit).pair())) { - if (staticproperty.m_entityId == W->getGuid().entityId) + if (staticproperty.m_entityId == rtps_writer->getGuid().entityId) { auto new_property = EDPStaticProperty::toProperty(exchange_format_, "Writer", "ENDED", - W->getAttributes().getUserDefinedID(), W->getGuid().entityId); + rtps_writer->getAttributes().getUserDefinedID(), rtps_writer->getGuid().entityId); if (!pit->modify(new_property)) { EPROSIMA_LOG_ERROR(RTPS_EDP, "Failed to change property <" diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.h b/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.h index 164bf241bf1..72e3e7cff32 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.h +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.h @@ -17,9 +17,8 @@ * */ -#ifndef _FASTDDS_RTPS_EDPSTATIC_H_ -#define _FASTDDS_RTPS_EDPSTATIC_H_ -#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC +#ifndef FASTDDS_RTPS_BUILTIN_DISCOVERY_ENDPOINT__EDPSTATIC_H +#define FASTDDS_RTPS_BUILTIN_DISCOVERY_ENDPOINT__EDPSTATIC_H #include @@ -72,37 +71,37 @@ class EDPStatic : public EDP const ParticipantProxyData& pdata, bool assign_secure_endpoints) override; /** - * Abstract method that removes a local Reader from the discovery method - * @param R Pointer to the Reader to remove. + * Abstract method that removes a local reader from the discovery method + * @param rtps_reader Pointer to the Reader to remove. * @return True if correctly removed. */ - bool removeLocalReader( - RTPSReader* R) override; + bool remove_reader( + RTPSReader* rtps_reader) override; /** * Abstract method that removes a local Writer from the discovery method - * @param W Pointer to the Writer to remove. + * @param rtps_writer Pointer to the writer to remove. * @return True if correctly removed. */ - bool removeLocalWriter( - RTPSWriter* W) override; + bool remove_writer( + RTPSWriter* rtps_writer) override; /** * After a new local ReaderProxyData has been created some processing is needed (depends on the implementation). - * @param reader Pointer to the RTPSReader object. - * @param rdata Pointer to the ReaderProxyData object. + * @param rtps_reader Pointer to the RTPSReader object. + * @param rdata Pointer to the ReaderProxyData object. * @return True if correct. */ - bool processLocalReaderProxyData( - RTPSReader* reader, + bool process_reader_proxy_data( + RTPSReader* rtps_reader, ReaderProxyData* rdata) override; /** * After a new local WriterProxyData has been created some processing is needed (depends on the implementation). - * @param writer Pointer to the RTPSWriter object. - * @param wdata Pointer to the Writer ProxyData object. + * @param rtps_writer Pointer to the RTPSWriter object. + * @param wdata Pointer to the Writer ProxyData object. * @return True if correct. */ - bool processLocalWriterProxyData( - RTPSWriter* writer, + bool process_writer_proxy_data( + RTPSWriter* rtps_writer, WriterProxyData* wdata) override; /** @@ -162,5 +161,4 @@ class EDPStatic : public EDP } /* namespace rtps */ } /* namespace eprosima */ -#endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif /* _FASTDDS_RTPS_EDPSTATIC_H_ */ +#endif /* FASTDDS_RTPS_BUILTIN_DISCOVERY_ENDPOINT__EDPSTATIC_H */ diff --git a/src/cpp/rtps/builtin/discovery/participant/PDP.h b/src/cpp/rtps/builtin/discovery/participant/PDP.h index a74d5bb45de..884da0daef9 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDP.h +++ b/src/cpp/rtps/builtin/discovery/participant/PDP.h @@ -342,7 +342,7 @@ class PDP : public fastdds::statistics::rtps::IProxyQueryable * Get a pointer to the EDP object. * @return pointer to the EDP object. */ - inline EDP* getEDP() + inline EDP* get_edp() { return mp_EDP; } diff --git a/src/cpp/rtps/builtin/discovery/participant/timedevent/DSClientEvent.cpp b/src/cpp/rtps/builtin/discovery/participant/timedevent/DSClientEvent.cpp index 58104b39b01..1c32d2b7402 100644 --- a/src/cpp/rtps/builtin/discovery/participant/timedevent/DSClientEvent.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/timedevent/DSClientEvent.cpp @@ -43,7 +43,7 @@ DSClientEvent::DSClientEvent( return event(); }, interval) , mp_PDP(p_PDP) - , mp_EDP(static_cast(mp_PDP->getEDP())) + , mp_EDP(static_cast(mp_PDP->get_edp())) { } diff --git a/src/cpp/rtps/builtin/liveliness/WLP.cpp b/src/cpp/rtps/builtin/liveliness/WLP.cpp index d283943d496..a5ce70a149c 100644 --- a/src/cpp/rtps/builtin/liveliness/WLP.cpp +++ b/src/cpp/rtps/builtin/liveliness/WLP.cpp @@ -618,7 +618,7 @@ void WLP::removeRemoteEndpoints( bool WLP::add_local_writer( RTPSWriter* writer, - const fastdds::dds::WriterQos& wqos) + const fastdds::dds::LivelinessQosPolicy& qos) { std::lock_guard guard(*mp_builtinProtocols->mp_PDP->getMutex()); @@ -626,10 +626,9 @@ bool WLP::add_local_writer( BaseWriter* base_writer = BaseWriter::downcast(writer); - double wAnnouncementPeriodMilliSec(fastdds::rtps::TimeConv::Duration_t2MilliSecondsDouble(wqos.m_liveliness. - announcement_period)); + double wAnnouncementPeriodMilliSec(TimeConv::Duration_t2MilliSecondsDouble(qos.announcement_period)); - if (wqos.m_liveliness.kind == dds::AUTOMATIC_LIVELINESS_QOS ) + if (qos.kind == dds::AUTOMATIC_LIVELINESS_QOS ) { if (automatic_liveliness_assertion_ == nullptr) { @@ -656,7 +655,7 @@ bool WLP::add_local_writer( } automatic_writers_.push_back(base_writer); } - else if (wqos.m_liveliness.kind == dds::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) + else if (qos.kind == dds::MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) { if (manual_liveliness_assertion_ == nullptr) { @@ -685,21 +684,21 @@ bool WLP::add_local_writer( if (!pub_liveliness_manager_->add_writer( writer->getGuid(), - wqos.m_liveliness.kind, - wqos.m_liveliness.lease_duration)) + qos.kind, + qos.lease_duration)) { EPROSIMA_LOG_ERROR(RTPS_LIVELINESS, "Could not add writer " << writer->getGuid() << " to liveliness manager"); } } - else if (wqos.m_liveliness.kind == dds::MANUAL_BY_TOPIC_LIVELINESS_QOS) + else if (qos.kind == dds::MANUAL_BY_TOPIC_LIVELINESS_QOS) { manual_by_topic_writers_.push_back(base_writer); if (!pub_liveliness_manager_->add_writer( writer->getGuid(), - wqos.m_liveliness.kind, - wqos.m_liveliness.lease_duration)) + qos.kind, + qos.lease_duration)) { EPROSIMA_LOG_ERROR(RTPS_LIVELINESS, "Could not add writer " << writer->getGuid() << " to liveliness manager"); @@ -832,13 +831,13 @@ bool WLP::remove_local_writer( bool WLP::add_local_reader( RTPSReader* reader, - const fastdds::dds::ReaderQos& rqos) + const fastdds::dds::LivelinessQosPolicy& qos) { auto base_reader = BaseReader::downcast(reader); std::lock_guard guard(*mp_builtinProtocols->mp_PDP->getMutex()); - if (rqos.m_liveliness.kind == dds::AUTOMATIC_LIVELINESS_QOS) + if (qos.kind == dds::AUTOMATIC_LIVELINESS_QOS) { automatic_readers_ = true; } diff --git a/src/cpp/rtps/builtin/liveliness/WLP.hpp b/src/cpp/rtps/builtin/liveliness/WLP.hpp index 9849ff8b60e..22c6c3dce1c 100644 --- a/src/cpp/rtps/builtin/liveliness/WLP.hpp +++ b/src/cpp/rtps/builtin/liveliness/WLP.hpp @@ -109,12 +109,12 @@ class WLP /** * Add a local writer to the liveliness protocol. * @param writer Pointer to the RTPSWriter. - * @param wqos Quality of service policies for the writer. + * @param qos Quality of service policies for the writer. * @return True if correct. */ bool add_local_writer( RTPSWriter* writer, - const fastdds::dds::WriterQos& wqos); + const fastdds::dds::LivelinessQosPolicy& qos); /** * Remove a local writer from the liveliness protocol. * @param writer Pointer to the RTPSWriter. @@ -125,13 +125,13 @@ class WLP /** * @brief Adds a local reader to the liveliness protocol - * @param reader Pointer to the RTPS reader - * @param rqos Quality of service policies for the reader + * @param reader Pointer to the RTPS reader + * @param qos Quality of service policies for the reader * @return True if added successfully */ bool add_local_reader( RTPSReader* reader, - const fastdds::dds::ReaderQos& rqos); + const fastdds::dds::LivelinessQosPolicy& qos); /** * @brief Removes a local reader from the livliness protocol diff --git a/src/cpp/rtps/participant/RTPSParticipant.cpp b/src/cpp/rtps/participant/RTPSParticipant.cpp index 6dbed268b2f..362f70f42da 100644 --- a/src/cpp/rtps/participant/RTPSParticipant.cpp +++ b/src/cpp/rtps/participant/RTPSParticipant.cpp @@ -75,21 +75,21 @@ uint32_t RTPSParticipant::getRTPSParticipantID() const return mp_impl->getRTPSParticipantID(); } -bool RTPSParticipant::registerWriter( - RTPSWriter* Writer, - const TopicAttributes& topicAtt, - const fastdds::dds::WriterQos& wqos) +bool RTPSParticipant::register_writer( + RTPSWriter* writer, + const TopicDescription& topic, + const fastdds::dds::WriterQos& qos) { - return mp_impl->registerWriter(Writer, topicAtt, wqos); + return mp_impl->register_writer(writer, topic, qos); } -bool RTPSParticipant::registerReader( - RTPSReader* Reader, - const TopicAttributes& topicAtt, - const fastdds::dds::ReaderQos& rqos, +bool RTPSParticipant::register_reader( + RTPSReader* reader, + const TopicDescription& topic, + const fastdds::dds::ReaderQos& qos, const ContentFilterProperty* content_filter) { - return mp_impl->registerReader(Reader, topicAtt, rqos, content_filter); + return mp_impl->register_reader(reader, topic, qos, content_filter); } void RTPSParticipant::update_attributes( @@ -98,21 +98,19 @@ void RTPSParticipant::update_attributes( mp_impl->update_attributes(patt); } -bool RTPSParticipant::updateWriter( - RTPSWriter* Writer, - const TopicAttributes& topicAtt, +bool RTPSParticipant::update_writer( + RTPSWriter* writer, const fastdds::dds::WriterQos& wqos) { - return mp_impl->updateLocalWriter(Writer, topicAtt, wqos); + return mp_impl->update_writer(writer, wqos); } -bool RTPSParticipant::updateReader( - RTPSReader* Reader, - const TopicAttributes& topicAtt, +bool RTPSParticipant::update_reader( + RTPSReader* reader, const fastdds::dds::ReaderQos& rqos, const ContentFilterProperty* content_filter) { - return mp_impl->updateLocalReader(Reader, topicAtt, rqos, content_filter); + return mp_impl->update_reader(reader, rqos, content_filter); } std::vector RTPSParticipant::getParticipantNames() const diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index 829f6108cfd..5191ff89379 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -1404,21 +1404,21 @@ void RTPSParticipantImpl::disableReader( m_receiverResourcelistMutex.unlock(); } -bool RTPSParticipantImpl::registerWriter( - RTPSWriter* Writer, - const TopicAttributes& topicAtt, - const fastdds::dds::WriterQos& wqos) +bool RTPSParticipantImpl::register_writer( + RTPSWriter* rtps_writer, + const TopicDescription& topic, + const fastdds::dds::WriterQos& qos) { - return this->mp_builtinProtocols->addLocalWriter(Writer, topicAtt, wqos); + return this->mp_builtinProtocols->add_writer(rtps_writer, topic, qos); } -bool RTPSParticipantImpl::registerReader( - RTPSReader* reader, - const TopicAttributes& topicAtt, - const fastdds::dds::ReaderQos& rqos, +bool RTPSParticipantImpl::register_reader( + RTPSReader* rtps_reader, + const TopicDescription& topic, + const fastdds::dds::ReaderQos& qos, const ContentFilterProperty* content_filter) { - return this->mp_builtinProtocols->addLocalReader(reader, topicAtt, rqos, content_filter); + return this->mp_builtinProtocols->add_reader(rtps_reader, topic, qos, content_filter); } void RTPSParticipantImpl::update_attributes( @@ -1606,21 +1606,19 @@ void RTPSParticipantImpl::update_attributes( } } -bool RTPSParticipantImpl::updateLocalWriter( - RTPSWriter* Writer, - const TopicAttributes& topicAtt, +bool RTPSParticipantImpl::update_writer( + RTPSWriter* rtps_writer, const fastdds::dds::WriterQos& wqos) { - return this->mp_builtinProtocols->updateLocalWriter(Writer, topicAtt, wqos); + return this->mp_builtinProtocols->update_writer(rtps_writer, wqos); } -bool RTPSParticipantImpl::updateLocalReader( - RTPSReader* reader, - const TopicAttributes& topicAtt, +bool RTPSParticipantImpl::update_reader( + RTPSReader* rtps_reader, const fastdds::dds::ReaderQos& rqos, const ContentFilterProperty* content_filter) { - return this->mp_builtinProtocols->updateLocalReader(reader, topicAtt, rqos, content_filter); + return this->mp_builtinProtocols->update_reader(rtps_reader, rqos, content_filter); } /* @@ -2000,7 +1998,7 @@ bool RTPSParticipantImpl::deleteUserEndpoint( { if (found_in_users) { - mp_builtinProtocols->removeLocalWriter(static_cast(p_endpoint)); + mp_builtinProtocols->remove_writer(static_cast(p_endpoint)); } #if HAVE_SECURITY @@ -2015,7 +2013,7 @@ bool RTPSParticipantImpl::deleteUserEndpoint( { if (found_in_users) { - mp_builtinProtocols->removeLocalReader(static_cast(p_endpoint)); + mp_builtinProtocols->remove_reader(static_cast(p_endpoint)); } #if HAVE_SECURITY @@ -2090,8 +2088,8 @@ void RTPSParticipantImpl::deleteAllUserEndpoints() auto removeEndpoint = [this](EndpointKind_t kind, Endpoint* p) { return kind == WRITER - ? mp_builtinProtocols->removeLocalWriter((RTPSWriter*)p) - : mp_builtinProtocols->removeLocalReader((RTPSReader*)p); + ? mp_builtinProtocols->remove_writer((RTPSWriter*)p) + : mp_builtinProtocols->remove_reader((RTPSReader*)p); }; #if HAVE_SECURITY @@ -2880,10 +2878,10 @@ const fastdds::statistics::rtps::IStatusObserver* RTPSParticipantImpl::create_mo return this->createWriter(WriterOut, param, hist, listen, entityId, isBuiltin); }, [&](RTPSWriter* w, - const fastdds::TopicAttributes& topicAtt, - const fastdds::dds::WriterQos& wqos) -> bool + const TopicDescription& topic, + const fastdds::dds::WriterQos& qos) -> bool { - return this->registerWriter(w, topicAtt, wqos); + return this->register_writer(w, topic, qos); }, getEventResource() )); diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.h b/src/cpp/rtps/participant/RTPSParticipantImpl.h index 8d8760ead76..d125141d786 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.h +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.h @@ -108,12 +108,12 @@ class TypeLookupManager; namespace fastdds { -class TopicAttributes; class MessageReceiver; namespace rtps { struct PublicationBuiltinTopicData; +struct TopicDescription; class RTPSParticipant; class RTPSParticipantListener; class BuiltinProtocols; @@ -896,60 +896,60 @@ class RTPSParticipantImpl /** * Register a Writer in the BuiltinProtocols. - * @param Writer Pointer to the RTPSWriter. - * @param topicAtt TopicAttributes of the Writer. - * @param wqos WriterQos. + * + * @param Writer Pointer to the RTPSWriter. + * @param topic Information regarding the topic where the writer is registering. + * @param qos Qos policies of the writer. + * * @return True if correctly registered. */ - bool registerWriter( + bool register_writer( RTPSWriter* Writer, - const TopicAttributes& topicAtt, - const fastdds::dds::WriterQos& wqos); + const TopicDescription& topic, + const fastdds::dds::WriterQos& qos); /** * Register a Reader in the BuiltinProtocols. + * * @param Reader Pointer to the RTPSReader. - * @param topicAtt TopicAttributes of the Reader. - * @param rqos ReaderQos. + * @param topic Information regarding the topic where the reader is registering. + * @param qos Qos policies of the reader. * @param content_filter Optional content filtering information. + * * @return True if correctly registered. */ - bool registerReader( + bool register_reader( RTPSReader* Reader, - const TopicAttributes& topicAtt, - const fastdds::dds::ReaderQos& rqos, + const TopicDescription& topic, + const fastdds::dds::ReaderQos& qos, const ContentFilterProperty* content_filter = nullptr); /** * Update participant attributes. * @param patt New participant attributes. - * @return True on success, false otherwise. */ void update_attributes( const RTPSParticipantAttributes& patt); /** * Update local writer QoS - * @param Writer Writer to update - * @param wqos New QoS for the writer + * @param rtps_writer Writer to update. + * @param wqos New QoS for the writer. * @return True on success */ - bool updateLocalWriter( - RTPSWriter* Writer, - const TopicAttributes& topicAtt, + bool update_writer( + RTPSWriter* rtps_writer, const fastdds::dds::WriterQos& wqos); /** * Update local reader QoS - * @param Reader Reader to update - * @param topicAtt TopicAttributes of the Reader. - * @param rqos New QoS for the reader - * @param content_filter Optional content filtering information. + * @param rtps_reader Reader to update. + * @param rqos New QoS for the reader. + * @param content_filter Optional content filtering information. * @return True on success */ - bool updateLocalReader( - RTPSReader* Reader, - const TopicAttributes& topicAtt, + bool update_reader( + RTPSReader* rtps_reader, const fastdds::dds::ReaderQos& rqos, const ContentFilterProperty* content_filter = nullptr); diff --git a/src/cpp/rtps/security/SecurityManager.cpp b/src/cpp/rtps/security/SecurityManager.cpp index 2474799cdf9..ca68fce8bfc 100644 --- a/src/cpp/rtps/security/SecurityManager.cpp +++ b/src/cpp/rtps/security/SecurityManager.cpp @@ -4069,13 +4069,13 @@ bool SecurityManager::participant_authorized( for (auto& remote_reader : temp_readers) { - participant_->pdp()->getEDP()->pairing_reader_proxy_with_local_writer(remote_reader.second, + participant_->pdp()->get_edp()->pairing_reader_proxy_with_local_writer(remote_reader.second, participant_data.m_guid, remote_reader.first); } for (auto& remote_writer : temp_writers) { - participant_->pdp()->getEDP()->pairing_writer_proxy_with_local_reader(remote_writer.second, + participant_->pdp()->get_edp()->pairing_writer_proxy_with_local_reader(remote_writer.second, participant_data.m_guid, remote_writer.first); } diff --git a/src/cpp/statistics/rtps/monitor-service/MonitorService.cpp b/src/cpp/statistics/rtps/monitor-service/MonitorService.cpp index 8412a6f74da..96fa9d0ba9a 100644 --- a/src/cpp/statistics/rtps/monitor-service/MonitorService.cpp +++ b/src/cpp/statistics/rtps/monitor-service/MonitorService.cpp @@ -18,6 +18,8 @@ #include +#include + #include #include @@ -445,13 +447,15 @@ bool MonitorService::create_endpoint() hatt.initialReservedCaches = 25; hatt.maximumReservedCaches = 0; - TopicAttributes tatt; - tatt.historyQos.kind = dds::KEEP_LAST_HISTORY_QOS; - tatt.historyQos.depth = 1; - tatt.topicKind = WITH_KEY; - tatt.topicName = MONITOR_SERVICE_TOPIC; - tatt.resourceLimitsQos.max_instances = 0; - tatt.resourceLimitsQos.max_samples_per_instance = 1; + dds::HistoryQosPolicy hqos; + hqos.kind = dds::KEEP_LAST_HISTORY_QOS; + hqos.depth = 1; + + TopicKind_t topic_kind = WITH_KEY; + + dds::ResourceLimitsQosPolicy rl_qos; + rl_qos.max_instances = 0; + rl_qos.max_samples_per_instance = 1; PoolConfig writer_pool_cfg = PoolConfig::from_history_attributes(hatt); status_writer_payload_pool_ = TopicPayloadPoolRegistry::get(MONITOR_SERVICE_TOPIC, writer_pool_cfg); @@ -460,7 +464,7 @@ bool MonitorService::create_endpoint() status_writer_history_.reset(new eprosima::fastdds::dds::DataWriterHistory( status_writer_payload_pool_, std::make_shared(writer_pool_cfg), - tatt, type_.max_serialized_type_size, + hqos, rl_qos, topic_kind, type_.max_serialized_type_size, MemoryManagementPolicy_t::PREALLOCATED_WITH_REALLOC_MEMORY_MODE, []( const InstanceHandle_t& ) -> void @@ -486,12 +490,11 @@ bool MonitorService::create_endpoint() wqos.m_reliability.kind = dds::RELIABLE_RELIABILITY_QOS; wqos.m_durability.kind = dds::TRANSIENT_LOCAL_DURABILITY_QOS; - TopicAttributes tatts; - tatts.topicName = MONITOR_SERVICE_TOPIC; - tatts.topicDataType = type_.get_name(); - tatts.topicKind = WITH_KEY; + TopicDescription topic_desc; + topic_desc.topic_name = MONITOR_SERVICE_TOPIC; + topic_desc.type_name = type_.get_name(); - endpoint_registrator_(status_writer_, tatts, wqos); + endpoint_registrator_(status_writer_, topic_desc, wqos); } else { diff --git a/src/cpp/statistics/rtps/monitor-service/MonitorService.hpp b/src/cpp/statistics/rtps/monitor-service/MonitorService.hpp index 88546865d96..5e94517f876 100644 --- a/src/cpp/statistics/rtps/monitor-service/MonitorService.hpp +++ b/src/cpp/statistics/rtps/monitor-service/MonitorService.hpp @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -81,8 +82,8 @@ class MonitorService using endpoint_registrator_t = std::function; + const eprosima::fastdds::rtps::TopicDescription&, + const eprosima::fastdds::dds::WriterQos&)>; MonitorService( const fastdds::rtps::GUID_t& guid, diff --git a/src/cpp/utils/BuiltinTopicKeyConversions.hpp b/src/cpp/utils/BuiltinTopicKeyConversions.hpp new file mode 100644 index 00000000000..9560c41789b --- /dev/null +++ b/src/cpp/utils/BuiltinTopicKeyConversions.hpp @@ -0,0 +1,47 @@ +// 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 BuiltinTopicKeyConversions.hpp + */ + +#include +#include +#include + +namespace eprosima { +namespace fastdds { +namespace rtps { + +typedef uint32_t BuiltinTopicKeyValue[3]; + +void from_proxy_to_builtin( + const EntityId_t& entity_id, + BuiltinTopicKeyValue& builtin_key_value); + +void from_proxy_to_builtin( + const GuidPrefix_t& guid_prefix, + BuiltinTopicKeyValue& dds_key); + +void from_builtin_to_proxy( + const BuiltinTopicKeyValue& dds_key, + EntityId_t& entity_id); + +void from_builtin_to_proxy( + const BuiltinTopicKeyValue& dds_key, + GuidPrefix_t& guid_prefix); + +} // namespace rtps +} // namespace fastdds +} // namespace eprosima diff --git a/src/cpp/xmlparser/XMLProfileManager.h b/src/cpp/xmlparser/XMLProfileManager.h index d2c45462fda..7534690994d 100644 --- a/src/cpp/xmlparser/XMLProfileManager.h +++ b/src/cpp/xmlparser/XMLProfileManager.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include diff --git a/src/cpp/xmlparser/attributes/PublisherAttributes.hpp b/src/cpp/xmlparser/attributes/PublisherAttributes.hpp index a4d68d5917b..b8b3c42124d 100644 --- a/src/cpp/xmlparser/attributes/PublisherAttributes.hpp +++ b/src/cpp/xmlparser/attributes/PublisherAttributes.hpp @@ -24,11 +24,12 @@ #include #include #include -#include #include #include #include +#include + namespace eprosima { namespace fastdds { namespace xmlparser { @@ -61,7 +62,7 @@ class PublisherAttributes } //! Topic Attributes for the Publisher - fastdds::TopicAttributes topic; + fastdds::xmlparser::TopicAttributes topic; //! QOS for the Publisher dds::WriterQos qos; diff --git a/src/cpp/xmlparser/attributes/SubscriberAttributes.hpp b/src/cpp/xmlparser/attributes/SubscriberAttributes.hpp index 51466642040..b9adb04cfb6 100644 --- a/src/cpp/xmlparser/attributes/SubscriberAttributes.hpp +++ b/src/cpp/xmlparser/attributes/SubscriberAttributes.hpp @@ -24,10 +24,11 @@ #include #include #include -#include #include #include +#include + namespace eprosima { namespace fastdds { namespace xmlparser { @@ -41,7 +42,7 @@ class SubscriberAttributes public: //! Topic Attributes - fastdds::TopicAttributes topic; + fastdds::xmlparser::TopicAttributes topic; //! Reader QOs. dds::ReaderQos qos; diff --git a/src/cpp/rtps/attributes/TopicAttributes.cpp b/src/cpp/xmlparser/attributes/TopicAttributes.cpp similarity index 96% rename from src/cpp/rtps/attributes/TopicAttributes.cpp rename to src/cpp/xmlparser/attributes/TopicAttributes.cpp index 8652e5e6c2c..deb1886134d 100644 --- a/src/cpp/rtps/attributes/TopicAttributes.cpp +++ b/src/cpp/xmlparser/attributes/TopicAttributes.cpp @@ -16,11 +16,13 @@ * @file TopicAttributes.cpp */ -#include #include +#include + namespace eprosima { namespace fastdds { +namespace xmlparser { bool TopicAttributes::checkQos() const { @@ -72,5 +74,6 @@ bool TopicAttributes::checkQos() const return true; } +} // namespave xmlparser } // namespace fastdds } // namespace eprosima diff --git a/include/fastdds/rtps/attributes/TopicAttributes.hpp b/src/cpp/xmlparser/attributes/TopicAttributes.hpp similarity index 90% rename from include/fastdds/rtps/attributes/TopicAttributes.hpp rename to src/cpp/xmlparser/attributes/TopicAttributes.hpp index 53d2c66522d..cf9052b8827 100644 --- a/include/fastdds/rtps/attributes/TopicAttributes.hpp +++ b/src/cpp/xmlparser/attributes/TopicAttributes.hpp @@ -16,8 +16,8 @@ * @file TopicAttributes.hpp */ -#ifndef FASTDDS_RTPS_ATTRIBUTES__TOPICATTRIBUTES_HPP -#define FASTDDS_RTPS_ATTRIBUTES__TOPICATTRIBUTES_HPP +#ifndef FASTDDS_XMLPARSER_ATTRIBUTES__TOPICATTRIBUTES_HPP +#define FASTDDS_XMLPARSER_ATTRIBUTES__TOPICATTRIBUTES_HPP #include @@ -26,9 +26,10 @@ namespace eprosima { namespace fastdds { +namespace xmlparser { /** - * Class TopicAttributes, used by the user to define the attributes of the topic associated with a Publisher or Subscriber. + * Class TopicAttributes, used to define the attributes of the topic associated with a Publisher or Subscriber. * @ingroup FASTDDS_ATTRIBUTES_MODULE */ class TopicAttributes @@ -120,8 +121,6 @@ class TopicAttributes bool checkQos() const; }; -#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - /** * Check if two topic attributes are not equal * @param t1 First instance of TopicAttributes to compare @@ -143,9 +142,8 @@ bool inline operator !=( return false; } -#endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - +} // namespace xmlparser } // namespace fastdds } // namespace eprosima -#endif // FASTDDS_RTPS_ATTRIBUTES__TOPICATTRIBUTES_HPP +#endif // FASTDDS_XMLPARSER_ATTRIBUTES__TOPICATTRIBUTES_HPP diff --git a/test/blackbox/common/RTPSBlackboxTestsBasic.cpp b/test/blackbox/common/RTPSBlackboxTestsBasic.cpp index 8d82942c0c7..91c0afe060b 100644 --- a/test/blackbox/common/RTPSBlackboxTestsBasic.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsBasic.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -807,7 +808,6 @@ TEST(RTPS, MultithreadedWriterCreation) /* Create writer history */ eprosima::fastdds::rtps::HistoryAttributes hattr; eprosima::fastdds::rtps::WriterHistory* history = new eprosima::fastdds::rtps::WriterHistory(hattr); - eprosima::fastdds::TopicAttributes topic_attr; /* Create writer with a flow controller */ eprosima::fastdds::rtps::WriterAttributes writer_attr; @@ -816,9 +816,12 @@ TEST(RTPS, MultithreadedWriterCreation) eprosima::fastdds::rtps::RTPSWriter* writer = eprosima::fastdds::rtps::RTPSDomain::createRTPSWriter( rtps_participant, writer_attr, history, nullptr); + TopicDescription topic_desc; + topic_desc.type_name = "string"; + topic_desc.topic_name = "test_topic"; /* Register writer in participant */ eprosima::fastdds::dds::WriterQos writer_qos; - ASSERT_EQ(rtps_participant->registerWriter(writer, topic_attr, writer_qos), true); + ASSERT_EQ(rtps_participant->register_writer(writer, topic_desc, writer_qos), true); { /* Wait for test completion request */ diff --git a/test/blackbox/common/RTPSBlackboxTestsDiscovery.cpp b/test/blackbox/common/RTPSBlackboxTestsDiscovery.cpp index ce1a78550a7..f9f5d56545b 100644 --- a/test/blackbox/common/RTPSBlackboxTestsDiscovery.cpp +++ b/test/blackbox/common/RTPSBlackboxTestsDiscovery.cpp @@ -433,7 +433,7 @@ TEST_P(RTPSDiscovery, WriterListenerOnReaderDiscoveryIncompatibleQoS) } /*! - * \test RTPS-CFT-RRR-01 Tests a good `ContentFilterProperty` passed to `registerReader()` and `updateReader()` is + * \test RTPS-CFT-RRR-01 Tests a good `ContentFilterProperty` passed to `register_reader()` and `update_reader()` is * propagated successfully through discovery. */ TEST_P(RTPSDiscovery, ContentFilterRegistration) @@ -528,7 +528,7 @@ TEST_P(RTPSDiscovery, ContentFilterRegistration) } /*! - * \test RTPS-CFT-RRR-02 Tests a wrong `ContentFilterProperty` passed to `registerReader()` makes the function fail. + * \test RTPS-CFT-RRR-02 Tests a wrong `ContentFilterProperty` passed to `register_reader()` makes the function fail. */ TEST_P(RTPSDiscovery, ContentFilterWrongRegistration) { @@ -630,7 +630,7 @@ TEST_P(RTPSDiscovery, ContentFilterWrongRegistration) } /*! - * \test RTPS-CFT-RRR-03 Tests a wrong `ContentFilterProperty` passed to `updateReader()` makes the function fail. + * \test RTPS-CFT-RRR-03 Tests a wrong `ContentFilterProperty` passed to `update_reader()` makes the function fail. */ TEST_P(RTPSDiscovery, ContentFilterWrongUpdate) { @@ -747,7 +747,7 @@ TEST_P(RTPSDiscovery, ContentFilterWrongUpdate) } /*! - * \test RTPS-CFT-RRR-04 Tests `registerReader()` and `updateReader()` works successfully when the pointer to + * \test RTPS-CFT-RRR-04 Tests `register_reader()` and `update_reader()` works successfully when the pointer to * `ContentFilterProperty` is `nullptr`. */ TEST_P(RTPSDiscovery, ContentFilterRegistrationWithoutCFP) @@ -830,8 +830,8 @@ TEST_P(RTPSDiscovery, ContentFilterRegistrationWithoutCFP) } /*! - * \test RTPS-CFT-RRR_05 Tests ``updateReader()` works successfully when a `ContentFilterProperty` is added for first - * time, because `registerReader()` passed a `nullptr`. + * \test RTPS-CFT-RRR_05 Tests ``update_reader()` works successfully when a `ContentFilterProperty` is added for first + * time, because `register_reader()` passed a `nullptr`. */ TEST_P(RTPSDiscovery, ContentFilterRegistrationWithoutCFPButUpdate) { diff --git a/test/blackbox/common/RTPSWithRegistrationReader.hpp b/test/blackbox/common/RTPSWithRegistrationReader.hpp index 879f4dbda0d..4883fc2dfea 100644 --- a/test/blackbox/common/RTPSWithRegistrationReader.hpp +++ b/test/blackbox/common/RTPSWithRegistrationReader.hpp @@ -34,7 +34,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -140,11 +141,11 @@ class RTPSWithRegistrationReader , receiving_(false) , matched_(0) { - topic_attr_.topicDataType = type_.get_name(); + sub_builtin_data_.type_name = type_.get_name(); // Generate topic name std::ostringstream t; t << topic_name << "_" << asio::ip::host_name() << "_" << GET_PID(); - topic_attr_.topicName = t.str(); + sub_builtin_data_.topic_name = t.str(); // By default, heartbeat period delay is 100 milliseconds. reader_attr_.times.heartbeat_response_delay.seconds = 0; @@ -193,7 +194,11 @@ class RTPSWithRegistrationReader return; } - initialized_ = participant_->registerReader(reader_, topic_attr_, reader_qos_, content_filter_property_); + eprosima::fastdds::rtps::TopicDescription topic_desc; + topic_desc.topic_name = sub_builtin_data_.topic_name; + topic_desc.type_name = sub_builtin_data_.type_name; + + initialized_ = participant_->register_reader(reader_, topic_desc, reader_qos_, content_filter_property_); } void update() @@ -203,7 +208,7 @@ class RTPSWithRegistrationReader return; } - initialized_ = participant_->updateReader(reader_, topic_attr_, reader_qos_, content_filter_property_); + initialized_ = participant_->update_reader(reader_, reader_qos_, content_filter_property_); } bool isInitialized() const @@ -430,7 +435,8 @@ class RTPSWithRegistrationReader RTPSWithRegistrationReader& history_depth( const int32_t depth) { - topic_attr_.historyQos.depth = depth; + hattr_.maximumReservedCaches = depth; + hattr_.initialReservedCaches = std::min(hattr_.initialReservedCaches, depth); return *this; } @@ -447,6 +453,7 @@ class RTPSWithRegistrationReader { reader_qos_.m_reliability.kind = eprosima::fastdds::dds::BEST_EFFORT_RELIABILITY_QOS; } + sub_builtin_data_.reliability = reader_qos_.m_reliability; return *this; } @@ -456,6 +463,7 @@ class RTPSWithRegistrationReader { reader_attr_.endpoint.durabilityKind = kind; reader_qos_.m_durability.durabilityKind(kind); + sub_builtin_data_.durability = reader_qos_.m_durability; return *this; } @@ -517,6 +525,7 @@ class RTPSWithRegistrationReader const std::vector& user_data) { reader_qos_.m_userData = user_data; + sub_builtin_data_.user_data = reader_qos_.m_userData; return *this; } @@ -531,6 +540,7 @@ class RTPSWithRegistrationReader std::vector& partitions) { reader_qos_.m_partition.setNames(partitions); + sub_builtin_data_.partition = reader_qos_.m_partition; return *this; } @@ -627,7 +637,7 @@ class RTPSWithRegistrationReader bool destroy_participant_{false}; eprosima::fastdds::rtps::RTPSReader* reader_; eprosima::fastdds::rtps::ReaderAttributes reader_attr_; - eprosima::fastdds::TopicAttributes topic_attr_; + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData sub_builtin_data_; eprosima::fastdds::dds::ReaderQos reader_qos_; eprosima::fastdds::rtps::ReaderHistory* history_; eprosima::fastdds::rtps::HistoryAttributes hattr_; diff --git a/test/blackbox/common/RTPSWithRegistrationWriter.hpp b/test/blackbox/common/RTPSWithRegistrationWriter.hpp index 116b51d481b..a54c75758d4 100644 --- a/test/blackbox/common/RTPSWithRegistrationWriter.hpp +++ b/test/blackbox/common/RTPSWithRegistrationWriter.hpp @@ -32,8 +32,9 @@ #include #include #include -#include #include +#include +#include #include #include #include @@ -124,11 +125,14 @@ class RTPSWithRegistrationWriter , initialized_(false) , matched_(0) { - topic_attr_.topicDataType = type_.get_name(); + pub_builtin_data_.type_name = type_.get_name(); // Generate topic name std::ostringstream t; t << topic_name << "_" << asio::ip::host_name() << "_" << GET_PID(); - topic_attr_.topicName = t.str(); + pub_builtin_data_.topic_name = t.str(); + + // The tests are assuming a default durability of TRANSIENT_LOCAL, which is not the default mandated by the DDS standard. + pub_builtin_data_.durability.kind = eprosima::fastdds::dds::TRANSIENT_LOCAL_DURABILITY_QOS; // By default, heartbeat period and nack response delay are 100 milliseconds. writer_attr_.times.heartbeat_period.seconds = 0; @@ -178,7 +182,10 @@ class RTPSWithRegistrationWriter return; } - ASSERT_EQ(participant_->registerWriter(writer_, topic_attr_, writer_qos_), true); + eprosima::fastdds::rtps::TopicDescription topic_desc; + topic_desc.type_name = type_.get_name(); + topic_desc.topic_name = pub_builtin_data_.topic_name; + ASSERT_EQ(participant_->register_writer(writer_, topic_desc, writer_qos_), true); initialized_ = true; } @@ -190,7 +197,7 @@ class RTPSWithRegistrationWriter return; } - ASSERT_TRUE(participant_->updateWriter(writer_, topic_attr_, writer_qos_)); + ASSERT_TRUE(participant_->update_writer(writer_, writer_qos_)); } void destroy() @@ -393,6 +400,7 @@ class RTPSWithRegistrationWriter { writer_qos_.m_reliability.kind = eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS; } + pub_builtin_data_.reliability = writer_qos_.m_reliability; return *this; } @@ -402,6 +410,7 @@ class RTPSWithRegistrationWriter { writer_attr_.endpoint.durabilityKind = kind; writer_qos_.m_durability.durabilityKind(kind); + pub_builtin_data_.durability = writer_qos_.m_durability; return *this; } @@ -466,7 +475,8 @@ class RTPSWithRegistrationWriter RTPSWithRegistrationWriter& history_depth( const int32_t depth) { - topic_attr_.historyQos.depth = depth; + hattr_.maximumReservedCaches = depth; + hattr_.initialReservedCaches = std::min(hattr_.initialReservedCaches, depth); return *this; } @@ -516,6 +526,7 @@ class RTPSWithRegistrationWriter const std::vector& user_data) { writer_qos_.m_userData = user_data; + pub_builtin_data_.user_data = writer_qos_.m_userData; return *this; } @@ -530,6 +541,7 @@ class RTPSWithRegistrationWriter std::vector& partitions) { writer_qos_.m_partition.setNames(partitions); + pub_builtin_data_.partition = writer_qos_.m_partition; return *this; } @@ -586,7 +598,7 @@ class RTPSWithRegistrationWriter eprosima::fastdds::rtps::RTPSWriter* writer_; eprosima::fastdds::rtps::WriterAttributes writer_attr_; eprosima::fastdds::dds::WriterQos writer_qos_; - eprosima::fastdds::TopicAttributes topic_attr_; + eprosima::fastdds::rtps::PublicationBuiltinTopicData pub_builtin_data_; eprosima::fastdds::rtps::WriterHistory* history_; eprosima::fastdds::rtps::HistoryAttributes hattr_; bool initialized_; diff --git a/test/mock/dds/DataWriterHistory/fastdds/publisher/DataWriterHistory.hpp b/test/mock/dds/DataWriterHistory/fastdds/publisher/DataWriterHistory.hpp index da2e45fd677..f04652bcf75 100644 --- a/test/mock/dds/DataWriterHistory/fastdds/publisher/DataWriterHistory.hpp +++ b/test/mock/dds/DataWriterHistory/fastdds/publisher/DataWriterHistory.hpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -31,6 +30,7 @@ #include #include #include +#include #include @@ -45,20 +45,22 @@ class DataWriterHistory : public WriterHistory public: static HistoryAttributes to_history_attributes( - const TopicAttributes& topic_att, + const HistoryQosPolicy& history_qos, + const ResourceLimitsQosPolicy& resource_limits_qos, + const rtps::TopicKind_t& topic_kind, uint32_t payloadMaxSize, MemoryManagementPolicy_t mempolicy) { - auto initial_samples = topic_att.resourceLimitsQos.allocated_samples; - auto max_samples = topic_att.resourceLimitsQos.max_samples; - auto extra_samples = topic_att.resourceLimitsQos.extra_samples; + auto initial_samples = resource_limits_qos.allocated_samples; + auto max_samples = resource_limits_qos.max_samples; + auto extra_samples = resource_limits_qos.extra_samples; - if (topic_att.historyQos.kind != KEEP_ALL_HISTORY_QOS) + if (history_qos.kind != KEEP_ALL_HISTORY_QOS) { - max_samples = topic_att.historyQos.depth; - if (topic_att.getTopicKind() != NO_KEY) + max_samples = history_qos.depth; + if (topic_kind != NO_KEY) { - max_samples *= topic_att.resourceLimitsQos.max_instances; + max_samples *= resource_limits_qos.max_instances; } initial_samples = std::min(initial_samples, max_samples); @@ -70,14 +72,17 @@ class DataWriterHistory : public WriterHistory DataWriterHistory( const std::shared_ptr& payload_pool, const std::shared_ptr& change_pool, - const TopicAttributes& topic_att, + const HistoryQosPolicy& history_qos, + const ResourceLimitsQosPolicy& resource_limits_qos, + const rtps::TopicKind_t& topic_kind, uint32_t payloadMaxSize, MemoryManagementPolicy_t mempolicy, - std::function unack_sample_remove_functor) - : WriterHistory(to_history_attributes(topic_att, payloadMaxSize, mempolicy), payload_pool, change_pool) - , history_qos_(topic_att.historyQos) - , resource_limited_qos_(topic_att.resourceLimitsQos) - , topic_att_(topic_att) + std::function unack_sample_remove_functor) + : WriterHistory(to_history_attributes(history_qos, resource_limits_qos, topic_kind, payloadMaxSize, + mempolicy), payload_pool, change_pool) + , history_qos_(history_qos) + , resource_limited_qos_(resource_limits_qos) + , topic_kind_(topic_kind) , unacknowledged_sample_removed_functor_(unack_sample_remove_functor) { if (resource_limited_qos_.max_samples <= 0) @@ -122,7 +127,7 @@ class DataWriterHistory : public WriterHistory payload = nullptr; /// Preconditions - if (topic_att_.getTopicKind() == NO_KEY) + if (topic_kind_ == NO_KEY) { return false; } @@ -184,8 +189,8 @@ class DataWriterHistory : public WriterHistory bool returnedValue = false; // For NO_KEY we can directly add the change - bool add = (topic_att_.getTopicKind() == NO_KEY); - if (topic_att_.getTopicKind() == WITH_KEY) + bool add = (topic_kind_ == NO_KEY); + if (topic_kind_ == WITH_KEY) { t_m_Inst_Caches::iterator vit; @@ -258,7 +263,7 @@ class DataWriterHistory : public WriterHistory } std::lock_guard guard(*this->mp_mutex); - if (topic_att_.getTopicKind() == NO_KEY) + if (topic_kind_ == NO_KEY) { if (remove_change(change)) { @@ -303,7 +308,7 @@ class DataWriterHistory : public WriterHistory //!ResourceLimitsQosPolicy values. ResourceLimitsQosPolicy resource_limited_qos_; //!Topic Attributes - TopicAttributes topic_att_; + TopicKind_t topic_kind_; //! Unacknowledged sample removed functor std::function unacknowledged_sample_removed_functor_; diff --git a/test/mock/dds/DomainParticipantImpl/fastdds/domain/DomainParticipantImpl.hpp b/test/mock/dds/DomainParticipantImpl/fastdds/domain/DomainParticipantImpl.hpp index 3bd9c44d0d6..fed9eddfb7b 100644 --- a/test/mock/dds/DomainParticipantImpl/fastdds/domain/DomainParticipantImpl.hpp +++ b/test/mock/dds/DomainParticipantImpl/fastdds/domain/DomainParticipantImpl.hpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -87,7 +86,7 @@ class DomainParticipantImpl participant_->impl_ = this; guid_.guidPrefix.value[11] = 1; - eprosima::fastdds::TopicAttributes top_attr; + eprosima::fastdds::xmlparser::TopicAttributes top_attr; eprosima::fastdds::xmlparser::XMLProfileManager::getDefaultTopicAttributes(top_attr); default_topic_qos_.history() = top_attr.historyQos; default_topic_qos_.resource_limits() = top_attr.resourceLimitsQos; @@ -713,6 +712,13 @@ class DomainParticipantImpl return id_counter_; } + bool fill_type_information( + const TypeSupport& /*type*/, + xtypes::TypeInformationParameter& /*type_information*/) + { + return false; + } + protected: DomainId_t domain_id_; diff --git a/test/mock/rtps/EDP/rtps/builtin/discovery/endpoint/EDP.h b/test/mock/rtps/EDP/rtps/builtin/discovery/endpoint/EDP.h index 54bce71540b..8518507ba18 100644 --- a/test/mock/rtps/EDP/rtps/builtin/discovery/endpoint/EDP.h +++ b/test/mock/rtps/EDP/rtps/builtin/discovery/endpoint/EDP.h @@ -57,13 +57,13 @@ class EDP return true; } - virtual bool removeLocalReader( + virtual bool remove_reader( eprosima::fastdds::rtps::RTPSReader*) { return true; } - virtual bool removeLocalWriter( + virtual bool remove_writer( eprosima::fastdds::rtps::RTPSWriter*) { return true; @@ -76,14 +76,14 @@ class EDP } - virtual bool processLocalReaderProxyData( + virtual bool process_reader_proxy_data( eprosima::fastdds::rtps::RTPSReader*, eprosima::fastdds::rtps::ReaderProxyData*) { return true; } - virtual bool processLocalWriterProxyData( + virtual bool process_writer_proxy_data( eprosima::fastdds::rtps::RTPSWriter*, eprosima::fastdds::rtps::WriterProxyData*) { diff --git a/test/mock/rtps/NetworkFactory/rtps/network/NetworkFactory.h b/test/mock/rtps/NetworkFactory/rtps/network/NetworkFactory.h index 37f911d0682..fae7800f8e1 100644 --- a/test/mock/rtps/NetworkFactory/rtps/network/NetworkFactory.h +++ b/test/mock/rtps/NetworkFactory/rtps/network/NetworkFactory.h @@ -106,6 +106,11 @@ class NetworkFactory return {}; } + NetworkConfigSet_t network_configuration() const + { + return NetworkConfigSet_t{}; + } + }; } // namespace rtps diff --git a/test/mock/rtps/PDP/rtps/builtin/discovery/participant/PDP.h b/test/mock/rtps/PDP/rtps/builtin/discovery/participant/PDP.h index 2c0ac9f2575..242e938ac05 100644 --- a/test/mock/rtps/PDP/rtps/builtin/discovery/participant/PDP.h +++ b/test/mock/rtps/PDP/rtps/builtin/discovery/participant/PDP.h @@ -60,7 +60,7 @@ class PDP MOCK_METHOD0(createPDPEndpoints, bool()); - MOCK_METHOD0(getEDP, EDP*()); + MOCK_METHOD0(get_edp, EDP*()); #ifdef FASTDDS_STATISTICS MOCK_METHOD0(get_proxy_observer, const fastdds::statistics::rtps::IProxyObserver*()); diff --git a/test/mock/rtps/PDPSimple/rtps/builtin/discovery/participant/PDPSimple.h b/test/mock/rtps/PDPSimple/rtps/builtin/discovery/participant/PDPSimple.h index ecdfff04ee2..ad534e4351b 100644 --- a/test/mock/rtps/PDPSimple/rtps/builtin/discovery/participant/PDPSimple.h +++ b/test/mock/rtps/PDPSimple/rtps/builtin/discovery/participant/PDPSimple.h @@ -38,7 +38,7 @@ class PDPSimple MOCK_METHOD1(get_participant_proxy_data_serialized, CDRMessage_t(Endianness_t)); - EDP* getEDP() + EDP* get_edp() { return &edp_; } diff --git a/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.hpp b/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.hpp index 50f1695c64e..d56e0ed65dc 100644 --- a/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.hpp +++ b/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.hpp @@ -58,8 +58,6 @@ class TypeLookupManager; } // namespace builtin } // namespace dds -class TopicAttributes; - namespace rtps { struct PublicationBuiltinTopicData; @@ -68,6 +66,7 @@ class RTPSParticipantListener; class RTPSWriter; class RTPSReader; struct SubscriptionBuiltinTopicData; +struct TopicDescription; class ResourceEvent; class WLP; @@ -187,41 +186,29 @@ class FASTDDS_EXPORTED_API RTPSParticipant MOCK_CONST_METHOD0(typelookup_manager, fastdds::dds::builtin::TypeLookupManager* ()); - MOCK_METHOD3(registerWriter, bool( + MOCK_METHOD3(register_writer, bool( RTPSWriter * Writer, - const TopicAttributes& topicAtt, - const fastdds::dds::WriterQos& wqos)); + const fastdds::rtps::TopicDescription& topic, + const fastdds::dds::WriterQos& qos)); - MOCK_METHOD3(updateWriter, bool( + MOCK_METHOD2(update_writer, bool( RTPSWriter * Writer, - const TopicAttributes& topicAtt, const fastdds::dds::WriterQos& wqos)); - MOCK_METHOD3(registerReader, bool( + MOCK_METHOD4(register_reader, bool( RTPSReader * Reader, - const TopicAttributes& topicAtt, - const fastdds::dds::ReaderQos& rqos)); + const fastdds::rtps::TopicDescription& topic, + const fastdds::dds::ReaderQos& qos, + const fastdds::rtps::ContentFilterProperty* content_filter)); - MOCK_METHOD4(registerReader, bool( + MOCK_METHOD3(update_reader, bool( RTPSReader * Reader, - const TopicAttributes& topicAtt, const fastdds::dds::ReaderQos& rqos, const fastdds::rtps::ContentFilterProperty* content_filter)); - MOCK_METHOD3(updateReader, bool( - RTPSReader * Reader, - const TopicAttributes& topicAtt, - const fastdds::dds::ReaderQos& rqos)); - MOCK_METHOD1(ignore_participant, bool( const GuidPrefix_t& participant_guid)); - MOCK_METHOD4(updateReader, bool( - RTPSReader * Reader, - const TopicAttributes& topicAtt, - const fastdds::dds::ReaderQos& rqos, - const fastdds::rtps::ContentFilterProperty* content_filter)); - std::vector get_netmask_filter_info() const { return {}; diff --git a/test/mock/rtps/RTPSWriter/rtps/writer/BaseWriter.hpp b/test/mock/rtps/RTPSWriter/rtps/writer/BaseWriter.hpp index 9bdca775d21..ab4dfa21108 100644 --- a/test/mock/rtps/RTPSWriter/rtps/writer/BaseWriter.hpp +++ b/test/mock/rtps/RTPSWriter/rtps/writer/BaseWriter.hpp @@ -76,11 +76,14 @@ class BaseWriter : public RTPSWriter return static_cast(endpoint); } + RTPSParticipantImpl* get_participant_impl() + { + return nullptr; + } + // *INDENT-OFF* Uncrustify makes a mess with MOCK_METHOD macros MOCK_METHOD0(get_max_allowed_payload_size, uint32_t()); - MOCK_METHOD0(get_participant_impl, RTPSParticipantImpl* ()); - MOCK_METHOD4(deliver_sample_nts, DeliveryRetCode( CacheChange_t*, RTPSMessageGroup&, diff --git a/test/unittest/dds/status/CMakeLists.txt b/test/unittest/dds/status/CMakeLists.txt index 5fd0ed83ad6..2613d36762a 100644 --- a/test/unittest/dds/status/CMakeLists.txt +++ b/test/unittest/dds/status/CMakeLists.txt @@ -58,6 +58,10 @@ set(LISTENERTESTS_SOURCE ListenerTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/fastdds/utils/TypePropagation.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/attributes/PropertyPolicy.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/attributes/ThreadSettings.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ProxyDataConverters.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/ReaderProxyData.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/builtin/data/WriterProxyData.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/common/GuidPrefix_t.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/common/LocatorWithMask.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/common/SerializedPayload.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/common/Time_t.cpp diff --git a/test/unittest/dds/status/ListenerTests.cpp b/test/unittest/dds/status/ListenerTests.cpp index b6e7b55cc63..91fec1db748 100644 --- a/test/unittest/dds/status/ListenerTests.cpp +++ b/test/unittest/dds/status/ListenerTests.cpp @@ -585,7 +585,7 @@ class UserListeners : public ::testing::Test ASSERT_NE(subscriber_, nullptr); EXPECT_CALL(participant_mock_, - registerReader(&reader_mock_, ::testing::_, ::testing::_, nullptr)).WillRepeatedly( + register_reader(&reader_mock_, ::testing::_, ::testing::_, nullptr)).WillRepeatedly( ::testing::Return(true)); datareader_ = diff --git a/test/unittest/dds/topic/TopicTests.cpp b/test/unittest/dds/topic/TopicTests.cpp index 670d248495a..13ea0195d76 100644 --- a/test/unittest/dds/topic/TopicTests.cpp +++ b/test/unittest/dds/topic/TopicTests.cpp @@ -22,7 +22,6 @@ #include #include #include -#include namespace eprosima { namespace fastdds { diff --git a/test/unittest/rtps/discovery/EdpTests.cpp b/test/unittest/rtps/discovery/EdpTests.cpp index ba238dc50a6..b206d62ccf4 100644 --- a/test/unittest/rtps/discovery/EdpTests.cpp +++ b/test/unittest/rtps/discovery/EdpTests.cpp @@ -60,26 +60,26 @@ class EDPMock : public EDP { } - bool removeLocalReader( + bool remove_reader( RTPSReader* /*R*/) override { return true; } - bool removeLocalWriter( + bool remove_writer( RTPSWriter* /*W*/) override { return true; } - bool processLocalReaderProxyData( + bool process_reader_proxy_data( RTPSReader* /*reader*/, ReaderProxyData* /*rdata*/) override { return true; } - bool processLocalWriterProxyData( + bool process_writer_proxy_data( RTPSWriter* /*writer*/, WriterProxyData* /*wdata*/) override { diff --git a/test/unittest/rtps/domain/RTPSDomainTests.cpp b/test/unittest/rtps/domain/RTPSDomainTests.cpp index cb8854c8779..0d4abbe92d6 100644 --- a/test/unittest/rtps/domain/RTPSDomainTests.cpp +++ b/test/unittest/rtps/domain/RTPSDomainTests.cpp @@ -56,48 +56,6 @@ TEST(RTPSDomainTests, library_settings_test) eprosima::fastdds::rtps::RTPSDomain::stopAll(); } -/** - * This test checks get_topic_attributes_from_profile API. - */ -TEST(RTPSDomainTests, get_topic_attributes_from_profile_test) -{ - std::string profile_name = "test_profile_name"; - eprosima::fastdds::TopicAttributes topic_att; - EXPECT_FALSE(eprosima::fastdds::rtps::RTPSDomain::get_topic_attributes_from_profile(profile_name, topic_att)); - - const std::string xml = - R"( - - Test - DataTest - - KEEP_LAST - 20 - - - 5 - 2 - 1 - 20 - 10 - - -)"; - - EXPECT_EQ(eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->load_XML_profiles_string(xml.c_str(), - xml.length()), eprosima::fastdds::dds::RETCODE_OK); - EXPECT_TRUE(eprosima::fastdds::rtps::RTPSDomain::get_topic_attributes_from_profile(profile_name, topic_att)); - EXPECT_EQ(topic_att.topicName, "Test"); - EXPECT_EQ(topic_att.topicDataType, "DataTest"); - EXPECT_EQ(topic_att.historyQos.kind, eprosima::fastdds::dds::HistoryQosPolicyKind::KEEP_LAST_HISTORY_QOS); - EXPECT_EQ(topic_att.historyQos.depth, 20); - EXPECT_EQ(topic_att.resourceLimitsQos.max_samples, 5); - EXPECT_EQ(topic_att.resourceLimitsQos.max_instances, 2); - EXPECT_EQ(topic_att.resourceLimitsQos.max_samples_per_instance, 1); - EXPECT_EQ(topic_att.resourceLimitsQos.allocated_samples, 20); - EXPECT_EQ(topic_att.resourceLimitsQos.extra_samples, 10); -} - int main( int argc, char** argv) diff --git a/test/unittest/rtps/reader/StatefulReaderTests.cpp b/test/unittest/rtps/reader/StatefulReaderTests.cpp index f3828aace75..4bcbce5b02c 100644 --- a/test/unittest/rtps/reader/StatefulReaderTests.cpp +++ b/test/unittest/rtps/reader/StatefulReaderTests.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -90,12 +91,11 @@ TEST(StatefulReaderTests, RTPSCorrectGAPProcessing) ASSERT_NE(writer, nullptr); // Register both endpoints - TopicAttributes topic_att; - topic_att.topicKind = NO_KEY; - topic_att.topicDataType = "string"; - topic_att.topicName = "topic"; - part->registerReader(reader, topic_att, {}); - part->registerWriter(writer, topic_att, {}); + TopicDescription topic_desc; + topic_desc.type_name = "string"; + topic_desc.topic_name = "topic"; + part->register_reader(reader, topic_desc, {}); + part->register_writer(writer, topic_desc, {}); // After registration, the writer should be matched auto writer_guid = writer->getGuid(); diff --git a/test/unittest/statistics/dds/StatisticsDomainParticipantStatusQueryableTests/mock/fastdds/publisher/DataWriterImpl.hpp b/test/unittest/statistics/dds/StatisticsDomainParticipantStatusQueryableTests/mock/fastdds/publisher/DataWriterImpl.hpp index 6d8186de30a..72ef193bbf1 100644 --- a/test/unittest/statistics/dds/StatisticsDomainParticipantStatusQueryableTests/mock/fastdds/publisher/DataWriterImpl.hpp +++ b/test/unittest/statistics/dds/StatisticsDomainParticipantStatusQueryableTests/mock/fastdds/publisher/DataWriterImpl.hpp @@ -130,7 +130,9 @@ class DataWriterImpl : protected rtps::IReaderDataFilter history_.reset(new DataWriterHistory( payload_pool, change_pool, - atts_, + qos_.history(), + qos_.resource_limits(), + topic_kind_, 500, fastdds::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE, [](const InstanceHandle_t&) @@ -393,6 +395,13 @@ class DataWriterImpl : protected rtps::IReaderDataFilter } } + inline ReturnCode_t get_publication_builtin_topic_data( + PublicationBuiltinTopicData& publication_data) const + { + publication_data = PublicationBuiltinTopicData{}; + return RETCODE_OK; + } + static ReturnCode_t check_qos( const ::eprosima::fastdds::dds::DataWriterQos&) { @@ -428,7 +437,8 @@ class DataWriterImpl : protected rtps::IReaderDataFilter OfferedIncompatibleQosStatus offered_incompatible_qos_status_; std::chrono::duration> lifespan_duration_us_; std::unique_ptr history_; - fastdds::TopicAttributes atts_; + + rtps::TopicKind_t topic_kind_; }; diff --git a/test/unittest/statistics/rtps/MonitorServiceTests.cpp b/test/unittest/statistics/rtps/MonitorServiceTests.cpp index 9d2b408fea2..6fc233b98ca 100644 --- a/test/unittest/statistics/rtps/MonitorServiceTests.cpp +++ b/test/unittest/statistics/rtps/MonitorServiceTests.cpp @@ -78,8 +78,8 @@ class MonitorServiceTests : public ::testing::Test }, [&]( fastdds::rtps::RTPSWriter*, - const fastdds::TopicAttributes&, - const fastdds::dds::WriterQos&)->bool + const ::eprosima::fastdds::rtps::TopicDescription&, + const ::eprosima::fastdds::dds::WriterQos&)->bool { return true; }, diff --git a/test/unittest/statistics/rtps/RTPSStatisticsTests.cpp b/test/unittest/statistics/rtps/RTPSStatisticsTests.cpp index 77737f0a58b..dbc8a093c40 100644 --- a/test/unittest/statistics/rtps/RTPSStatisticsTests.cpp +++ b/test/unittest/statistics/rtps/RTPSStatisticsTests.cpp @@ -31,8 +31,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -352,17 +352,16 @@ class RTPSStatisticsTestsImpl } void match_endpoints( - bool key, + bool /* key */, fastcdr::string_255 data_type, fastcdr::string_255 topic_name) { using namespace fastdds; using namespace fastdds::rtps; - TopicAttributes Tatt; - Tatt.topicKind = key ? TopicKind_t::WITH_KEY : TopicKind_t::NO_KEY; - Tatt.topicDataType = data_type; - Tatt.topicName = topic_name; + TopicDescription topic_desc; + topic_desc.type_name = data_type; + topic_desc.topic_name = topic_name; dds::WriterQos Wqos; auto& watt = writer_->getAttributes(); @@ -378,8 +377,8 @@ class RTPSStatisticsTestsImpl RELIABLE == ratt.reliabilityKind ? dds::RELIABLE_RELIABILITY_QOS : dds::BEST_EFFORT_RELIABILITY_QOS; - participant_->registerWriter(writer_, Tatt, Wqos); - participant_->registerReader(reader_, Tatt, Rqos); + participant_->register_writer(writer_, topic_desc, Wqos); + participant_->register_reader(reader_, topic_desc, Rqos); } void destroy_endpoints() diff --git a/test/unittest/statistics/rtps/mock/Publisher/fastdds/publisher/DataWriterHistory.hpp b/test/unittest/statistics/rtps/mock/Publisher/fastdds/publisher/DataWriterHistory.hpp index ee5799a6411..c87ffa31714 100644 --- a/test/unittest/statistics/rtps/mock/Publisher/fastdds/publisher/DataWriterHistory.hpp +++ b/test/unittest/statistics/rtps/mock/Publisher/fastdds/publisher/DataWriterHistory.hpp @@ -21,17 +21,15 @@ #include +#include #include +#include +#include #include #include -#include -#include namespace eprosima { namespace fastdds { - -class TopicAttributes; - namespace rtps { class WriteParams; @@ -48,9 +46,11 @@ class Topic; static fastdds::rtps::HistoryAttributes to_history_attributes( - const fastdds::TopicAttributes&, + const HistoryQosPolicy&, + const ResourceLimitsQosPolicy&, + const rtps::TopicKind_t&, uint32_t, - fastdds::rtps::MemoryManagementPolicy_t) + rtps::MemoryManagementPolicy_t) { return fastdds::rtps::HistoryAttributes(); @@ -63,11 +63,14 @@ class DataWriterHistory : public fastdds::rtps::WriterHistory DataWriterHistory( const std::shared_ptr& payload_pool, const std::shared_ptr& change_pool, - const TopicAttributes& topic_att, + const HistoryQosPolicy& history_qos, + const ResourceLimitsQosPolicy& resource_limits_qos, + const rtps::TopicKind_t& topic_kind, uint32_t payloadMaxSize, rtps::MemoryManagementPolicy_t mempolicy, - std::function) - : WriterHistory(to_history_attributes(topic_att, payloadMaxSize, mempolicy), payload_pool, change_pool) + std::function) + : WriterHistory(to_history_attributes(history_qos, resource_limits_qos, topic_kind, payloadMaxSize, + mempolicy), payload_pool, change_pool) { } diff --git a/test/unittest/statistics/rtps/mock/StatisticsBase/statistics/rtps/monitor-service/MonitorService.hpp b/test/unittest/statistics/rtps/mock/StatisticsBase/statistics/rtps/monitor-service/MonitorService.hpp index 10d47e833c6..7c35c22dc88 100644 --- a/test/unittest/statistics/rtps/mock/StatisticsBase/statistics/rtps/monitor-service/MonitorService.hpp +++ b/test/unittest/statistics/rtps/mock/StatisticsBase/statistics/rtps/monitor-service/MonitorService.hpp @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -41,6 +42,13 @@ namespace eprosima { namespace fastdds { + +namespace rtps { + +struct TopicDescription; + +} // namespace rtps + namespace statistics { namespace rtps { @@ -61,8 +69,8 @@ class MonitorService using endpoint_registrator_t = std::function; + const eprosima::fastdds::rtps::TopicDescription&, + const eprosima::fastdds::dds::WriterQos&)>; MonitorService( const fastdds::rtps::GUID_t& guid, diff --git a/test/unittest/xmlparser/XMLElementParserTests.cpp b/test/unittest/xmlparser/XMLElementParserTests.cpp index 16f54d6c19c..445ca94562a 100644 --- a/test/unittest/xmlparser/XMLElementParserTests.cpp +++ b/test/unittest/xmlparser/XMLElementParserTests.cpp @@ -2089,7 +2089,7 @@ TEST_F(XMLParserTests, getXMLFlowControllerDescriptorList_NegativeClauses) TEST_F(XMLParserTests, getXMLTopicAttributes_NegativeClauses) { uint8_t ident = 1; - TopicAttributes topic; + xmlparser::TopicAttributes topic; tinyxml2::XMLDocument xml_doc; tinyxml2::XMLElement* titleElement; diff --git a/test/unittest/xmlparser/XMLProfileParserTests.cpp b/test/unittest/xmlparser/XMLProfileParserTests.cpp index 226755d897b..65e21bbe769 100644 --- a/test/unittest/xmlparser/XMLProfileParserTests.cpp +++ b/test/unittest/xmlparser/XMLProfileParserTests.cpp @@ -851,7 +851,7 @@ TEST_P(XMLProfileParserTests, XMLParserPublisher) EXPECT_EQ( xmlparser::XMLP_ret::XML_OK, xmlparser::XMLProfileManager::fillPublisherAttributes(publisher_profile, publisher_atts)); - TopicAttributes& pub_topic = publisher_atts.topic; + xmlparser::TopicAttributes& pub_topic = publisher_atts.topic; dds::WriterQos& pub_qos = publisher_atts.qos; Locator_t locator; LocatorListIterator loc_list_it; @@ -925,7 +925,7 @@ TEST_F(XMLProfileParserBasicTests, XMLParserPublisherDeprecated) EXPECT_EQ( xmlparser::XMLP_ret::XML_OK, xmlparser::XMLProfileManager::fillPublisherAttributes(publisher_profile, publisher_atts)); - TopicAttributes& pub_topic = publisher_atts.topic; + xmlparser::TopicAttributes& pub_topic = publisher_atts.topic; dds::WriterQos& pub_qos = publisher_atts.qos; Locator_t locator; LocatorListIterator loc_list_it; @@ -997,7 +997,7 @@ TEST_P(XMLProfileParserTests, XMLParserDefaultPublisherProfile) xmlparser::XMLProfileManager::loadXMLFile(xml_filename_)); xmlparser::XMLProfileManager::getDefaultPublisherAttributes(publisher_atts); - TopicAttributes& pub_topic = publisher_atts.topic; + xmlparser::TopicAttributes& pub_topic = publisher_atts.topic; dds::WriterQos& pub_qos = publisher_atts.qos; Locator_t locator; LocatorListIterator loc_list_it; @@ -1069,7 +1069,7 @@ TEST_F(XMLProfileParserBasicTests, XMLParserDefaultPublisherProfileDeprecated) xmlparser::XMLProfileManager::loadXMLFile("test_xml_deprecated.xml")); xmlparser::XMLProfileManager::getDefaultPublisherAttributes(publisher_atts); - TopicAttributes& pub_topic = publisher_atts.topic; + xmlparser::TopicAttributes& pub_topic = publisher_atts.topic; dds::WriterQos& pub_qos = publisher_atts.qos; Locator_t locator; LocatorListIterator loc_list_it; @@ -1143,7 +1143,7 @@ TEST_P(XMLProfileParserTests, XMLParserSubscriber) EXPECT_EQ( xmlparser::XMLP_ret::XML_OK, xmlparser::XMLProfileManager::fillSubscriberAttributes(subscriber_profile, subscriber_atts)); - TopicAttributes& sub_topic = subscriber_atts.topic; + xmlparser::TopicAttributes& sub_topic = subscriber_atts.topic; dds::ReaderQos& sub_qos = subscriber_atts.qos; Locator_t locator; LocatorListIterator loc_list_it; @@ -1215,7 +1215,7 @@ TEST_F(XMLProfileParserBasicTests, XMLParserSubscriberDeprecated) EXPECT_EQ( xmlparser::XMLP_ret::XML_OK, xmlparser::XMLProfileManager::fillSubscriberAttributes(subscriber_profile, subscriber_atts)); - TopicAttributes& sub_topic = subscriber_atts.topic; + xmlparser::TopicAttributes& sub_topic = subscriber_atts.topic; dds::ReaderQos& sub_qos = subscriber_atts.qos; Locator_t locator; LocatorListIterator loc_list_it; @@ -1285,7 +1285,7 @@ TEST_P(XMLProfileParserTests, XMLParserDefaultSubscriberProfile) xmlparser::XMLProfileManager::loadXMLFile(xml_filename_)); xmlparser::XMLProfileManager::getDefaultSubscriberAttributes(subscriber_atts); - TopicAttributes& sub_topic = subscriber_atts.topic; + xmlparser::TopicAttributes& sub_topic = subscriber_atts.topic; dds::ReaderQos& sub_qos = subscriber_atts.qos; Locator_t locator; LocatorListIterator loc_list_it; @@ -1355,7 +1355,7 @@ TEST_F(XMLProfileParserBasicTests, XMLParserDefaultSubscriberProfileDeprecated) xmlparser::XMLProfileManager::loadXMLFile("test_xml_deprecated.xml")); xmlparser::XMLProfileManager::getDefaultSubscriberAttributes(subscriber_atts); - TopicAttributes& sub_topic = subscriber_atts.topic; + xmlparser::TopicAttributes& sub_topic = subscriber_atts.topic; dds::ReaderQos& sub_qos = subscriber_atts.qos; Locator_t locator; LocatorListIterator loc_list_it; diff --git a/test/unittest/xmlparser/wrapper/XMLParserTest.hpp b/test/unittest/xmlparser/wrapper/XMLParserTest.hpp index 4c4e8a5e9a3..55ddbb11880 100644 --- a/test/unittest/xmlparser/wrapper/XMLParserTest.hpp +++ b/test/unittest/xmlparser/wrapper/XMLParserTest.hpp @@ -239,7 +239,7 @@ class XMLParserTest : public XMLParser static XMLP_ret getXMLTopicAttributes_wrapper( tinyxml2::XMLElement* elem, - TopicAttributes& topic, + xmlparser::TopicAttributes& topic, uint8_t ident) { return getXMLTopicAttributes(elem, topic, ident); @@ -522,7 +522,7 @@ class XMLParserTest : public XMLParser static XMLP_ret fillDataNode_wrapper( tinyxml2::XMLElement* p_profile, - DataNode& topic_node) + DataNode& topic_node) { return fillDataNode(p_profile, topic_node); } diff --git a/versions.md b/versions.md index 04e6d83f82c..682992bde1f 100644 --- a/versions.md +++ b/versions.md @@ -16,10 +16,17 @@ Forthcoming * Several methods that were meant for internal use have been removed from public API * All public methods now have `snake_case` names * All public attributes now have `snake_case` names + * RTPSParticipant: + * Some methods changed to `snake_case`: `register_reader`, `register_writer`, `update_reader`, `update_writer`. + * Register methods take a `TopicDescription` instead of `TopicAttributes`. + * Update methods no longer take `TopicAttributes`. * Discovery callbacks refactor: * on_participant_discovery now receives a `ParticipantDiscoveryStatus` and a `ParticipantBuiltinTopicData` instead of a `ParticipantDiscoveryInfo` * on_data_reader_discovery now receives a `ReaderDiscoveryStatus` and a `SubscriptionBuiltinTopicData` instead of a `ReaderDiscoveryInfo` * on_data_writer_discovery now receives a `WriterDiscoveryStatus` and a `PublicationBuiltinTopicData` instead of a `WriterDiscoveryInfo` +* New methods to get local discovery information: + * `DataWriter::get_publication_builtin_topic_data` + * `DataReader::get_subscription_builtin_topic_data` * Public API that is no longer public: * XML Parser API no longer public. * ReaderProxyData @@ -33,6 +40,7 @@ Forthcoming * RequesterAttributes * PublisherAttributes * SubscriberAttributes + * TopicAttributes * All discovery implementation related API * ProxyPool * Semaphore