Skip to content

Commit

Permalink
Fixes that came out of macOS. (#20)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored Dec 22, 2021
1 parent 6b87087 commit bc5b40a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
5 changes: 5 additions & 0 deletions rclcpp/include/rclcpp/any_subscription_callback.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,11 @@ class AnySubscriptionCallback
// Dispatch.
std::visit(
[&message, &message_info, this](auto && callback) {
// clang complains that 'this' lambda capture is unused, which is true
// in *some* specializations of this template, but not others. Just
// quiet it down.
(void)this;

using T = std::decay_t<decltype(callback)>;
static constexpr bool is_ta = rclcpp::TypeAdapter<MessageT>::is_specialized::value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ template<
class ROSMessageIntraProcessBuffer : public SubscriptionIntraProcessBase
{
public:
RCLCPP_SMART_PTR_DEFINITIONS(ROSMessageIntraProcessBuffer)

using ROSMessageTypeAllocatorTraits = allocator::AllocRebind<RosMessageT, Alloc>;
using ROSMessageTypeAllocator = typename ROSMessageTypeAllocatorTraits::allocator_type;
using ROSMessageTypeDeleter = allocator::Deleter<ROSMessageTypeAllocator, RosMessageT>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class SubscriptionIntraProcessBuffer : public ROSMessageIntraProcessBuffer<ROSMe
}

void
provide_intra_process_message(ConstMessageSharedPtr message)
provide_intra_process_message(ConstMessageSharedPtr message) override
{
if constexpr (std::is_same<SubscribedType, ROSMessageType>::value) {
buffer_->add_shared(std::move(message));
Expand All @@ -127,7 +127,7 @@ class SubscriptionIntraProcessBuffer : public ROSMessageIntraProcessBuffer<ROSMe
}

void
provide_intra_process_message(MessageUniquePtr message)
provide_intra_process_message(MessageUniquePtr message) override
{
if constexpr (std::is_same<SubscribedType, ROSMessageType>::value) {
buffer_->add_unique(std::move(message));
Expand Down
18 changes: 12 additions & 6 deletions rclcpp/test/rclcpp/test_intra_process_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#define RCLCPP_BUILDING_LIBRARY 1
#include "rclcpp/allocator/allocator_common.hpp"
#include "rclcpp/context.hpp"
#include "rclcpp/macros.hpp"
#include "rclcpp/qos.hpp"
#include "rmw/types.h"
Expand Down Expand Up @@ -194,9 +195,14 @@ class SubscriptionIntraProcessBase
public:
RCLCPP_SMART_PTR_ALIASES_ONLY(SubscriptionIntraProcessBase)

explicit SubscriptionIntraProcessBase(rclcpp::QoS qos = rclcpp::QoS(10))
: qos_profile(qos), topic_name("topic")
{}
explicit SubscriptionIntraProcessBase(
rclcpp::Context::SharedPtr context,
const std::string & topic = "topic",
rclcpp::QoS qos = rclcpp::QoS(10))
: qos_profile(qos), topic_name(topic)
{
(void)context;
}

virtual ~SubscriptionIntraProcessBase() {}

Expand All @@ -212,11 +218,11 @@ class SubscriptionIntraProcessBase
const char *
get_topic_name()
{
return topic_name;
return topic_name.c_str();
}

rclcpp::QoS qos_profile;
const char * topic_name;
std::string topic_name;
};

template<
Expand All @@ -231,7 +237,7 @@ class SubscriptionIntraProcessBuffer : public SubscriptionIntraProcessBase
RCLCPP_SMART_PTR_DEFINITIONS(SubscriptionIntraProcessBuffer)

explicit SubscriptionIntraProcessBuffer(rclcpp::QoS qos)
: SubscriptionIntraProcessBase(qos), take_shared_method(false)
: SubscriptionIntraProcessBase(nullptr, "topic", qos), take_shared_method(false)
{
buffer = std::make_unique<rclcpp::experimental::buffers::mock::IntraProcessBuffer<MessageT>>();
}
Expand Down

0 comments on commit bc5b40a

Please sign in to comment.