Skip to content

Commit 02e0d11

Browse files
committedDec 22, 2021
Fixes that came out of macOS. (#20)
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
1 parent 6b87087 commit 02e0d11

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed
 

‎rclcpp/include/rclcpp/any_subscription_callback.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,11 @@ class AnySubscriptionCallback
817817
// Dispatch.
818818
std::visit(
819819
[&message, &message_info, this](auto && callback) {
820+
// clang complains that 'this' lambda capture is unused, which is true
821+
// in *some* specializations of this template, but not others. Just
822+
// quiet it down.
823+
(void)this;
824+
820825
using T = std::decay_t<decltype(callback)>;
821826
static constexpr bool is_ta = rclcpp::TypeAdapter<MessageT>::is_specialized::value;
822827

‎rclcpp/include/rclcpp/experimental/ros_message_intra_process_buffer.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ template<
3838
class ROSMessageIntraProcessBuffer : public SubscriptionIntraProcessBase
3939
{
4040
public:
41-
RCLCPP_SMART_PTR_DEFINITIONS(ROSMessageIntraProcessBuffer)
42-
4341
using ROSMessageTypeAllocatorTraits = allocator::AllocRebind<RosMessageT, Alloc>;
4442
using ROSMessageTypeAllocator = typename ROSMessageTypeAllocatorTraits::allocator_type;
4543
using ROSMessageTypeDeleter = allocator::Deleter<ROSMessageTypeAllocator, RosMessageT>;

‎rclcpp/include/rclcpp/experimental/subscription_intra_process_buffer.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class SubscriptionIntraProcessBuffer : public ROSMessageIntraProcessBuffer<ROSMe
115115
}
116116

117117
void
118-
provide_intra_process_message(ConstMessageSharedPtr message)
118+
provide_intra_process_message(ConstMessageSharedPtr message) override
119119
{
120120
if constexpr (std::is_same<SubscribedType, ROSMessageType>::value) {
121121
buffer_->add_shared(std::move(message));
@@ -127,7 +127,7 @@ class SubscriptionIntraProcessBuffer : public ROSMessageIntraProcessBuffer<ROSMe
127127
}
128128

129129
void
130-
provide_intra_process_message(MessageUniquePtr message)
130+
provide_intra_process_message(MessageUniquePtr message) override
131131
{
132132
if constexpr (std::is_same<SubscribedType, ROSMessageType>::value) {
133133
buffer_->add_unique(std::move(message));

‎rclcpp/test/rclcpp/test_intra_process_manager.cpp

+12-6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#define RCLCPP_BUILDING_LIBRARY 1
2424
#include "rclcpp/allocator/allocator_common.hpp"
25+
#include "rclcpp/context.hpp"
2526
#include "rclcpp/macros.hpp"
2627
#include "rclcpp/qos.hpp"
2728
#include "rmw/types.h"
@@ -194,9 +195,14 @@ class SubscriptionIntraProcessBase
194195
public:
195196
RCLCPP_SMART_PTR_ALIASES_ONLY(SubscriptionIntraProcessBase)
196197

197-
explicit SubscriptionIntraProcessBase(rclcpp::QoS qos = rclcpp::QoS(10))
198-
: qos_profile(qos), topic_name("topic")
199-
{}
198+
explicit SubscriptionIntraProcessBase(
199+
rclcpp::Context::SharedPtr context,
200+
const std::string & topic = "topic",
201+
rclcpp::QoS qos = rclcpp::QoS(10))
202+
: qos_profile(qos), topic_name(topic)
203+
{
204+
(void)context;
205+
}
200206

201207
virtual ~SubscriptionIntraProcessBase() {}
202208

@@ -212,11 +218,11 @@ class SubscriptionIntraProcessBase
212218
const char *
213219
get_topic_name()
214220
{
215-
return topic_name;
221+
return topic_name.c_str();
216222
}
217223

218224
rclcpp::QoS qos_profile;
219-
const char * topic_name;
225+
std::string topic_name;
220226
};
221227

222228
template<
@@ -231,7 +237,7 @@ class SubscriptionIntraProcessBuffer : public SubscriptionIntraProcessBase
231237
RCLCPP_SMART_PTR_DEFINITIONS(SubscriptionIntraProcessBuffer)
232238

233239
explicit SubscriptionIntraProcessBuffer(rclcpp::QoS qos)
234-
: SubscriptionIntraProcessBase(qos), take_shared_method(false)
240+
: SubscriptionIntraProcessBase(nullptr, "topic", qos), take_shared_method(false)
235241
{
236242
buffer = std::make_unique<rclcpp::experimental::buffers::mock::IntraProcessBuffer<MessageT>>();
237243
}

0 commit comments

Comments
 (0)
Please sign in to comment.