Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21129] Migrate fastrtps namespace to fastdds #87

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ The *Fast DDS* XML schema was duly updated to accommodate the new Discovery Serv
- The participant profile ``<builtin>`` tag contains a ``<discovery_config>`` tag where all discovery-related info is
gathered. This new tag contains the following new XML child elements:
- ``<discoveryProtocol>``: specifies the discovery type through the ``DiscoveryProtocol_t`` enumeration.
- ``<discoveryProtocol>``: specifies the discovery type through the ``DiscoveryProtocol`` enumeration.
- ``<discoveryServersList>``: specifies the server or servers to which a Client/Server connects.
- ``<clientAnnouncementPeriod>``: specifies the time span between PDP metatraffic exchange.
Expand Down
4 changes: 2 additions & 2 deletions examples/HelloWorldExampleDS/HelloWorldPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include "HelloWorldPubSubTypes.h"
#include "HelloWorldCdrAux.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;


Expand Down
8 changes: 4 additions & 4 deletions examples/HelloWorldExampleDS/HelloWorldPubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,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 @@ -82,7 +82,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
12 changes: 5 additions & 7 deletions examples/HelloWorldExampleDS/HelloWorldPublisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@
#include <fastdds/dds/publisher/qos/DataWriterQos.hpp>
#include <fastdds/utils/IPLocator.h>

using namespace eprosima::fastdds;
using namespace eprosima::fastdds::rtps;
using namespace eprosima::fastdds::dds;
using namespace eprosima::fastrtps::rtps;
using namespace eprosima::fastdds::rtps;

HelloWorldPublisher::HelloWorldPublisher()
: mp_participant(nullptr)
Expand Down Expand Up @@ -96,9 +94,9 @@ bool HelloWorldPublisher::init(
participant_qos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.push_back(ratt);
}

participant_qos.wire_protocol().builtin.discovery_config.discoveryProtocol = DiscoveryProtocol_t::CLIENT;
participant_qos.wire_protocol().builtin.discovery_config.discoveryProtocol = DiscoveryProtocol::CLIENT;
participant_qos.wire_protocol().participant_id = 2;
participant_qos.wire_protocol().builtin.discovery_config.leaseDuration = eprosima::fastrtps::c_TimeInfinite;
participant_qos.wire_protocol().builtin.discovery_config.leaseDuration = eprosima::fastdds::c_TimeInfinite;
participant_qos.name("Participant_pub");

