Skip to content

Commit

Permalink
Refs #21313: Rename RTPSParticipant attr getter to get_attributes
Browse files Browse the repository at this point in the history
Signed-off-by: eduponz <eduardoponz@eprosima.com>
  • Loading branch information
EduPonz committed Jul 20, 2024
1 parent c8cb4da commit 89fb2ff
Show file tree
Hide file tree
Showing 30 changed files with 125 additions and 145 deletions.
2 changes: 1 addition & 1 deletion include/fastdds/rtps/participant/RTPSParticipant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/fastdds/domain/DomainParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/BuiltinProtocols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down
42 changes: 26 additions & 16 deletions src/cpp/rtps/builtin/discovery/participant/PDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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())
{
Expand All @@ -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);

Expand All @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand All @@ -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);

Expand Down
26 changes: 10 additions & 16 deletions src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

Expand Down Expand Up @@ -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);
Expand Down
16 changes: 9 additions & 7 deletions src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>(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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -337,7 +337,7 @@ bool PDPServer::create_ds_pdp_reliable_endpoints(
bool secure)
{
static_cast<void>(secure);
const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->getRTPSParticipantAttributes();
const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->get_attributes();

/***********************************
* PDP READER
Expand Down Expand Up @@ -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");
Expand All @@ -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))
{
Expand All @@ -549,7 +551,7 @@ void PDPServer::match_reliable_pdp_endpoints(
auto endpoints = static_cast<fastdds::rtps::DiscoveryServerPDPEndpoints*>(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 89fb2ff

Please sign in to comment.