Skip to content
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
5 changes: 4 additions & 1 deletion rclcpp_async/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ if(NOT CMAKE_CXX_STANDARD)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror=deprecated-declarations -fcoroutines)
add_compile_options(-Wall -Wextra -Wpedantic -Werror=deprecated-declarations)
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
add_compile_options(-fcoroutines)
endif()

find_package(ament_cmake REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion rclcpp_async/include/rclcpp_async/co_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class CoContext
{
auto stream = std::make_shared<TopicStream<MsgT>>(*this);
stream->sub_ = node_.template create_subscription<MsgT>(
topic, qos, [s = stream](typename MsgT::SharedPtr msg) {
topic, qos, [s = stream](std::shared_ptr<const MsgT> msg) {
if (s->closed_) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions rclcpp_async/include/rclcpp_async/topic_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ template <typename MsgT>
class TopicStream
{
CoContext & ctx_;
std::queue<typename MsgT::SharedPtr> queue_;
std::queue<std::shared_ptr<const MsgT>> queue_;
std::coroutine_handle<> waiter_;
typename rclcpp::Subscription<MsgT>::SharedPtr sub_;
bool closed_ = false;
Expand All @@ -49,7 +49,7 @@ class TopicStream

struct NextAwaiter
{
using SharedPtr = typename MsgT::SharedPtr;
using SharedPtr = std::shared_ptr<const MsgT>;

TopicStream & stream;
std::stop_token token;
Expand Down
7 changes: 5 additions & 2 deletions rclcpp_async_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ if(NOT CMAKE_CXX_STANDARD)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror=deprecated-declarations -fcoroutines)
add_compile_options(-Wall -Wextra -Wpedantic -Werror=deprecated-declarations)
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
add_compile_options(-fcoroutines)
endif()

find_package(ament_cmake REQUIRED)
Expand Down Expand Up @@ -40,7 +43,7 @@ target_link_libraries(nested_demo rclcpp_async::rclcpp_async
add_library(component_demo SHARED src/component_demo.cpp)
target_link_libraries(component_demo rclcpp_async::rclcpp_async
${std_msgs_TARGETS} ${std_srvs_TARGETS})
ament_target_dependencies(component_demo rclcpp_components)
target_link_libraries(component_demo rclcpp_components::component)
rclcpp_components_register_node(component_demo
PLUGIN "rclcpp_async_example::ComponentDemo"
EXECUTABLE component_demo_node)
Expand Down
Loading