diff --git a/include/fastdds/rtps/participant/RTPSParticipant.hpp b/include/fastdds/rtps/participant/RTPSParticipant.hpp index 9292ab5024..aada22e0d7 100644 --- a/include/fastdds/rtps/participant/RTPSParticipant.hpp +++ b/include/fastdds/rtps/participant/RTPSParticipant.hpp @@ -207,7 +207,7 @@ class FASTDDS_EXPORTED_API RTPSParticipant * Get a copy of the actual state of the RTPSParticipantParameters * @return RTPSParticipantAttributes copy of the params. */ - const RTPSParticipantAttributes& getRTPSParticipantAttributes() const; + RTPSParticipantAttributes get_attributes() const; /** * Retrieves the maximum message size. diff --git a/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp b/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp index a9d479f2ca..33574326ee 100644 --- a/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp +++ b/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp @@ -108,15 +108,17 @@ bool TypeLookupManager::init( { participant_ = protocols->mp_participantImpl; builtin_protocols_ = protocols; + auto locators_allocations = participant_->get_attributes().allocation.locators; local_instance_name_ = get_instance_name(participant_->getGuid()); temp_reader_proxy_data_ = new fastdds::rtps::ReaderProxyData( - protocols->mp_participantImpl->getRTPSParticipantAttributes().allocation.locators.max_unicast_locators, - protocols->mp_participantImpl->getRTPSParticipantAttributes().allocation.locators.max_multicast_locators); + locators_allocations.max_unicast_locators, + locators_allocations.max_multicast_locators); + temp_writer_proxy_data_ = new fastdds::rtps::WriterProxyData( - protocols->mp_participantImpl->getRTPSParticipantAttributes().allocation.locators.max_unicast_locators, - protocols->mp_participantImpl->getRTPSParticipantAttributes().allocation.locators.max_multicast_locators); + locators_allocations.max_unicast_locators, + locators_allocations.max_multicast_locators); type_propagation_ = participant_->type_propagation(); @@ -526,7 +528,7 @@ bool TypeLookupManager::create_endpoints() { bool ret = true; - const RTPSParticipantAttributes& pattr = participant_->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = participant_->get_attributes(); // Built-in history attributes. HistoryAttributes hatt; diff --git a/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupReplyListener.cpp b/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupReplyListener.cpp index c107fedd18..baa56c3914 100644 --- a/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupReplyListener.cpp +++ b/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupReplyListener.cpp @@ -60,7 +60,7 @@ void TypeLookupReplyListener::start_reply_processor_thread() }; // Create and start the processing thread replies_processor_thread = eprosima::create_thread(thread_func, - typelookup_manager_->participant_->getAttributes().typelookup_service_thread, + typelookup_manager_->participant_->get_attributes().typelookup_service_thread, "dds.tls.replies.%u"); } } diff --git a/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupRequestListener.cpp b/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupRequestListener.cpp index a305f6b88e..6a5c800f3a 100644 --- a/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupRequestListener.cpp +++ b/src/cpp/fastdds/builtin/type_lookup_service/TypeLookupRequestListener.cpp @@ -112,7 +112,7 @@ void TypeLookupRequestListener::start_request_processor_thread() }; // Create and start the processing thread request_processor_thread = eprosima::create_thread(thread_func, - typelookup_manager_->participant_->getAttributes().typelookup_service_thread, + typelookup_manager_->participant_->get_attributes().typelookup_service_thread, "dds.tls.requests.%u"); } } diff --git a/src/cpp/fastdds/domain/DomainParticipantImpl.cpp b/src/cpp/fastdds/domain/DomainParticipantImpl.cpp index 88b80efcae..0b7d6d4b01 100644 --- a/src/cpp/fastdds/domain/DomainParticipantImpl.cpp +++ b/src/cpp/fastdds/domain/DomainParticipantImpl.cpp @@ -379,7 +379,7 @@ ReturnCode_t DomainParticipantImpl::set_qos( else { // Trigger update of network interfaces by calling update_attributes with current attributes - patt = rtps_participant->getRTPSParticipantAttributes(); + patt = rtps_participant->get_attributes(); } } } diff --git a/src/cpp/rtps/builtin/BuiltinProtocols.cpp b/src/cpp/rtps/builtin/BuiltinProtocols.cpp index 66ac2c8db5..bb0c7745af 100644 --- a/src/cpp/rtps/builtin/BuiltinProtocols.cpp +++ b/src/cpp/rtps/builtin/BuiltinProtocols.cpp @@ -86,7 +86,7 @@ bool BuiltinProtocols::initBuiltinProtocols( filter_server_remote_locators(p_part->network_factory()); - const RTPSParticipantAllocationAttributes& allocation = p_part->getRTPSParticipantAttributes().allocation; + const RTPSParticipantAllocationAttributes& allocation = p_part->get_attributes().allocation; // PDP switch (m_att.discovery_config.discoveryProtocol) diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp index dc7a6a46cd..e38a208fdc 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp @@ -744,7 +744,7 @@ void EDPSimple::assignRemoteEndpoints( const NetworkFactory& network = mp_RTPSParticipant->network_factory(); uint32_t endp = pdata.m_availableBuiltinEndpoints; uint32_t auxendp; - bool use_multicast_locators = !mp_PDP->getRTPSParticipant()->getAttributes().builtin.avoid_builtin_multicast || + bool use_multicast_locators = !mp_PDP->getRTPSParticipant()->get_attributes().builtin.avoid_builtin_multicast || pdata.metatraffic_locators.unicast.empty(); auto temp_reader_proxy_data = get_temporary_reader_proxies_pool().get(); diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp index 08ea0c6a7d..601e5cd1ab 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp @@ -133,7 +133,7 @@ bool EDPStatic::initEDP( } // Check there is a Participant's property changing the exchange format. - for (auto& property : mp_RTPSParticipant->getAttributes().properties.properties()) + for (auto& property : mp_RTPSParticipant->get_attributes().properties.properties()) { if (0 == property.name().compare(exchange_format_property_name)) { diff --git a/src/cpp/rtps/builtin/discovery/participant/PDP.cpp b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp index ecb2847b71..b4a2823fc7 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDP.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp @@ -173,7 +173,7 @@ ParticipantProxyData* PDP::add_participant_proxy_data( { // Pool is empty but limit has not been reached, so we create a new entry. ++participant_proxies_number_; - ret_val = new ParticipantProxyData(mp_RTPSParticipant->getRTPSParticipantAttributes().allocation); + ret_val = new ParticipantProxyData(mp_RTPSParticipant->get_attributes().allocation); if (participant_guid != mp_RTPSParticipant->getGuid()) { ret_val->lease_duration_event = new TimedEvent(mp_RTPSParticipant->getEventResource(), @@ -298,7 +298,7 @@ std::string PDP::check_participant_type( void PDP::initializeParticipantProxyData( ParticipantProxyData* participant_data) { - RTPSParticipantAttributes& attributes = mp_RTPSParticipant->getAttributes(); + RTPSParticipantAttributes attributes = mp_RTPSParticipant->get_attributes(); bool announce_locators = !mp_RTPSParticipant->is_intraprocess_only(); participant_data->m_domain_id = mp_RTPSParticipant->get_domain_id(); @@ -460,7 +460,7 @@ bool PDP::initPDP( { EPROSIMA_LOG_INFO(RTPS_PDP, "Beginning"); mp_RTPSParticipant = part; - m_discovery = mp_RTPSParticipant->getAttributes().builtin; + m_discovery = mp_RTPSParticipant->get_attributes().builtin; initial_announcements_ = m_discovery.discovery_config.initial_announcements; //CREATE ENDPOINTS if (!createPDPEndpoints()) @@ -939,11 +939,14 @@ ReaderProxyData* PDP::addReaderProxyData( { // Pool is empty but limit has not been reached, so we create a new entry. ++reader_proxies_number_; + + auto allocations = mp_RTPSParticipant->get_attributes().allocation; + ret_val = new ReaderProxyData( - mp_RTPSParticipant->getAttributes().allocation.locators.max_unicast_locators, - mp_RTPSParticipant->getAttributes().allocation.locators.max_multicast_locators, - mp_RTPSParticipant->getAttributes().allocation.data_limits, - mp_RTPSParticipant->getAttributes().allocation.content_filter); + allocations.locators.max_unicast_locators, + allocations.locators.max_multicast_locators, + allocations.data_limits, + allocations.content_filter); } else { @@ -1042,10 +1045,13 @@ WriterProxyData* PDP::addWriterProxyData( { // Pool is empty but limit has not been reached, so we create a new entry. ++writer_proxies_number_; + + auto allocations = mp_RTPSParticipant->get_attributes().allocation; + ret_val = new WriterProxyData( - mp_RTPSParticipant->getAttributes().allocation.locators.max_unicast_locators, - mp_RTPSParticipant->getAttributes().allocation.locators.max_multicast_locators, - mp_RTPSParticipant->getAttributes().allocation.data_limits); + allocations.locators.max_unicast_locators, + allocations.locators.max_multicast_locators, + allocations.data_limits); } else { @@ -1521,8 +1527,10 @@ void PDP::resend_ininitial_announcements() void PDP::set_external_participant_properties_( ParticipantProxyData* participant_data) { + auto part_attributes = mp_RTPSParticipant->get_attributes(); + // For each property add it if it should be sent (it is propagated) - for (auto const& property : mp_RTPSParticipant->getAttributes().properties.properties()) + for (auto const& property : part_attributes.properties.properties()) { if (property.propagate()) { @@ -1533,7 +1541,7 @@ void PDP::set_external_participant_properties_( // Set participant type property // TODO: This could be done somewhere else that makes more sense. std::stringstream participant_type; - participant_type << mp_RTPSParticipant->getAttributes().builtin.discovery_config.discoveryProtocol; + participant_type << part_attributes.builtin.discovery_config.discoveryProtocol; auto ptype = participant_type.str(); participant_data->m_properties.push_back(fastdds::dds::parameter_property_participant_type, ptype); @@ -1546,8 +1554,10 @@ void PDP::set_external_participant_properties_( }; for (auto physical_property_name : physical_property_names) { + auto properties = part_attributes.properties; std::string* physical_property = PropertyPolicyHelper::find_property( - mp_RTPSParticipant->getAttributes().properties, physical_property_name); + properties, physical_property_name); + if (nullptr != physical_property) { participant_data->m_properties.push_back(physical_property_name, *physical_property); @@ -1579,7 +1589,7 @@ static void set_builtin_endpoint_locators( const PDP* pdp, const BuiltinProtocols* builtin) { - const RTPSParticipantAttributes& pattr = pdp->getRTPSParticipant()->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = pdp->getRTPSParticipant()->get_attributes(); auto part_data = pdp->getLocalParticipantProxyData(); if (nullptr == part_data) @@ -1613,7 +1623,7 @@ ReaderAttributes PDP::create_builtin_reader_attributes() const { ReaderAttributes attributes; - const RTPSParticipantAttributes& pattr = getRTPSParticipant()->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = getRTPSParticipant()->get_attributes(); set_builtin_matched_allocation(attributes.matched_writers_allocation, pattr); set_builtin_endpoint_locators(attributes.endpoint, this, mp_builtin); @@ -1632,7 +1642,7 @@ WriterAttributes PDP::create_builtin_writer_attributes() const { WriterAttributes attributes; - const RTPSParticipantAttributes& pattr = getRTPSParticipant()->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = getRTPSParticipant()->get_attributes(); set_builtin_matched_allocation(attributes.matched_readers_allocation, pattr); set_builtin_endpoint_locators(attributes.endpoint, this, mp_builtin); diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp index c099af592c..86ac635fe9 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp @@ -106,25 +106,21 @@ void PDPClient::initializeParticipantProxyData( { PDP::initializeParticipantProxyData(participant_data); // TODO: Remember that the PDP version USES security - if ( - getRTPSParticipant()->getAttributes().builtin.discovery_config.discoveryProtocol - != DiscoveryProtocol::CLIENT - && - getRTPSParticipant()->getAttributes().builtin.discovery_config.discoveryProtocol - != DiscoveryProtocol::SUPER_CLIENT ) + auto discovery_config = getRTPSParticipant()->get_attributes().builtin.discovery_config; + + if ((DiscoveryProtocol::CLIENT != discovery_config.discoveryProtocol) && + (DiscoveryProtocol::SUPER_CLIENT != discovery_config.discoveryProtocol)) { EPROSIMA_LOG_ERROR(RTPS_PDP, "Using a PDP client object with another user's settings"); } - if (getRTPSParticipant()->getAttributes().builtin.discovery_config.m_simpleEDP. - use_PublicationWriterANDSubscriptionReader) + if (discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader) { participant_data->m_availableBuiltinEndpoints |= DISC_BUILTIN_ENDPOINT_PUBLICATION_ANNOUNCER; participant_data->m_availableBuiltinEndpoints |= DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_DETECTOR; } - if (getRTPSParticipant()->getAttributes().builtin.discovery_config.m_simpleEDP. - use_PublicationReaderANDSubscriptionWriter) + if (discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter) { participant_data->m_availableBuiltinEndpoints |= DISC_BUILTIN_ENDPOINT_PUBLICATION_DETECTOR; participant_data->m_availableBuiltinEndpoints |= DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_ANNOUNCER; @@ -136,15 +132,13 @@ void PDPClient::initializeParticipantProxyData( fastdds::dds::parameter_property_current_ds_version})); #if HAVE_SECURITY - if (getRTPSParticipant()->getAttributes().builtin.discovery_config.m_simpleEDP - .enable_builtin_secure_publications_writer_and_subscriptions_reader) + if (discovery_config.m_simpleEDP.enable_builtin_secure_publications_writer_and_subscriptions_reader) { participant_data->m_availableBuiltinEndpoints |= DISC_BUILTIN_ENDPOINT_PUBLICATION_SECURE_ANNOUNCER; participant_data->m_availableBuiltinEndpoints |= DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_SECURE_DETECTOR; } - if (getRTPSParticipant()->getAttributes().builtin.discovery_config.m_simpleEDP - .enable_builtin_secure_subscriptions_writer_and_publications_reader) + if (discovery_config.m_simpleEDP.enable_builtin_secure_subscriptions_writer_and_publications_reader) { participant_data->m_availableBuiltinEndpoints |= DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_SECURE_ANNOUNCER; participant_data->m_availableBuiltinEndpoints |= DISC_BUILTIN_ENDPOINT_PUBLICATION_SECURE_DETECTOR; @@ -251,7 +245,7 @@ bool PDPClient::create_secure_ds_pdp_endpoints() bool PDPClient::create_ds_pdp_best_effort_reader( DiscoveryServerPDPEndpointsSecure& endpoints) { - const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->get_attributes(); HistoryAttributes hatt; hatt.payloadMaxSize = mp_builtin->m_att.readerPayloadSize; @@ -316,7 +310,7 @@ bool PDPClient::create_ds_pdp_reliable_endpoints( EPROSIMA_LOG_INFO(RTPS_PDP, "Beginning PDPClient Endpoints creation"); - const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->get_attributes(); /*********************************** * PDP READER diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp index b3e0ee19f2..232735bff8 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp @@ -47,7 +47,7 @@ namespace rtps { PDPListener::PDPListener( PDP* parent) : parent_pdp_(parent) - , temp_participant_data_(parent->getRTPSParticipant()->getRTPSParticipantAttributes().allocation) + , temp_participant_data_(parent->getRTPSParticipant()->get_attributes().allocation) { } @@ -120,7 +120,7 @@ void PDPListener::on_new_cache_change_added( } // Filter locators - const auto& pattr = parent_pdp_->getRTPSParticipant()->getAttributes(); + const auto& pattr = parent_pdp_->getRTPSParticipant()->get_attributes(); fastdds::rtps::network::external_locators::filter_remote_locators(temp_participant_data_, pattr.builtin.metatraffic_external_unicast_locators, pattr.default_external_unicast_locators, pattr.ignore_non_matching_locators); diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp index 2a1bcf283d..a668badb4b 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp @@ -121,7 +121,7 @@ bool PDPServer::init( getRTPSParticipant()->enableReader(edp->publications_reader_.first); // Initialize server dedicated thread. - const RTPSParticipantAttributes& part_attr = getRTPSParticipant()->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& part_attr = getRTPSParticipant()->get_attributes(); uint32_t id_for_thread = static_cast(part_attr.participantID); const fastdds::rtps::ThreadSettings& thr_config = part_attr.discovery_server_thread; resource_event_thread_.init_thread(thr_config, "dds.ds_ev.%u", id_for_thread); @@ -253,7 +253,7 @@ bool PDPServer::create_secure_ds_pdp_endpoints() bool PDPServer::create_ds_pdp_best_effort_reader( DiscoveryServerPDPEndpointsSecure& endpoints) { - const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->get_attributes(); HistoryAttributes hatt; hatt.payloadMaxSize = mp_builtin->m_att.readerPayloadSize; @@ -337,7 +337,7 @@ bool PDPServer::create_ds_pdp_reliable_endpoints( bool secure) { static_cast(secure); - const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->get_attributes(); /*********************************** * PDP READER @@ -503,10 +503,12 @@ void PDPServer::initializeParticipantProxyData( { PDP::initializeParticipantProxyData(participant_data); - if (getRTPSParticipant()->getAttributes().builtin.discovery_config.discoveryProtocol != + auto discovery_config = getRTPSParticipant()->get_attributes().builtin.discovery_config; + + if (discovery_config.discoveryProtocol != DiscoveryProtocol::SERVER && - getRTPSParticipant()->getAttributes().builtin.discovery_config.discoveryProtocol != + discovery_config.discoveryProtocol != DiscoveryProtocol::BACKUP) { EPROSIMA_LOG_ERROR(RTPS_PDP_SERVER, "Using a PDP Server object with another user's settings"); @@ -530,7 +532,7 @@ void PDPServer::initializeParticipantProxyData( } #endif //HAVE_SECURITY - const SimpleEDPAttributes& se = getRTPSParticipant()->getAttributes().builtin.discovery_config.m_simpleEDP; + const SimpleEDPAttributes& se = discovery_config.m_simpleEDP; if (!(se.use_PublicationWriterANDSubscriptionReader && se.use_PublicationReaderANDSubscriptionWriter)) { @@ -549,7 +551,7 @@ void PDPServer::match_reliable_pdp_endpoints( auto endpoints = static_cast(builtin_endpoints_.get()); const NetworkFactory& network = mp_RTPSParticipant->network_factory(); uint32_t endp = pdata.m_availableBuiltinEndpoints; - bool use_multicast_locators = !mp_RTPSParticipant->getAttributes().builtin.avoid_builtin_multicast || + bool use_multicast_locators = !mp_RTPSParticipant->get_attributes().builtin.avoid_builtin_multicast || pdata.metatraffic_locators.unicast.empty(); // Only SERVER and CLIENT participants will be received. All builtin must be there diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp index 3094a8e712..233343ea7f 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp @@ -155,7 +155,7 @@ void PDPServerListener::on_new_cache_change_added( EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, "Participant type " << participant_type_str); bool is_client = ret.second; - const auto& pattr = pdp_server()->getRTPSParticipant()->getAttributes(); + const auto& pattr = pdp_server()->getRTPSParticipant()->get_attributes(); fastdds::rtps::network::external_locators::filter_remote_locators(participant_data, pattr.builtin.metatraffic_external_unicast_locators, pattr.default_external_unicast_locators, pattr.ignore_non_matching_locators); diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp index 2f47c3e9e9..cbef1dc1b6 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp @@ -107,18 +107,17 @@ void PDPSimple::initializeParticipantProxyData( { PDP::initializeParticipantProxyData(participant_data); - if (getRTPSParticipant()->getAttributes().builtin.discovery_config. - use_SIMPLE_EndpointDiscoveryProtocol) + auto discovery_config = getRTPSParticipant()->get_attributes().builtin.discovery_config; + + if (discovery_config.use_SIMPLE_EndpointDiscoveryProtocol) { - if (getRTPSParticipant()->getAttributes().builtin.discovery_config.m_simpleEDP. - use_PublicationWriterANDSubscriptionReader) + if (discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader) { participant_data->m_availableBuiltinEndpoints |= fastdds::rtps::DISC_BUILTIN_ENDPOINT_PUBLICATION_ANNOUNCER; participant_data->m_availableBuiltinEndpoints |= fastdds::rtps::DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_DETECTOR; } - if (getRTPSParticipant()->getAttributes().builtin.discovery_config.m_simpleEDP. - use_PublicationReaderANDSubscriptionWriter) + if (discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter) { participant_data->m_availableBuiltinEndpoints |= fastdds::rtps::DISC_BUILTIN_ENDPOINT_PUBLICATION_DETECTOR; participant_data->m_availableBuiltinEndpoints |= @@ -126,8 +125,7 @@ void PDPSimple::initializeParticipantProxyData( } #if HAVE_SECURITY - if (getRTPSParticipant()->getAttributes().builtin.discovery_config.m_simpleEDP. - enable_builtin_secure_publications_writer_and_subscriptions_reader) + if (discovery_config.m_simpleEDP.enable_builtin_secure_publications_writer_and_subscriptions_reader) { participant_data->m_availableBuiltinEndpoints |= fastdds::rtps::DISC_BUILTIN_ENDPOINT_PUBLICATION_SECURE_ANNOUNCER; @@ -135,8 +133,7 @@ void PDPSimple::initializeParticipantProxyData( fastdds::rtps::DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_SECURE_DETECTOR; } - if (getRTPSParticipant()->getAttributes().builtin.discovery_config.m_simpleEDP. - enable_builtin_secure_subscriptions_writer_and_publications_reader) + if (discovery_config.m_simpleEDP.enable_builtin_secure_subscriptions_writer_and_publications_reader) { participant_data->m_availableBuiltinEndpoints |= fastdds::rtps::DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_SECURE_ANNOUNCER; @@ -145,8 +142,7 @@ void PDPSimple::initializeParticipantProxyData( } #endif // if HAVE_SECURITY } - else if (!getRTPSParticipant()->getAttributes().builtin.discovery_config. - use_STATIC_EndpointDiscoveryProtocol) + else if (!discovery_config.use_STATIC_EndpointDiscoveryProtocol) { EPROSIMA_LOG_ERROR(RTPS_PDP, "Neither EDP simple nor EDP static enabled. Endpoints will not be discovered."); } @@ -332,7 +328,7 @@ bool PDPSimple::createPDPEndpoints() bool PDPSimple::create_dcps_participant_endpoints() { - const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->get_attributes(); const RTPSParticipantAllocationAttributes& allocation = pattr.allocation; const BuiltinAttributes& builtin_att = mp_builtin->m_att; auto endpoints = dynamic_cast(builtin_endpoints_.get()); @@ -468,7 +464,7 @@ bool PDPSimple::create_dcps_participant_endpoints() #if HAVE_SECURITY bool PDPSimple::create_dcps_participant_secure_endpoints() { - const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->get_attributes(); const RTPSParticipantAllocationAttributes& allocation = pattr.allocation; const BuiltinAttributes& builtin_att = mp_builtin->m_att; auto endpoints = dynamic_cast(builtin_endpoints_.get()); @@ -632,7 +628,7 @@ void PDPSimple::match_pdp_remote_endpoints( auto endpoints = static_cast(builtin_endpoints_.get()); const NetworkFactory& network = mp_RTPSParticipant->network_factory(); - bool use_multicast_locators = !mp_RTPSParticipant->getAttributes().builtin.avoid_builtin_multicast || + bool use_multicast_locators = !mp_RTPSParticipant->get_attributes().builtin.avoid_builtin_multicast || pdata.metatraffic_locators.unicast.empty(); const uint32_t endp = pdata.m_availableBuiltinEndpoints; diff --git a/src/cpp/rtps/builtin/liveliness/WLP.cpp b/src/cpp/rtps/builtin/liveliness/WLP.cpp index 0fbf9d803d..6599afc7be 100644 --- a/src/cpp/rtps/builtin/liveliness/WLP.cpp +++ b/src/cpp/rtps/builtin/liveliness/WLP.cpp @@ -108,14 +108,14 @@ WLP::WLP( , mp_builtinReaderSecureHistory(nullptr) #endif // if HAVE_SECURITY , temp_reader_proxy_data_( - p->mp_participantImpl->getRTPSParticipantAttributes().allocation.locators.max_unicast_locators, - p->mp_participantImpl->getRTPSParticipantAttributes().allocation.locators.max_multicast_locators, - p->mp_participantImpl->getRTPSParticipantAttributes().allocation.data_limits, - p->mp_participantImpl->getRTPSParticipantAttributes().allocation.content_filter) + p->mp_participantImpl->get_attributes().allocation.locators.max_unicast_locators, + p->mp_participantImpl->get_attributes().allocation.locators.max_multicast_locators, + p->mp_participantImpl->get_attributes().allocation.data_limits, + p->mp_participantImpl->get_attributes().allocation.content_filter) , temp_writer_proxy_data_( - p->mp_participantImpl->getRTPSParticipantAttributes().allocation.locators.max_unicast_locators, - p->mp_participantImpl->getRTPSParticipantAttributes().allocation.locators.max_multicast_locators, - p->mp_participantImpl->getRTPSParticipantAttributes().allocation.data_limits) + p->mp_participantImpl->get_attributes().allocation.locators.max_unicast_locators, + p->mp_participantImpl->get_attributes().allocation.locators.max_multicast_locators, + p->mp_participantImpl->get_attributes().allocation.data_limits) { GUID_t tmp_guid = p->mp_participantImpl->getGuid(); tmp_guid.entityId = 0; @@ -236,7 +236,7 @@ bool WLP::initWL( bool WLP::createEndpoints() { - const RTPSParticipantAttributes& pattr = mp_participant->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = mp_participant->get_attributes(); const ResourceLimitedContainerConfig& participants_allocation = pattr.allocation.participants; // Built-in writer history @@ -335,7 +335,7 @@ bool WLP::createEndpoints() bool WLP::createSecureEndpoints() { - const RTPSParticipantAttributes& pattr = mp_participant->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = mp_participant->get_attributes(); const ResourceLimitedContainerConfig& participants_allocation = pattr.allocation.participants; //CREATE WRITER @@ -485,7 +485,7 @@ bool WLP::assignRemoteEndpoints( const NetworkFactory& network = mp_participant->network_factory(); uint32_t endp = pdata.m_availableBuiltinEndpoints; uint32_t auxendp = endp; - bool use_multicast_locators = !mp_participant->getAttributes().builtin.avoid_builtin_multicast || + bool use_multicast_locators = !mp_participant->get_attributes().builtin.avoid_builtin_multicast || pdata.metatraffic_locators.unicast.empty(); std::lock_guard data_guard(temp_data_lock_); diff --git a/src/cpp/rtps/flowcontrol/FlowControllerFactory.cpp b/src/cpp/rtps/flowcontrol/FlowControllerFactory.cpp index c92b4de796..d195bc5b44 100644 --- a/src/cpp/rtps/flowcontrol/FlowControllerFactory.cpp +++ b/src/cpp/rtps/flowcontrol/FlowControllerFactory.cpp @@ -15,7 +15,7 @@ void FlowControllerFactory::init( const ThreadSettings& sender_thread_settings = (nullptr == participant_) ? ThreadSettings{} - : participant_->getAttributes().builtin_controllers_sender_thread; + : participant_->get_attributes().builtin_controllers_sender_thread; // PureSyncFlowController -> used by volatile besteffort writers. flow_controllers_.insert(decltype(flow_controllers_)::value_type( diff --git a/src/cpp/rtps/flowcontrol/FlowControllerImpl.hpp b/src/cpp/rtps/flowcontrol/FlowControllerImpl.hpp index b913c43f5d..4f607dc8ad 100644 --- a/src/cpp/rtps/flowcontrol/FlowControllerImpl.hpp +++ b/src/cpp/rtps/flowcontrol/FlowControllerImpl.hpp @@ -942,7 +942,7 @@ class FlowControllerImpl : public FlowController { if (nullptr != participant) { - participant_id_ = static_cast(participant->getRTPSParticipantAttributes().participantID); + participant_id_ = static_cast(participant->get_attributes().participantID); } uint32_t limitation = get_max_payload(); diff --git a/src/cpp/rtps/participant/RTPSParticipant.cpp b/src/cpp/rtps/participant/RTPSParticipant.cpp index d4de419fe9..469cfc99f9 100644 --- a/src/cpp/rtps/participant/RTPSParticipant.cpp +++ b/src/cpp/rtps/participant/RTPSParticipant.cpp @@ -120,9 +120,9 @@ std::vector RTPSParticipant::getParticipantNames() const return mp_impl->getParticipantNames(); } -const RTPSParticipantAttributes& RTPSParticipant::getRTPSParticipantAttributes() const +RTPSParticipantAttributes RTPSParticipant::get_attributes() const { - return mp_impl->getRTPSParticipantAttributes(); + return mp_impl->get_attributes(); } uint32_t RTPSParticipant::getMaxMessageSize() const diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index 01c76cf30d..4727494c5b 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -3161,6 +3161,11 @@ dds::utils::TypePropagation RTPSParticipantImpl::type_propagation() const return dds::utils::to_type_propagation(m_att.properties); } +RTPSParticipantAttributes RTPSParticipantImpl::get_attributes() const +{ + return m_att; +} + } /* namespace rtps */ } /* namespace fastdds */ } /* namespace eprosima */ diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.h b/src/cpp/rtps/participant/RTPSParticipantImpl.h index df40991d2c..d033708604 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.h +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.h @@ -706,7 +706,7 @@ class RTPSParticipantImpl void normalize_endpoint_locators( EndpointAttributes& endpoint_att); - //!Participant Mutex + //! Participant Mutex mutable std::mutex mutex_; //!Will this participant use intraprocess only? @@ -795,10 +795,7 @@ class RTPSParticipantImpl public: - const RTPSParticipantAttributes& getRTPSParticipantAttributes() const - { - return this->m_att; - } + RTPSParticipantAttributes get_attributes() const; /** * Create a Writer in this RTPSParticipant. @@ -945,15 +942,6 @@ class RTPSParticipantImpl const fastdds::dds::ReaderQos& rqos, const ContentFilterProperty* content_filter = nullptr); - /** - * Get the participant attributes - * @return Participant attributes - */ - inline RTPSParticipantAttributes& getAttributes() - { - return m_att; - } - /** * Delete a user endpoint * @param Endpoint to delete diff --git a/src/cpp/rtps/reader/BaseReader.cpp b/src/cpp/rtps/reader/BaseReader.cpp index 6ecacb5ee9..072044b5eb 100644 --- a/src/cpp/rtps/reader/BaseReader.cpp +++ b/src/cpp/rtps/reader/BaseReader.cpp @@ -128,7 +128,7 @@ BaseReader::~BaseReader() bool BaseReader::matched_writer_add( const PublicationBuiltinTopicData& info) { - const auto& alloc = mp_RTPSParticipant->getRTPSParticipantAttributes().allocation; + const auto& alloc = mp_RTPSParticipant->get_attributes().allocation; WriterProxyData wdata( alloc.locators.max_unicast_locators, alloc.locators.max_multicast_locators, diff --git a/src/cpp/rtps/reader/StatefulReader.cpp b/src/cpp/rtps/reader/StatefulReader.cpp index 512b20d55b..f11dff7548 100644 --- a/src/cpp/rtps/reader/StatefulReader.cpp +++ b/src/cpp/rtps/reader/StatefulReader.cpp @@ -191,7 +191,7 @@ void StatefulReader::init( RTPSParticipantImpl* pimpl, const ReaderAttributes& att) { - const RTPSParticipantAttributes& part_att = pimpl->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& part_att = pimpl->get_attributes(); for (size_t n = 0; n < att.matched_writers_allocation.initial; ++n) { matched_writers_pool_.push_back(new WriterProxy(this, part_att.allocation.locators, proxy_changes_config_)); @@ -267,7 +267,7 @@ bool StatefulReader::matched_writer_add_edp( size_t max_readers = matched_writers_pool_.max_size(); if (getMatchedWritersSize() + matched_writers_pool_.size() < max_readers) { - const RTPSParticipantAttributes& part_att = mp_RTPSParticipant->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& part_att = mp_RTPSParticipant->get_attributes(); wp = new WriterProxy(this, part_att.allocation.locators, proxy_changes_config_); } else diff --git a/src/cpp/rtps/security/SecurityManager.cpp b/src/cpp/rtps/security/SecurityManager.cpp index bf5a4c87d7..85ed635ae7 100644 --- a/src/cpp/rtps/security/SecurityManager.cpp +++ b/src/cpp/rtps/security/SecurityManager.cpp @@ -96,14 +96,14 @@ SecurityManager::SecurityManager( , auth_last_sequence_number_(1) , crypto_last_sequence_number_(1) , temp_reader_proxies_({ - participant->getRTPSParticipantAttributes().allocation.locators.max_unicast_locators, - participant->getRTPSParticipantAttributes().allocation.locators.max_multicast_locators, - participant->getRTPSParticipantAttributes().allocation.data_limits, - participant->getRTPSParticipantAttributes().allocation.content_filter}) + participant->get_attributes().allocation.locators.max_unicast_locators, + participant->get_attributes().allocation.locators.max_multicast_locators, + participant->get_attributes().allocation.data_limits, + participant->get_attributes().allocation.content_filter}) , temp_writer_proxies_({ - participant->getRTPSParticipantAttributes().allocation.locators.max_unicast_locators, - participant->getRTPSParticipantAttributes().allocation.locators.max_multicast_locators, - participant->getRTPSParticipantAttributes().allocation.data_limits}) + participant->get_attributes().allocation.locators.max_unicast_locators, + participant->get_attributes().allocation.locators.max_multicast_locators, + participant->get_attributes().allocation.data_limits}) { assert(participant != nullptr); static OpenSSLInit openssl_init; @@ -122,8 +122,9 @@ bool SecurityManager::init( { SecurityException exception; domain_id_ = participant_->get_domain_id(); + auto part_attributes = participant_->get_attributes(); const PropertyPolicy log_properties = PropertyPolicyHelper::get_properties_with_prefix( - participant_->getRTPSParticipantAttributes().properties, + part_attributes.properties, "dds.sec.log.builtin.DDS_LogTopic."); // length(log_properties) == 0 considered as logging disable. @@ -212,7 +213,7 @@ bool SecurityManager::init( { // retrieve authentication properties, if any const PropertyPolicy auth_handshake_properties = PropertyPolicyHelper::get_properties_with_prefix( - participant_->getRTPSParticipantAttributes().properties, + part_attributes.properties, "dds.sec.auth.builtin.PKI-DH."); // if auth_handshake_properties is empty, the default values are used @@ -232,7 +233,7 @@ bool SecurityManager::init( ret = authentication_plugin_->validate_local_identity(&local_identity_handle_, adjusted_participant_key, domain_id_, - participant_->getRTPSParticipantAttributes(), + part_attributes, participant_->getGuid(), exception); } while (ret == VALIDATION_PENDING_RETRY && usleep_bool()); @@ -254,7 +255,7 @@ bool SecurityManager::init( local_permissions_handle_ = access_plugin_->validate_local_permissions( *authentication_plugin_, *local_identity_handle_, domain_id_, - participant_->getRTPSParticipantAttributes(), + part_attributes, exception); if (local_permissions_handle_ != nullptr) @@ -263,7 +264,7 @@ bool SecurityManager::init( { if (access_plugin_->check_create_participant(*local_permissions_handle_, domain_id_, - participant_->getRTPSParticipantAttributes(), exception)) + part_attributes, exception)) { // Set credentials. PermissionsCredentialToken* token = nullptr; @@ -1107,7 +1108,7 @@ bool SecurityManager::create_participant_stateless_message_writer() participant_stateless_message_writer_hattr_, participant_stateless_message_pool_); - const RTPSParticipantAttributes& pattr = participant_->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = participant_->get_attributes(); WriterAttributes watt; watt.endpoint.external_unicast_locators = pattr.builtin.metatraffic_external_unicast_locators; @@ -1156,7 +1157,7 @@ bool SecurityManager::create_participant_stateless_message_reader() { participant_stateless_message_reader_history_ = new ReaderHistory(participant_stateless_message_reader_hattr_); - const RTPSParticipantAttributes& pattr = participant_->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = participant_->get_attributes(); ReaderAttributes ratt; ratt.endpoint.topicKind = NO_KEY; @@ -1256,7 +1257,7 @@ bool SecurityManager::create_participant_volatile_message_secure_writer() participant_volatile_message_secure_writer_history_ = new WriterHistory(participant_volatile_message_secure_hattr_, participant_volatile_message_secure_pool_); - const RTPSParticipantAttributes& pattr = participant_->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = participant_->get_attributes(); WriterAttributes watt; watt.endpoint.endpointKind = WRITER; @@ -1310,7 +1311,7 @@ bool SecurityManager::create_participant_volatile_message_secure_reader() participant_volatile_message_secure_reader_history_ = new ReaderHistory(participant_volatile_message_secure_hattr_); - const RTPSParticipantAttributes& pattr = participant_->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& pattr = participant_->get_attributes(); ReaderAttributes ratt; ratt.endpoint.topicKind = NO_KEY; diff --git a/src/cpp/rtps/writer/BaseWriter.cpp b/src/cpp/rtps/writer/BaseWriter.cpp index 972d01b033..e80039d23f 100644 --- a/src/cpp/rtps/writer/BaseWriter.cpp +++ b/src/cpp/rtps/writer/BaseWriter.cpp @@ -117,7 +117,7 @@ BaseWriter::~BaseWriter() bool BaseWriter::matched_reader_add( const SubscriptionBuiltinTopicData& rqos) { - const auto& alloc = mp_RTPSParticipant->getRTPSParticipantAttributes().allocation; + const auto& alloc = mp_RTPSParticipant->get_attributes().allocation; ReaderProxyData rdata( alloc.locators.max_unicast_locators, alloc.locators.max_multicast_locators, diff --git a/src/cpp/rtps/writer/StatefulWriter.cpp b/src/cpp/rtps/writer/StatefulWriter.cpp index faee80b399..1d00e3efca 100644 --- a/src/cpp/rtps/writer/StatefulWriter.cpp +++ b/src/cpp/rtps/writer/StatefulWriter.cpp @@ -209,7 +209,7 @@ void StatefulWriter::init( RTPSParticipantImpl* pimpl, const WriterAttributes& att) { - const RTPSParticipantAttributes& part_att = pimpl->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& part_att = pimpl->get_attributes(); auto push_mode = PropertyPolicyHelper::find_property(att.endpoint.properties, "fastdds.push_mode"); push_mode_ = !((nullptr != push_mode) && ("false" == *push_mode)); @@ -1018,7 +1018,7 @@ bool StatefulWriter::matched_reader_add_edp( size_t max_readers = matched_readers_pool_.max_size(); if (get_matched_readers_size() + matched_readers_pool_.size() < max_readers) { - const RTPSParticipantAttributes& part_att = mp_RTPSParticipant->getRTPSParticipantAttributes(); + const RTPSParticipantAttributes& part_att = mp_RTPSParticipant->get_attributes(); rp = new ReaderProxy(times_, part_att.allocation.locators, this); } else diff --git a/src/cpp/rtps/writer/StatelessWriter.cpp b/src/cpp/rtps/writer/StatelessWriter.cpp index 68cde3ae3a..23475e902f 100644 --- a/src/cpp/rtps/writer/StatelessWriter.cpp +++ b/src/cpp/rtps/writer/StatelessWriter.cpp @@ -172,7 +172,7 @@ void StatelessWriter::init( get_builtin_guid(); const RemoteLocatorsAllocationAttributes& loc_alloc = - participant->getRTPSParticipantAttributes().allocation.locators; + participant->get_attributes().allocation.locators; for (size_t i = 0; i < attributes.matched_readers_allocation.initial; ++i) { @@ -493,7 +493,7 @@ bool StatelessWriter::matched_reader_add_edp( if (get_matched_readers_size() + matched_readers_pool_.size() < max_readers) { const RemoteLocatorsAllocationAttributes& loc_alloc = - mp_RTPSParticipant->getRTPSParticipantAttributes().allocation.locators; + mp_RTPSParticipant->get_attributes().allocation.locators; new_reader.reset(new ReaderLocator( this, diff --git a/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.hpp b/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.hpp index 3e0451358a..de9c23133f 100644 --- a/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.hpp +++ b/test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.hpp @@ -227,7 +227,7 @@ class FASTDDS_EXPORTED_API RTPSParticipant return {}; } - const RTPSParticipantAttributes& getRTPSParticipantAttributes() + RTPSParticipantAttributes get_attributes() const { return attributes_; } diff --git a/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h b/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h index e4e8d25cc6..172bf310e4 100644 --- a/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h +++ b/test/mock/rtps/RTPSParticipantImpl/rtps/participant/RTPSParticipantImpl.h @@ -166,8 +166,6 @@ class RTPSParticipantImpl const EntityId_t& entityId, bool isBuiltin, bool enable)); // *INDENT-ON* - MOCK_CONST_METHOD0(getParticipantMutex, std::recursive_mutex* ()); - bool createWriter( RTPSWriter** writer, WriterAttributes& param, @@ -179,10 +177,7 @@ class RTPSParticipantImpl bool ret = createWriter_mock(writer, param, hist, listen, entityId, isBuiltin); if (*writer != nullptr) { - (*writer)->history_ = hist; - auto guid = generate_endpoint_guid(); - (*writer)->m_guid = guid; endpoints_.emplace(guid, *writer); } return ret; @@ -200,10 +195,7 @@ class RTPSParticipantImpl bool ret = createWriter_mock(writer, param, hist, listen, entityId, isBuiltin); if (*writer != nullptr) { - (*writer)->history_ = hist; - auto guid = generate_endpoint_guid(); - (*writer)->m_guid = guid; endpoints_.emplace(guid, *writer); } return ret; @@ -221,11 +213,7 @@ class RTPSParticipantImpl bool ret = createReader_mock(reader, param, hist, listen, entityId, isBuiltin, enable); if (*reader != nullptr) { - (*reader)->history_ = hist; - fastdds::rtps::BaseReader::downcast(*reader)->listener_ = listen; - auto guid = generate_endpoint_guid(); - (*reader)->m_guid = guid; endpoints_.emplace(guid, *reader); } return ret; @@ -244,11 +232,7 @@ class RTPSParticipantImpl bool ret = createReader_mock(reader, param, hist, listen, entityId, isBuiltin, enable); if (*reader != nullptr) { - (*reader)->history_ = hist; - fastdds::rtps::BaseReader::downcast(*reader)->listener_ = listen; - auto guid = generate_endpoint_guid(); - (*reader)->m_guid = guid; endpoints_.emplace(guid, *reader); } return ret; @@ -306,12 +290,7 @@ class RTPSParticipantImpl return 65536; } - const RTPSParticipantAttributes& getRTPSParticipantAttributes() const - { - return attr_; - } - - RTPSParticipantAttributes& getAttributes() + RTPSParticipantAttributes get_attributes() const { return attr_; } diff --git a/test/unittest/dds/participant/ParticipantTests.cpp b/test/unittest/dds/participant/ParticipantTests.cpp index e35f445c09..5a58add414 100644 --- a/test/unittest/dds/participant/ParticipantTests.cpp +++ b/test/unittest/dds/participant/ParticipantTests.cpp @@ -856,7 +856,7 @@ void get_rtps_attributes( ASSERT_NE(nullptr, participant_test); const DomainParticipantImpl* participant_impl = participant_test->get_impl(); ASSERT_NE(nullptr, participant_impl); - att = participant_impl->get_rtps_participant()->getRTPSParticipantAttributes(); + att = participant_impl->get_rtps_participant()->get_attributes(); } void helper_wait_for_at_least_entries( diff --git a/test/unittest/rtps/flowcontrol/CMakeLists.txt b/test/unittest/rtps/flowcontrol/CMakeLists.txt index b8ec2af547..3397a938ff 100644 --- a/test/unittest/rtps/flowcontrol/CMakeLists.txt +++ b/test/unittest/rtps/flowcontrol/CMakeLists.txt @@ -50,6 +50,7 @@ target_include_directories(FlowControllerFactoryTests PRIVATE ${Asio_INCLUDE_DIR} ${PROJECT_SOURCE_DIR}/test/mock/rtps/RTPSWriter ${PROJECT_SOURCE_DIR}/test/mock/rtps/RTPSMessageGroup + ${PROJECT_SOURCE_DIR}/test/mock/rtps/RTPSParticipantImpl ${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include ${PROJECT_SOURCE_DIR}/src/cpp ) @@ -85,6 +86,7 @@ target_include_directories(FlowControllerPublishModesTests PRIVATE ${Asio_INCLUDE_DIR} ${PROJECT_SOURCE_DIR}/test/mock/rtps/RTPSWriter ${PROJECT_SOURCE_DIR}/test/mock/rtps/RTPSMessageGroup + ${PROJECT_SOURCE_DIR}/test/mock/rtps/RTPSParticipantImpl ${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include ${PROJECT_SOURCE_DIR}/src/cpp ) @@ -116,6 +118,7 @@ target_include_directories(FlowControllerSchedulersTests PRIVATE ${Asio_INCLUDE_DIR} ${PROJECT_SOURCE_DIR}/test/mock/rtps/RTPSWriter ${PROJECT_SOURCE_DIR}/test/mock/rtps/RTPSMessageGroup + ${PROJECT_SOURCE_DIR}/test/mock/rtps/RTPSParticipantImpl ${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include ${PROJECT_SOURCE_DIR}/src/cpp )