Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Fix OSX and MSbuild warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Emerson Knapp <eknapp@amazon.com>
  • Loading branch information
Emerson Knapp committed May 3, 2019
1 parent fa97d23 commit 883ba2e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

class ConnextPublisherListener;

extern "C"
{
struct ConnextStaticPublisherInfo : ConnextCustomEventInfo
{
DDS::Publisher * dds_publisher_;
Expand All @@ -55,7 +53,6 @@ struct ConnextStaticPublisherInfo : ConnextCustomEventInfo
*/
DDS::Entity * get_entity() override;
};
} // extern "C"

class ConnextPublisherListener : public DDS::PublisherListener
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

class ConnextSubscriberListener;

extern "C"
{
struct ConnextStaticSubscriberInfo : ConnextCustomEventInfo
{
DDS::Subscriber * dds_subscriber_;
Expand All @@ -52,7 +50,6 @@ struct ConnextStaticSubscriberInfo : ConnextCustomEventInfo
*/
DDS::Entity * get_entity() override;
};
} // extern "C"

class ConnextSubscriberListener : public DDS::SubscriberListener
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
#ifndef RMW_CONNEXT_SHARED_CPP__CONNEXT_STATIC_EVENT_INFO_HPP_
#define RMW_CONNEXT_SHARED_CPP__CONNEXT_STATIC_EVENT_INFO_HPP_

#include "ndds/ndds_cpp.h"
#include "ndds/ndds_namespace_cpp.h"

#include "rmw/ret_types.h"

#include "rmw_connext_shared_cpp/ndds_include.hpp"

typedef struct ConnextCustomEventInfo
{
virtual ~ConnextCustomEventInfo() = default;

/// Get the corresponding rmw status given the status mask.
/**
* Return the corresponding RMW status given the input DDS_StatusMask and its corresponding event.
Expand Down
34 changes: 22 additions & 12 deletions rmw_connext_shared_cpp/src/qos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@
namespace
{

bool
is_time_default(const rmw_time_t & time)
{
return time.sec == 0 && time.nsec == 0;
}

DDS_Duration_t
rmw_time_to_dds(const rmw_time_t & time)
{
DDS_Duration_t duration;
duration.sec = static_cast<DDS_Long>(time.sec);
duration.nanosec = static_cast<DDS_UnsignedLong>(time.nsec);
return duration;
}

template<typename DDSEntityQos>
bool
set_entity_qos_from_profile_generic(
Expand Down Expand Up @@ -71,10 +86,9 @@ set_entity_qos_from_profile_generic(
entity_qos.history.depth = static_cast<DDS::Long>(qos_profile.depth);
}

// DDS_DeadlineQosPolicy has default value of DDS_DURATION_INFINITE, don't touch it for 0
if (qos_profile.deadline.sec != 0 || qos_profile.deadline.nsec != 0) {
entity_qos.deadline.period.sec = qos_profile.deadline.sec;
entity_qos.deadline.period.nanosec = qos_profile.deadline.nsec;
// DDS_DeadlineQosPolicy has default value of DDS_DURATION_INFINITE, don't overwrite if default passed
if (!is_time_default(qos_profile.deadline)) {
entity_qos.deadline.period = rmw_time_to_dds(qos_profile.deadline);
}

switch (qos_profile.liveliness) {
Expand All @@ -93,11 +107,8 @@ set_entity_qos_from_profile_generic(
RMW_SET_ERROR_MSG("Unknown QoS liveliness policy");
return false;
}
if (qos_profile.liveliness_lease_duration.sec != 0 ||
qos_profile.liveliness_lease_duration.nsec != 0)
{
entity_qos.liveliness.lease_duration.sec = qos_profile.liveliness_lease_duration.sec;
entity_qos.liveliness.lease_duration.nanosec = qos_profile.liveliness_lease_duration.nsec;
if (!is_time_default(qos_profile.liveliness_lease_duration)) {
entity_qos.liveliness.lease_duration = rmw_time_to_dds(qos_profile.liveliness_lease_duration);
}

// ensure the history depth is at least the requested queue size
Expand Down Expand Up @@ -131,9 +142,8 @@ set_entity_qos_from_profile(
DDS::DataWriterQos & entity_qos)
{
// Set any QoS settings that are specific to DataWriter, then call the shared version
if (qos_profile.lifespan.sec != 0 || qos_profile.lifespan.nsec != 0) {
entity_qos.lifespan.duration.sec = qos_profile.lifespan.sec;
entity_qos.lifespan.duration.nanosec = qos_profile.lifespan.nsec;
if (!is_time_default(qos_profile.lifespan)) {
entity_qos.lifespan.duration = rmw_time_to_dds(qos_profile.lifespan);
}
return set_entity_qos_from_profile_generic(qos_profile, entity_qos);
}
Expand Down

0 comments on commit 883ba2e

Please sign in to comment.