Skip to content

Commit

Permalink
Refs #21095: Move namespace to fastdds
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Dominguez <[email protected]>
  • Loading branch information
Mario-DL committed Jun 20, 2024
1 parent 5320856 commit 4ccf71c
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 47 deletions.
16 changes: 8 additions & 8 deletions examples/cpp/discovery_server/ClientPublisherApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ ClientPublisherApp::ClientPublisherApp(

// Create DS locator
eprosima::fastdds::rtps::Locator server_locator;
eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(server_locator, server_port);
eprosima::fastdds::rtps::IPLocator::setPhysicalPort(server_locator, server_port);

std::shared_ptr<eprosima::fastdds::rtps::TransportDescriptorInterface> descriptor;

Expand All @@ -97,7 +97,7 @@ ClientPublisherApp::ClientPublisherApp(
descriptor = descriptor_tmp;

server_locator.kind = LOCATOR_KIND_UDPv4;
eprosima::fastrtps::rtps::IPLocator::setIPv4(server_locator, ip_server_address);
eprosima::fastdds::rtps::IPLocator::setIPv4(server_locator, ip_server_address);
break;
}

Expand All @@ -108,7 +108,7 @@ ClientPublisherApp::ClientPublisherApp(
descriptor = descriptor_tmp;

server_locator.kind = LOCATOR_KIND_UDPv6;
eprosima::fastrtps::rtps::IPLocator::setIPv6(server_locator, ip_server_address);
eprosima::fastdds::rtps::IPLocator::setIPv6(server_locator, ip_server_address);
break;
}

Expand All @@ -119,8 +119,8 @@ ClientPublisherApp::ClientPublisherApp(
descriptor = descriptor_tmp;

server_locator.kind = LOCATOR_KIND_TCPv4;
eprosima::fastrtps::rtps::IPLocator::setLogicalPort(server_locator, server_port);
eprosima::fastrtps::rtps::IPLocator::setIPv4(server_locator, ip_server_address);
eprosima::fastdds::rtps::IPLocator::setLogicalPort(server_locator, server_port);
eprosima::fastdds::rtps::IPLocator::setIPv4(server_locator, ip_server_address);
break;
}

Expand All @@ -131,8 +131,8 @@ ClientPublisherApp::ClientPublisherApp(
descriptor = descriptor_tmp;

server_locator.kind = LOCATOR_KIND_TCPv6;
eprosima::fastrtps::rtps::IPLocator::setLogicalPort(server_locator, server_port);
eprosima::fastrtps::rtps::IPLocator::setIPv6(server_locator, ip_server_address);
eprosima::fastdds::rtps::IPLocator::setLogicalPort(server_locator, server_port);
eprosima::fastdds::rtps::IPLocator::setIPv6(server_locator, ip_server_address);
break;
}

Expand All @@ -142,7 +142,7 @@ ClientPublisherApp::ClientPublisherApp(

// Set participant as DS CLIENT
pqos.wire_protocol().builtin.discovery_config.discoveryProtocol =
eprosima::fastrtps::rtps::DiscoveryProtocol_t::CLIENT;
eprosima::fastdds::rtps::DiscoveryProtocol::CLIENT;

// Add remote SERVER to CLIENT's list of SERVERs
pqos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.push_back(server_locator);
Expand Down
16 changes: 8 additions & 8 deletions examples/cpp/discovery_server/ClientSubscriberApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ClientSubscriberApp::ClientSubscriberApp(

// Create DS SERVER locator
eprosima::fastdds::rtps::Locator server_locator;
eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(server_locator, server_port);
eprosima::fastdds::rtps::IPLocator::setPhysicalPort(server_locator, server_port);

std::shared_ptr<eprosima::fastdds::rtps::TransportDescriptorInterface> descriptor;

Expand All @@ -95,7 +95,7 @@ ClientSubscriberApp::ClientSubscriberApp(
descriptor = descriptor_tmp;

server_locator.kind = LOCATOR_KIND_UDPv4;
eprosima::fastrtps::rtps::IPLocator::setIPv4(server_locator, ip_server_address);
eprosima::fastdds::rtps::IPLocator::setIPv4(server_locator, ip_server_address);
break;
}

Expand All @@ -106,7 +106,7 @@ ClientSubscriberApp::ClientSubscriberApp(
descriptor = descriptor_tmp;

server_locator.kind = LOCATOR_KIND_UDPv6;
eprosima::fastrtps::rtps::IPLocator::setIPv6(server_locator, ip_server_address);
eprosima::fastdds::rtps::IPLocator::setIPv6(server_locator, ip_server_address);
break;
}

Expand All @@ -119,8 +119,8 @@ ClientSubscriberApp::ClientSubscriberApp(
descriptor = descriptor_tmp;

server_locator.kind = LOCATOR_KIND_TCPv4;
eprosima::fastrtps::rtps::IPLocator::setLogicalPort(server_locator, server_port);
eprosima::fastrtps::rtps::IPLocator::setIPv4(server_locator, ip_server_address);
eprosima::fastdds::rtps::IPLocator::setLogicalPort(server_locator, server_port);
eprosima::fastdds::rtps::IPLocator::setIPv4(server_locator, ip_server_address);
break;
}

Expand All @@ -133,8 +133,8 @@ ClientSubscriberApp::ClientSubscriberApp(
descriptor = descriptor_tmp;

server_locator.kind = LOCATOR_KIND_TCPv6;
eprosima::fastrtps::rtps::IPLocator::setLogicalPort(server_locator, server_port);
eprosima::fastrtps::rtps::IPLocator::setIPv6(server_locator, ip_server_address);
eprosima::fastdds::rtps::IPLocator::setLogicalPort(server_locator, server_port);
eprosima::fastdds::rtps::IPLocator::setIPv6(server_locator, ip_server_address);
break;
}

Expand All @@ -144,7 +144,7 @@ ClientSubscriberApp::ClientSubscriberApp(

// Set participant as DS CLIENT
pqos.wire_protocol().builtin.discovery_config.discoveryProtocol =
eprosima::fastrtps::rtps::DiscoveryProtocol_t::CLIENT;
eprosima::fastdds::rtps::DiscoveryProtocol::CLIENT;

// Add remote SERVER to CLIENT's list of SERVERs
pqos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.push_back(server_locator);
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/discovery_server/HelloWorldPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include "HelloWorldCdrAux.hpp"
#include "HelloWorldTypeObjectSupport.hpp"

using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t;
using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t;
using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t;
using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t;
using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t;

HelloWorldPubSubType::HelloWorldPubSubType()
Expand Down
8 changes: 4 additions & 4 deletions examples/cpp/discovery_server/HelloWorldPubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType

eProsima_user_DllExport bool serialize(
void* data,
eprosima::fastrtps::rtps::SerializedPayload_t* payload) override
eprosima::fastdds::rtps::SerializedPayload_t* payload) override
{
return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION);
}

eProsima_user_DllExport bool serialize(
void* data,
eprosima::fastrtps::rtps::SerializedPayload_t* payload,
eprosima::fastdds::rtps::SerializedPayload_t* payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;

eProsima_user_DllExport bool deserialize(
eprosima::fastrtps::rtps::SerializedPayload_t* payload,
eprosima::fastdds::rtps::SerializedPayload_t* payload,
void* data) override;

eProsima_user_DllExport std::function<uint32_t()> getSerializedSizeProvider(
Expand All @@ -80,7 +80,7 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType

eProsima_user_DllExport bool getKey(
void* data,
eprosima::fastrtps::rtps::InstanceHandle_t* ihandle,
eprosima::fastdds::rtps::InstanceHandle_t* ihandle,
bool force_md5 = false) override;

eProsima_user_DllExport void* createData() override;
Expand Down
10 changes: 5 additions & 5 deletions examples/cpp/discovery_server/Helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,31 @@ enum class TransportKind : uint8_t
SHM,
};

inline eprosima::fastrtps::rtps::GuidPrefix_t get_discovery_server_guid_from_id(
inline eprosima::fastdds::rtps::GuidPrefix_t get_discovery_server_guid_from_id(
unsigned short id)
{
eprosima::fastrtps::rtps::GuidPrefix_t result;
eprosima::fastdds::rtps::GuidPrefix_t result;

// Get default DS guid and modify the one value expected to be changed
std::istringstream(eprosima::fastdds::rtps::DEFAULT_ROS2_SERVER_GUIDPREFIX) >> result;
result.value[2] =
static_cast<eprosima::fastrtps::rtps::octet>(id); // This is done like this in Fast
static_cast<eprosima::fastdds::rtps::octet>(id); // This is done like this in Fast

return result;
}

inline bool is_ip(
const std::string ip_str)
{
return eprosima::fastrtps::rtps::IPLocator::isIPv4(ip_str) || eprosima::fastrtps::rtps::IPLocator::isIPv6(ip_str);
return eprosima::fastdds::rtps::IPLocator::isIPv4(ip_str) || eprosima::fastdds::rtps::IPLocator::isIPv6(ip_str);
}

inline std::string get_ip_from_dns(
const std::string& domain_name,
TransportKind kind)
{
std::pair<std::set<std::string>, std::set<std::string>> dns_response =
eprosima::fastrtps::rtps::IPLocator::resolveNameDNS(domain_name);
eprosima::fastdds::rtps::IPLocator::resolveNameDNS(domain_name);

if (kind == TransportKind::UDPv4 || kind == TransportKind::TCPv4)
{
Expand Down
38 changes: 19 additions & 19 deletions examples/cpp/discovery_server/ServerApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ ServerApp::ServerApp(
// Create DS SERVER locator
eprosima::fastdds::rtps::Locator listening_locator;
eprosima::fastdds::rtps::Locator connection_locator;
eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(listening_locator, config.listening_port);
eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(connection_locator, config.connection_port);
eprosima::fastdds::rtps::IPLocator::setPhysicalPort(listening_locator, config.listening_port);
eprosima::fastdds::rtps::IPLocator::setPhysicalPort(connection_locator, config.connection_port);

std::shared_ptr<eprosima::fastdds::rtps::TransportDescriptorInterface> descriptor;

Expand All @@ -99,9 +99,9 @@ ServerApp::ServerApp(
descriptor = descriptor_tmp;

listening_locator.kind = LOCATOR_KIND_UDPv4;
eprosima::fastrtps::rtps::IPLocator::setIPv4(listening_locator, ip_listening_address);
eprosima::fastdds::rtps::IPLocator::setIPv4(listening_locator, ip_listening_address);
connection_locator.kind = LOCATOR_KIND_UDPv4;
eprosima::fastrtps::rtps::IPLocator::setIPv4(connection_locator, ip_connection_address);
eprosima::fastdds::rtps::IPLocator::setIPv4(connection_locator, ip_connection_address);
break;
}

Expand All @@ -111,9 +111,9 @@ ServerApp::ServerApp(
descriptor = descriptor_tmp;

listening_locator.kind = LOCATOR_KIND_UDPv6;
eprosima::fastrtps::rtps::IPLocator::setIPv6(listening_locator, ip_listening_address);
eprosima::fastdds::rtps::IPLocator::setIPv6(listening_locator, ip_listening_address);
connection_locator.kind = LOCATOR_KIND_UDPv6;
eprosima::fastrtps::rtps::IPLocator::setIPv6(connection_locator, ip_connection_address);
eprosima::fastdds::rtps::IPLocator::setIPv6(connection_locator, ip_connection_address);
break;
}

Expand All @@ -124,11 +124,11 @@ ServerApp::ServerApp(
descriptor = descriptor_tmp;

listening_locator.kind = LOCATOR_KIND_TCPv4;
eprosima::fastrtps::rtps::IPLocator::setLogicalPort(listening_locator, config.listening_port);
eprosima::fastrtps::rtps::IPLocator::setIPv4(listening_locator, ip_listening_address);
eprosima::fastdds::rtps::IPLocator::setLogicalPort(listening_locator, config.listening_port);
eprosima::fastdds::rtps::IPLocator::setIPv4(listening_locator, ip_listening_address);
connection_locator.kind = LOCATOR_KIND_TCPv4;
eprosima::fastrtps::rtps::IPLocator::setIPv4(connection_locator, ip_connection_address);
eprosima::fastrtps::rtps::IPLocator::setLogicalPort(connection_locator, config.connection_port);
eprosima::fastdds::rtps::IPLocator::setIPv4(connection_locator, ip_connection_address);
eprosima::fastdds::rtps::IPLocator::setLogicalPort(connection_locator, config.connection_port);
break;
}

Expand All @@ -139,11 +139,11 @@ ServerApp::ServerApp(
descriptor = descriptor_tmp;

listening_locator.kind = LOCATOR_KIND_TCPv6;
eprosima::fastrtps::rtps::IPLocator::setLogicalPort(listening_locator, config.listening_port);
eprosima::fastrtps::rtps::IPLocator::setIPv6(listening_locator, ip_listening_address);
eprosima::fastdds::rtps::IPLocator::setLogicalPort(listening_locator, config.listening_port);
eprosima::fastdds::rtps::IPLocator::setIPv6(listening_locator, ip_listening_address);
connection_locator.kind = LOCATOR_KIND_TCPv6;
eprosima::fastrtps::rtps::IPLocator::setIPv6(connection_locator, ip_connection_address);
eprosima::fastrtps::rtps::IPLocator::setLogicalPort(connection_locator, config.connection_port);
eprosima::fastdds::rtps::IPLocator::setIPv6(connection_locator, ip_connection_address);
eprosima::fastdds::rtps::IPLocator::setLogicalPort(connection_locator, config.connection_port);
break;
}

Expand All @@ -156,7 +156,7 @@ ServerApp::ServerApp(

// Set participant as SERVER
pqos.wire_protocol().builtin.discovery_config.discoveryProtocol =
eprosima::fastrtps::rtps::DiscoveryProtocol_t::SERVER;
eprosima::fastdds::rtps::DiscoveryProtocol::SERVER;

// Set SERVER's listening locator for PDP
pqos.wire_protocol().builtin.metatrafficUnicastLocatorList.push_back(listening_locator);
Expand Down Expand Up @@ -210,17 +210,17 @@ ServerApp::~ServerApp()

void ServerApp::on_participant_discovery(
DomainParticipant*,
fastrtps::rtps::ParticipantDiscoveryInfo&& info,
fastdds::rtps::ParticipantDiscoveryInfo&& info,
bool& should_be_ignored)
{
static_cast<void>(should_be_ignored);
if (info.status == eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT)
if (info.status == eprosima::fastdds::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT)
{
std::cout << "Discovered Participant with GUID " << info.info.m_guid << std::endl;
++matched_;
}
else if (info.status == eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT ||
info.status == eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT)
else if (info.status == eprosima::fastdds::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT ||
info.status == eprosima::fastdds::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT)
{
std::cout << "Dropped Participant with GUID " << info.info.m_guid << std::endl;
--matched_;
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/discovery_server/ServerApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ServerApp : public Application, public DomainParticipantListener
//! Publisher matched method
void on_participant_discovery(
DomainParticipant* participant,
fastrtps::rtps::ParticipantDiscoveryInfo&& info,
fastdds::rtps::ParticipantDiscoveryInfo&& info,
bool& should_be_ignored) override;

//! Run publisher
Expand Down

0 comments on commit 4ccf71c

Please sign in to comment.