File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,7 +8,10 @@ if(NOT CMAKE_CXX_STANDARD)
88endif ()
99
1010if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
11- add_compile_options (-Wall -Wextra -Wpedantic -Werror=deprecated-declarations -fcoroutines )
11+ add_compile_options (-Wall -Wextra -Wpedantic -Werror=deprecated-declarations )
12+ endif ()
13+ if (CMAKE_COMPILER_IS_GNUCXX)
14+ add_compile_options (-fcoroutines )
1215endif ()
1316
1417find_package (ament_cmake REQUIRED )
Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ class CoContext
186186 {
187187 auto stream = std::make_shared<TopicStream<MsgT>>(*this );
188188 stream->sub_ = node_.template create_subscription <MsgT>(
189- topic, qos, [s = stream](typename MsgT::SharedPtr msg) {
189+ topic, qos, [s = stream](std::shared_ptr< const MsgT> msg) {
190190 if (s->closed_ ) {
191191 return ;
192192 }
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ template <typename MsgT>
3737class TopicStream
3838{
3939 CoContext & ctx_;
40- std::queue<typename MsgT::SharedPtr > queue_;
40+ std::queue<std::shared_ptr< const MsgT> > queue_;
4141 std::coroutine_handle<> waiter_;
4242 typename rclcpp::Subscription<MsgT>::SharedPtr sub_;
4343 bool closed_ = false ;
@@ -49,7 +49,7 @@ class TopicStream
4949
5050 struct NextAwaiter
5151 {
52- using SharedPtr = typename MsgT::SharedPtr ;
52+ using SharedPtr = std::shared_ptr< const MsgT> ;
5353
5454 TopicStream & stream;
5555 std::stop_token token;
Original file line number Diff line number Diff line change @@ -8,7 +8,10 @@ if(NOT CMAKE_CXX_STANDARD)
88endif ()
99
1010if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
11- add_compile_options (-Wall -Wextra -Wpedantic -Werror=deprecated-declarations -fcoroutines )
11+ add_compile_options (-Wall -Wextra -Wpedantic -Werror=deprecated-declarations )
12+ endif ()
13+ if (CMAKE_COMPILER_IS_GNUCXX)
14+ add_compile_options (-fcoroutines )
1215endif ()
1316
1417find_package (ament_cmake REQUIRED )
@@ -40,7 +43,7 @@ target_link_libraries(nested_demo rclcpp_async::rclcpp_async
4043add_library (component_demo SHARED src/component_demo.cpp )
4144target_link_libraries (component_demo rclcpp_async::rclcpp_async
4245 ${std_msgs_TARGETS} ${std_srvs_TARGETS} )
43- ament_target_dependencies (component_demo rclcpp_components )
46+ target_link_libraries (component_demo rclcpp_components::component )
4447rclcpp_components_register_node (component_demo
4548 PLUGIN "rclcpp_async_example::ComponentDemo"
4649 EXECUTABLE component_demo_node )
You can’t perform that action at this time.
0 commit comments