mp_participant = DomainParticipantFactory::get_instance()->create_participant(0, participant_qos);
Expand All @@ -115,7 +113,7 @@ bool HelloWorldPublisher::init(
TopicQos topic_qos = TOPIC_QOS_DEFAULT;

topic_qos.history().depth = 30;
topic_qos.history().kind = KEEP_LAST_HISTORY_QOS;
topic_qos.history().kind = eprosima::fastdds::KEEP_LAST_HISTORY_QOS;
topic_qos.resource_limits().max_samples = 50;
topic_qos.resource_limits().allocated_samples = 20;

Expand All @@ -124,7 +122,7 @@ bool HelloWorldPublisher::init(

datawriter_qos.reliable_writer_qos().times.heartbeatPeriod.seconds = 2;
datawriter_qos.reliable_writer_qos().times.heartbeatPeriod.nanosec = 0;
datawriter_qos.reliability().kind = RELIABLE_RELIABILITY_QOS;
datawriter_qos.reliability().kind = eprosima::fastdds::RELIABLE_RELIABILITY_QOS;

mp_publisher = mp_participant->create_publisher(publisher_qos);

Expand Down
7 changes: 2 additions & 5 deletions examples/HelloWorldExampleDS/HelloWorldServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#include <fastdds/rtps/transport/TCPv6TransportDescriptor.h>
#include <fastdds/utils/IPLocator.h>

using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;

using namespace eprosima::fastdds;
using namespace eprosima::fastdds::dds;
using namespace eprosima::fastdds::rtps;
Expand All @@ -43,9 +40,9 @@ bool HelloWorldServer::init(
Locator server_address)
{

eprosima::fastdds::dds::DomainParticipantQos participant_qos = eprosima::fastdds::dds::PARTICIPANT_QOS_DEFAULT;
DomainParticipantQos participant_qos = PARTICIPANT_QOS_DEFAULT;

participant_qos.wire_protocol().builtin.discovery_config.discoveryProtocol = DiscoveryProtocol_t::SERVER;
participant_qos.wire_protocol().builtin.discovery_config.discoveryProtocol = DiscoveryProtocol::SERVER;
std::istringstream iss("44.49.53.43.53.45.52.56.45.52.5F.31");
iss >> participant_qos.wire_protocol().prefix;
participant_qos.wire_protocol().builtin.discovery_config.leaseDuration = c_TimeInfinite;
Expand Down
12 changes: 5 additions & 7 deletions examples/HelloWorldExampleDS/HelloWorldSubscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
#include <fastdds/dds/subscriber/qos/DataReaderQos.hpp>
#include <fastdds/utils/IPLocator.h>

using namespace eprosima::fastdds;
using namespace eprosima::fastrtps::rtps;
using namespace eprosima::fastdds::rtps;
using namespace eprosima::fastdds::dds;

Expand Down Expand Up @@ -92,9 +90,9 @@ bool HelloWorldSubscriber::init(
participant_qos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.push_back(ratt);
}

participant_qos.wire_protocol().builtin.discovery_config.discoveryProtocol = DiscoveryProtocol_t::CLIENT;
participant_qos.wire_protocol().builtin.discovery_config.discoveryProtocol = DiscoveryProtocol::CLIENT;
participant_qos.wire_protocol().participant_id = 3;
participant_qos.wire_protocol().builtin.discovery_config.leaseDuration = eprosima::fastrtps::c_TimeInfinite;
participant_qos.wire_protocol().builtin.discovery_config.leaseDuration = eprosima::fastdds::c_TimeInfinite;
participant_qos.name("Participant_sub");

mp_participant = DomainParticipantFactory::get_instance()->create_participant(0, participant_qos);
Expand All @@ -111,15 +109,15 @@ bool HelloWorldSubscriber::init(
TopicQos topic_qos = TOPIC_QOS_DEFAULT;

topic_qos.history().depth = 30;
topic_qos.history().kind = KEEP_LAST_HISTORY_QOS;
topic_qos.history().kind = eprosima::fastdds::KEEP_LAST_HISTORY_QOS;
topic_qos.resource_limits().max_samples = 50;
topic_qos.resource_limits().allocated_samples = 20;

SubscriberQos subscriber_qos = SUBSCRIBER_QOS_DEFAULT;
DataReaderQos datareader_qos = DATAREADER_QOS_DEFAULT;

datareader_qos.reliability().kind = RELIABLE_RELIABILITY_QOS;
datareader_qos.durability().kind = TRANSIENT_LOCAL_DURABILITY_QOS;
datareader_qos.reliability().kind = eprosima::fastdds::RELIABLE_RELIABILITY_QOS;
datareader_qos.durability().kind = eprosima::fastdds::TRANSIENT_LOCAL_DURABILITY_QOS;

mp_subscriber = mp_participant->create_subscriber(subscriber_qos);

Expand Down
2 changes: 1 addition & 1 deletion examples/HelloWorldExampleDS/HelloWorld_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const option::Descriptor usage[] = {
/*static*/ const std::regex Arg::ipv4(R"(^((?:[0-9]{1,3}\.){3}[0-9]{1,3})?:?(?:(\d+))?$)");
/*static*/ const std::regex Arg::ipv6(R"(^\[?((?:[0-9a-fA-F]{0,4}\:){7}[0-9a-fA-F]{0,4})?(?:\]:)?(?:(\d+))?$)");

using namespace eprosima::fastrtps::rtps;
using namespace eprosima::fastdds::rtps;
using namespace eprosima::fastdds::dds;

int main(int argc, char** argv)
Expand Down
2 changes: 1 addition & 1 deletion include/DiscoveryItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class XMLDocument;
namespace eprosima {
namespace discovery_server {

typedef fastrtps::rtps::GUID_t GUID_t;
typedef fastdds::rtps::GUID_t GUID_t;

//! common discovery info
struct DiscoveryItem
Expand Down
8 changes: 3 additions & 5 deletions include/DiscoveryServerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@

#include "DiscoveryItem.h"

using namespace eprosima::fastrtps;
using namespace eprosima::fastdds;
using namespace eprosima::fastrtps::rtps;
using namespace eprosima::fastdds::rtps;
using namespace eprosima::fastdds::dds;

Expand All @@ -43,14 +41,14 @@ class XMLElement;
} // namespace tinyxml2

namespace eprosima {
namespace fastrtps {
namespace fastdds {
namespace rtps {

class PDP;
class BuiltinProtocols;

} // namespace rtps
} // namespace fastrtps
} // namespace fastdds

namespace discovery_server {

Expand Down Expand Up @@ -87,7 +85,7 @@ class DelayedParticipantCreation;
class DelayedParticipantDestruction;

class DiscoveryServerManager
: public eprosima::fastdds::dds::DomainParticipantListener // receive discovery callback information and
: public DomainParticipantListener // receive discovery callback information and
// subscriber lifeliness information

{
Expand Down
2 changes: 1 addition & 1 deletion include/LateJoiner.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
namespace eprosima {
namespace discovery_server {

using eprosima::fastrtps::rtps::GUID_t;
using eprosima::fastdds::rtps::GUID_t;

class DelayedParticipantDestruction;

Expand Down
4 changes: 2 additions & 2 deletions resources/static_types/HelloWorldPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include "HelloWorldPubSubTypes.h"
#include "HelloWorldCdrAux.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;


Expand Down
8 changes: 4 additions & 4 deletions resources/static_types/HelloWorldPubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,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 @@ -82,7 +82,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
8 changes: 4 additions & 4 deletions src/DiscoveryItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
return a_eResult; }
#endif // ifndef XMLCheckResult

using namespace eprosima::fastrtps;
using namespace eprosima::fastdds;
using namespace eprosima::discovery_server;

// basic discovery items operations
Expand Down Expand Up @@ -581,7 +581,7 @@ void DiscoveryItemDatabase::UpdateSubLiveliness(

// Retrieve the participant that owns this subscriber
GUID_t pguid(subs);
pguid.entityId = eprosima::fastrtps::rtps::c_EntityId_RTPSParticipant;
pguid.entityId = eprosima::fastdds::rtps::c_EntityId_RTPSParticipant;

if (image.find(pguid) == image.end())
{
Expand Down Expand Up @@ -962,8 +962,8 @@ void Snapshot::from_xml(
tinyxml2::XMLElement* pRoot)
{
using namespace tinyxml2;
using eprosima::fastrtps::rtps::GuidPrefix_t;
using eprosima::fastrtps::rtps::EntityId_t;
using eprosima::fastdds::rtps::GuidPrefix_t;
using eprosima::fastdds::rtps::EntityId_t;

if (pRoot != nullptr)
{
Expand Down
19 changes: 8 additions & 11 deletions src/DiscoveryServerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,12 @@
#include "LateJoiner.h"
#include "log/DSLog.h"

using namespace eprosima::fastrtps;
using namespace eprosima::fastdds;
using namespace eprosima::fastrtps::rtps;
using namespace eprosima::fastdds::rtps;
using namespace eprosima::discovery_server;

// non exported from Fast DDS (watch out they may be updated)
namespace eprosima {
namespace fastrtps {
namespace fastdds {
namespace DSxmlparser {
const char* PROFILES = "profiles";
const char* PROFILE_NAME = "profile_name";
Expand All @@ -50,7 +47,7 @@ const char* PUBLISHER = "publisher";
const char* SUBSCRIBER = "subscriber";
const char* TOPIC = "topic";
} // namespace DSxmlparser
} // namespace fastrtps
} // namespace fastdds
} // namespace eprosima

/*static members*/
Expand Down Expand Up @@ -923,7 +920,7 @@ void DiscoveryServerManager::loadServer(
// We define the PDP as external (when moved to fast library it would be SERVER)
DiscoverySettings& b = dpQOS.wire_protocol().builtin.discovery_config;
(void)b;
assert(b.discoveryProtocol == SERVER || b.discoveryProtocol == BACKUP);
assert(b.discoveryProtocol == eprosima::fastdds::rtps::DiscoveryProtocol::SERVER || b.discoveryProtocol == eprosima::fastdds::rtps::DiscoveryProtocol::BACKUP);

// Create the participant or the associated events
DelayedParticipantCreation event(creation_time, std::move(dpQOS), &DiscoveryServerManager::addServer);
Expand Down Expand Up @@ -1006,8 +1003,8 @@ void DiscoveryServerManager::loadClient(

// we must assert that DiscoveryProtocol is CLIENT

if (dpQOS.wire_protocol().builtin.discovery_config.discoveryProtocol != DiscoveryProtocol_t::CLIENT &&
dpQOS.wire_protocol().builtin.discovery_config.discoveryProtocol != DiscoveryProtocol_t::SUPER_CLIENT)
if (dpQOS.wire_protocol().builtin.discovery_config.discoveryProtocol != DiscoveryProtocol::CLIENT &&
dpQOS.wire_protocol().builtin.discovery_config.discoveryProtocol != DiscoveryProtocol::SUPER_CLIENT)
{
LOG_ERROR(
"DiscoveryServerManager::loadClient try to create a client with an incompatible profile: " <<
Expand Down Expand Up @@ -1279,7 +1276,7 @@ void DiscoveryServerManager::loadSimple(
}

// we must assert that DiscoveryProtocol is CLIENT
if (dpQOS.wire_protocol().builtin.discovery_config.discoveryProtocol != DiscoveryProtocol_t::SIMPLE)
if (dpQOS.wire_protocol().builtin.discovery_config.discoveryProtocol != DiscoveryProtocol::SIMPLE)
{
LOG_ERROR(
"DiscoveryServerManager::loadSimple try to create a simple participant with an incompatible profile: " <<
Expand Down Expand Up @@ -1402,7 +1399,7 @@ void DiscoveryServerManager::loadSubscriber(
TopicAttributes topicAttr;
if (topic_name != nullptr)
{
if (!eprosima::fastrtps::rtps::RTPSDomain::get_topic_attributes_from_profile(std::string(
if (!eprosima::fastdds::rtps::RTPSDomain::get_topic_attributes_from_profile(std::string(
topic_name), topicAttr))
{
LOG_ERROR("DiscoveryServerManager::loadSubscriber couldn't load topic profile ");
Expand Down Expand Up @@ -1505,7 +1502,7 @@ void DiscoveryServerManager::loadPublisher(
TopicAttributes topicAttr;
if (topic_name != nullptr)
{
if (!eprosima::fastrtps::rtps::RTPSDomain::get_topic_attributes_from_profile(std::string(
if (!eprosima::fastdds::rtps::RTPSDomain::get_topic_attributes_from_profile(std::string(
topic_name), topicAttr))
{
LOG_ERROR("DiscoveryServerManager::loadPublisher couldn't load topic profile ");
Expand Down
Loading