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

Adding namespaces #195

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/TypeSupport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ class TypeSupport : public eprosima::fastrtps::TopicDataType

bool deserializeROSmessage(eprosima::fastcdr::FastBuffer * data, void * ros_message);

bool serialize(void * data, SerializedPayload_t * payload);
bool serialize(void * data, eprosima::fastrtps::rtps::SerializedPayload_t * payload);

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

std::function<uint32_t()> getSerializedSizeProvider(void * data);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ void * TypeSupport<MembersType>::createData()

template<typename MembersType>
bool TypeSupport<MembersType>::serialize(
void * data, SerializedPayload_t * payload)
void * data, eprosima::fastrtps::rtps::SerializedPayload_t * payload)
{
assert(data);
assert(payload);
Expand All @@ -756,7 +756,7 @@ bool TypeSupport<MembersType>::serialize(
}

template<typename MembersType>
bool TypeSupport<MembersType>::deserialize(SerializedPayload_t * payload, void * data)
bool TypeSupport<MembersType>::deserialize(eprosima::fastrtps::rtps::SerializedPayload_t * payload, void * data)
{
assert(data);
assert(payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ClientListener : public eprosima::fastrtps::SubscriberListener
eprosima::fastrtps::SampleInfo_t sinfo;

if (sub->takeNextData(response.buffer_, &sinfo)) {
if (sinfo.sampleKind == ALIVE) {
if (sinfo.sampleKind == eprosima::fastrtps::rtps::ALIVE) {
response.sample_identity_ = sinfo.related_sample_identity;

if (info_->writer_guid_ == response.sample_identity_.writer_guid()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ typedef struct CustomParticipantInfo
class ParticipantListener : public eprosima::fastrtps::ParticipantListener
{
public:
void onParticipantDiscovery(Participant *, ParticipantDiscoveryInfo info) override
void onParticipantDiscovery(eprosima::fastrtps::Participant *, eprosima::fastrtps::ParticipantDiscoveryInfo info) override
{
if (
info.rtps.m_status != DISCOVERED_RTPSPARTICIPANT &&
info.rtps.m_status != REMOVED_RTPSPARTICIPANT &&
info.rtps.m_status != DROPPED_RTPSPARTICIPANT)
info.rtps.m_status != eprosima::fastrtps::rtps::DISCOVERED_RTPSPARTICIPANT &&
info.rtps.m_status != eprosima::fastrtps::rtps::REMOVED_RTPSPARTICIPANT &&
info.rtps.m_status != eprosima::fastrtps::rtps::DROPPED_RTPSPARTICIPANT)
{
return;
}

if (DISCOVERED_RTPSPARTICIPANT == info.rtps.m_status) {
if (eprosima::fastrtps::rtps::DISCOVERED_RTPSPARTICIPANT == info.rtps.m_status) {
// ignore already known GUIDs
if (discovered_names.find(info.rtps.m_guid) == discovered_names.end()) {
auto map = rmw::impl::cpp::parse_key_value(info.rtps.m_userData);
Expand Down Expand Up @@ -90,7 +90,7 @@ class ParticipantListener : public eprosima::fastrtps::ParticipantListener
return names;
}

std::map<GUID_t, std::string> discovered_names;
std::map<eprosima::fastrtps::rtps::GUID_t, std::string> discovered_names;
};

#endif // RMW_FASTRTPS_CPP__CUSTOM_PARTICIPANT_INFO_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ServiceListener : public eprosima::fastrtps::SubscriberListener
eprosima::fastrtps::SampleInfo_t sinfo;

if (sub->takeNextData(request.buffer_, &sinfo)) {
if (sinfo.sampleKind == ALIVE) {
if (sinfo.sampleKind == eprosima::fastrtps::rtps::ALIVE) {
request.sample_identity_ = sinfo.sample_identity;

std::lock_guard<std::mutex> lock(internalMutex_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class SubListener : public eprosima::fastrtps::SubscriberListener

void
onSubscriptionMatched(
eprosima::fastrtps::Subscriber * sub, eprosima::fastrtps::MatchingInfo & info)
eprosima::fastrtps::Subscriber * sub, eprosima::fastrtps::rtps::MatchingInfo & info)
{
(void)sub;
(void)info;
Expand Down
12 changes: 6 additions & 6 deletions rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/reader_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "fastrtps/rtps/reader/ReaderListener.h"
#include "fastrtps/rtps/reader/RTPSReader.h"

class ReaderInfo : public eprosima::fastrtps::ReaderListener
class ReaderInfo : public eprosima::fastrtps::rtps::ReaderListener
{
public:
ReaderInfo(
Expand All @@ -46,14 +46,14 @@ class ReaderInfo : public eprosima::fastrtps::ReaderListener
void
onNewCacheChangeAdded(
eprosima::fastrtps::rtps::RTPSReader *,
const eprosima::fastrtps::CacheChange_t * const change)
const eprosima::fastrtps::rtps::CacheChange_t * const change)
{
eprosima::fastrtps::rtps::ReaderProxyData proxyData;
if (change->kind == ALIVE) {
CDRMessage_t tempMsg(0);
if (change->kind == eprosima::fastrtps::rtps::ALIVE) {
eprosima::fastrtps::rtps::CDRMessage_t tempMsg(0);
tempMsg.wraps = true;
tempMsg.msg_endian = change->serializedPayload.encapsulation ==
PL_CDR_BE ? BIGEND : LITTLEEND;
PL_CDR_BE ? eprosima::fastrtps::rtps::BIGEND : eprosima::fastrtps::rtps::LITTLEEND;
tempMsg.length = change->serializedPayload.length;
tempMsg.max_size = change->serializedPayload.max_size;
tempMsg.buffer = change->serializedPayload.data;
Expand All @@ -77,7 +77,7 @@ class ReaderInfo : public eprosima::fastrtps::ReaderListener

bool trigger = false;
mapmutex.lock();
if (change->kind == ALIVE) {
if (change->kind == eprosima::fastrtps::rtps::ALIVE) {
topicNtypes[fqdn].push_back(proxyData.typeName());
trigger = true;
} else {
Expand Down
12 changes: 6 additions & 6 deletions rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/writer_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#include "rmw/rmw.h"

class WriterInfo : public eprosima::fastrtps::ReaderListener
class WriterInfo : public eprosima::fastrtps::rtps::ReaderListener
{
public:
WriterInfo(
Expand All @@ -44,14 +44,14 @@ class WriterInfo : public eprosima::fastrtps::ReaderListener
void
onNewCacheChangeAdded(
eprosima::fastrtps::rtps::RTPSReader *,
const eprosima::fastrtps::CacheChange_t * const change)
const eprosima::fastrtps::rtps::CacheChange_t * const change)
{
eprosima::fastrtps::rtps::WriterProxyData proxyData;
if (change->kind == ALIVE) {
eprosima::fastrtps::CDRMessage_t tempMsg(0);
if (change->kind == eprosima::fastrtps::rtps::ALIVE) {
eprosima::fastrtps::rtps::CDRMessage_t tempMsg(0);
tempMsg.wraps = true;
tempMsg.msg_endian = change->serializedPayload.encapsulation ==
PL_CDR_BE ? BIGEND : LITTLEEND;
PL_CDR_BE ? eprosima::fastrtps::rtps::BIGEND : eprosima::fastrtps::rtps::LITTLEEND;
tempMsg.length = change->serializedPayload.length;
tempMsg.max_size = change->serializedPayload.max_size;
tempMsg.buffer = change->serializedPayload.data;
Expand All @@ -75,7 +75,7 @@ class WriterInfo : public eprosima::fastrtps::ReaderListener

bool trigger = false;
mapmutex.lock();
if (change->kind == ALIVE) {
if (change->kind == eprosima::fastrtps::rtps::ALIVE) {
topicNtypes[fqdn].push_back(proxyData.typeName());
trigger = true;
} else {
Expand Down
36 changes: 18 additions & 18 deletions rmw_fastrtps_cpp/src/rmw_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ rmw_create_client(
return nullptr;
}

Participant * participant = impl->participant;
eprosima::fastrtps::Participant * participant = impl->participant;
if (!participant) {
RMW_SET_ERROR_MSG("participant handle is null");
return nullptr;
Expand All @@ -84,8 +84,8 @@ rmw_create_client(
}

CustomClientInfo * info = nullptr;
SubscriberAttributes subscriberParam;
PublisherAttributes publisherParam;
eprosima::fastrtps::SubscriberAttributes subscriberParam;
eprosima::fastrtps::PublisherAttributes publisherParam;
rmw_client_t * rmw_client = nullptr;

info = new CustomClientInfo();
Expand All @@ -105,25 +105,25 @@ rmw_create_client(
std::string response_type_name = _create_type_name(untyped_response_members, "srv",
info->typesupport_identifier_);

if (!Domain::getRegisteredType(participant, request_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->request_type_support_)))
if (!eprosima::fastrtps::Domain::getRegisteredType(participant, request_type_name.c_str(),
reinterpret_cast<eprosima::fastrtps::TopicDataType **>(&info->request_type_support_)))
{
info->request_type_support_ = _create_request_type_support(type_support->data,
info->typesupport_identifier_);
_register_type(participant, info->request_type_support_, info->typesupport_identifier_);
}

if (!Domain::getRegisteredType(participant, response_type_name.c_str(),
reinterpret_cast<TopicDataType **>(&info->response_type_support_)))
if (!eprosima::fastrtps::Domain::getRegisteredType(participant, response_type_name.c_str(),
reinterpret_cast<eprosima::fastrtps::TopicDataType **>(&info->response_type_support_)))
{
info->response_type_support_ = _create_response_type_support(type_support->data,
info->typesupport_identifier_);
_register_type(participant, info->response_type_support_, info->typesupport_identifier_);
}

subscriberParam.topic.topicKind = NO_KEY;
subscriberParam.topic.topicKind = eprosima::fastrtps::rtps::NO_KEY;
subscriberParam.topic.topicDataType = response_type_name;
subscriberParam.historyMemoryPolicy = PREALLOCATED_WITH_REALLOC_MEMORY_MODE;
subscriberParam.historyMemoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE;
rcutils_ret_t ret = _assign_partitions_to_attributes(
service_name, ros_service_response_prefix,
qos_policies->avoid_ros_namespace_conventions, &subscriberParam);
Expand All @@ -133,10 +133,10 @@ rmw_create_client(
}
subscriberParam.topic.topicName += "Reply";

publisherParam.topic.topicKind = NO_KEY;
publisherParam.topic.topicKind = eprosima::fastrtps::rtps::NO_KEY;
publisherParam.topic.topicDataType = request_type_name;
publisherParam.qos.m_publishMode.kind = ASYNCHRONOUS_PUBLISH_MODE;
publisherParam.historyMemoryPolicy = PREALLOCATED_WITH_REALLOC_MEMORY_MODE;
publisherParam.qos.m_publishMode.kind = eprosima::fastrtps::ASYNCHRONOUS_PUBLISH_MODE;
publisherParam.historyMemoryPolicy = eprosima::fastrtps::rtps::PREALLOCATED_WITH_REALLOC_MEMORY_MODE;
ret = _assign_partitions_to_attributes(
service_name, ros_service_requester_prefix,
qos_policies->avoid_ros_namespace_conventions, &publisherParam);
Expand Down Expand Up @@ -170,7 +170,7 @@ rmw_create_client(
}
info->listener_ = new ClientListener(info);
info->response_subscriber_ =
Domain::createSubscriber(participant, subscriberParam, info->listener_);
eprosima::fastrtps::Domain::createSubscriber(participant, subscriberParam, info->listener_);
if (!info->response_subscriber_) {
RMW_SET_ERROR_MSG("create_client() could not create subscriber");
goto fail;
Expand All @@ -182,7 +182,7 @@ rmw_create_client(
goto fail;
}
info->request_publisher_ =
Domain::createPublisher(participant, publisherParam, nullptr);
eprosima::fastrtps::Domain::createPublisher(participant, publisherParam, nullptr);
if (!info->request_publisher_) {
RMW_SET_ERROR_MSG("create_publisher() could not create publisher");
goto fail;
Expand Down Expand Up @@ -211,11 +211,11 @@ rmw_create_client(
fail:
if (info != nullptr) {
if (info->request_publisher_ != nullptr) {
Domain::removePublisher(info->request_publisher_);
eprosima::fastrtps::Domain::removePublisher(info->request_publisher_);
}

if (info->response_subscriber_ != nullptr) {
Domain::removeSubscriber(info->response_subscriber_);
eprosima::fastrtps::Domain::removeSubscriber(info->response_subscriber_);
}

if (info->listener_ != nullptr) {
Expand Down Expand Up @@ -267,10 +267,10 @@ rmw_destroy_client(rmw_node_t * node, rmw_client_t * client)
auto info = static_cast<CustomClientInfo *>(client->data);
if (info != nullptr) {
if (info->response_subscriber_ != nullptr) {
Domain::removeSubscriber(info->response_subscriber_);
eprosima::fastrtps::Domain::removeSubscriber(info->response_subscriber_);
}
if (info->request_publisher_ != nullptr) {
Domain::removePublisher(info->request_publisher_);
eprosima::fastrtps::Domain::removePublisher(info->request_publisher_);
}
if (info->listener_ != nullptr) {
delete info->listener_;
Expand Down
20 changes: 10 additions & 10 deletions rmw_fastrtps_cpp/src/rmw_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ rmw_node_t *
create_node(
const char * name,
const char * namespace_,
ParticipantAttributes participantAttrs)
eprosima::fastrtps::ParticipantAttributes participantAttrs)
{
if (!name) {
RMW_SET_ERROR_MSG("name is null");
Expand All @@ -66,13 +66,13 @@ create_node(

// Declare everything before beginning to create things.
::ParticipantListener * listener = nullptr;
Participant * participant = nullptr;
eprosima::fastrtps::Participant * participant = nullptr;
rmw_guard_condition_t * graph_guard_condition = nullptr;
CustomParticipantInfo * node_impl = nullptr;
rmw_node_t * node_handle = nullptr;
ReaderInfo * tnat_1 = nullptr;
WriterInfo * tnat_2 = nullptr;
std::pair<StatefulReader *, StatefulReader *> edp_readers;
std::pair<eprosima::fastrtps::rtps::StatefulReader *, eprosima::fastrtps::rtps::StatefulReader *> edp_readers;

try {
listener = new ::ParticipantListener();
Expand All @@ -81,7 +81,7 @@ create_node(
goto fail;
}

participant = Domain::createParticipant(participantAttrs, listener);
participant = eprosima::fastrtps::Domain::createParticipant(participantAttrs, listener);
if (!participant) {
RMW_SET_ERROR_MSG("create_node() could not create participant");
return nullptr;
Expand Down Expand Up @@ -172,7 +172,7 @@ create_node(
}
rmw_free(listener);
if (participant) {
Domain::removeParticipant(participant);
eprosima::fastrtps::Domain::removeParticipant(participant);
}
return nullptr;
}
Expand Down Expand Up @@ -222,10 +222,10 @@ rmw_create_node(
return nullptr;
}

ParticipantAttributes participantAttrs;
eprosima::fastrtps::ParticipantAttributes participantAttrs;

// Load default XML profile.
Domain::getDefaultParticipantAttributes(participantAttrs);
eprosima::fastrtps::Domain::getDefaultParticipantAttributes(participantAttrs);

participantAttrs.rtps.builtin.domainId = static_cast<uint32_t>(domain_id);
// since the participant name is not part of the DDS spec
Expand Down Expand Up @@ -297,10 +297,10 @@ rmw_destroy_node(rmw_node_t * node)
return RMW_RET_ERROR;
}

Participant * participant = impl->participant;
eprosima::fastrtps::Participant * participant = impl->participant;

// Begin deleting things in the same order they were created in rmw_create_node().
std::pair<StatefulReader *, StatefulReader *> edp_readers = participant->getEDPReaders();
std::pair<eprosima::fastrtps::rtps::StatefulReader *, eprosima::fastrtps::rtps::StatefulReader *> edp_readers = participant->getEDPReaders();
if (!edp_readers.first || !edp_readers.second) {
RMW_SET_ERROR_MSG("failed to get EDPReader listener");
result_ret = RMW_RET_ERROR;
Expand Down Expand Up @@ -328,7 +328,7 @@ rmw_destroy_node(rmw_node_t * node)
result_ret = RMW_RET_ERROR;
}

Domain::removeParticipant(participant);
eprosima::fastrtps::Domain::removeParticipant(participant);

delete impl->listener;
impl->listener = nullptr;
Expand Down
Loading