rclcpp
master
C++ ROS Client Library API
|
Go to the documentation of this file.
15 #ifndef RCLCPP__CALLBACK_GROUP_HPP_
16 #define RCLCPP__CALLBACK_GROUP_HPP_
35 namespace node_interfaces
98 template<
typename Function>
99 rclcpp::SubscriptionBase::SharedPtr
102 return _find_ptrs_if_impl<rclcpp::SubscriptionBase, Function>(func,
subscription_ptrs_);
105 template<
typename Function>
106 rclcpp::TimerBase::SharedPtr
109 return _find_ptrs_if_impl<rclcpp::TimerBase, Function>(func,
timer_ptrs_);
112 template<
typename Function>
113 rclcpp::ServiceBase::SharedPtr
116 return _find_ptrs_if_impl<rclcpp::ServiceBase, Function>(func,
service_ptrs_);
119 template<
typename Function>
120 rclcpp::ClientBase::SharedPtr
123 return _find_ptrs_if_impl<rclcpp::ClientBase, Function>(func,
client_ptrs_);
126 template<
typename Function>
127 rclcpp::Waitable::SharedPtr
130 return _find_ptrs_if_impl<rclcpp::Waitable, Function>(func,
waitable_ptrs_);
171 add_publisher(
const rclcpp::PublisherBase::SharedPtr publisher_ptr);
175 add_subscription(
const rclcpp::SubscriptionBase::SharedPtr subscription_ptr);
179 add_timer(
const rclcpp::TimerBase::SharedPtr timer_ptr);
183 add_service(
const rclcpp::ServiceBase::SharedPtr service_ptr);
187 add_client(
const rclcpp::ClientBase::SharedPtr client_ptr);
191 add_waitable(
const rclcpp::Waitable::SharedPtr waitable_ptr);
195 remove_waitable(
const rclcpp::Waitable::SharedPtr waitable_ptr) noexcept;
210 template<
typename TypeT,
typename Function>
211 typename TypeT::SharedPtr _find_ptrs_if_impl(
215 for (
auto & weak_ptr : vect_ptrs) {
216 auto ref_ptr = weak_ptr.lock();
217 if (ref_ptr && func(ref_ptr)) {
221 return typename TypeT::SharedPtr();
227 #endif // RCLCPP__CALLBACK_GROUP_HPP_
void add_waitable(const rclcpp::Waitable::SharedPtr waitable_ptr)
std::vector< rclcpp::TimerBase::WeakPtr > timer_ptrs_
Definition: callback_group.hpp:202
bool automatically_add_to_executor_with_node() const
Return true if this callback group should be automatically added to an executor by the node.
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
std::vector< rclcpp::SubscriptionBase::WeakPtr > subscription_ptrs_
Definition: callback_group.hpp:201
void add_timer(const rclcpp::TimerBase::SharedPtr timer_ptr)
std::atomic_bool & get_associated_with_executor_atomic()
Return a reference to the 'associated with executor' atomic boolean.
rclcpp::SubscriptionBase::SharedPtr find_subscription_ptrs_if(Function func) const
Definition: callback_group.hpp:100
rclcpp::ClientBase::SharedPtr find_client_ptrs_if(Function func) const
Definition: callback_group.hpp:121
Implementation of the NodeTimers part of the Node API.
Definition: node_timers.hpp:31
const CallbackGroupType & type() const
std::vector< rclcpp::ClientBase::WeakPtr > client_ptrs_
Definition: callback_group.hpp:204
rclcpp::Waitable::SharedPtr find_waitable_ptrs_if(Function func) const
Definition: callback_group.hpp:128
CallbackGroupType
Definition: callback_group.hpp:43
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
CallbackGroupType type_
Definition: callback_group.hpp:197
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
std::mutex mutex_
Definition: callback_group.hpp:199
Implementation of the NodeTopics part of the Node API.
Definition: node_topics.hpp:37
CallbackGroup(CallbackGroupType group_type, bool automatically_add_to_executor_with_node=true)
Constructor for CallbackGroup.
rclcpp::ServiceBase::SharedPtr find_service_ptrs_if(Function func) const
Definition: callback_group.hpp:114
std::vector< rclcpp::Waitable::WeakPtr > waitable_ptrs_
Definition: callback_group.hpp:205
std::vector< rclcpp::ServiceBase::WeakPtr > service_ptrs_
Definition: callback_group.hpp:203
void add_client(const rclcpp::ClientBase::SharedPtr client_ptr)
void remove_waitable(const rclcpp::Waitable::SharedPtr waitable_ptr) noexcept
Implementation of the NodeServices part of the Node API.
Definition: node_services.hpp:34
void add_subscription(const rclcpp::SubscriptionBase::SharedPtr subscription_ptr)
rclcpp::TimerBase::SharedPtr find_timer_ptrs_if(Function func) const
Definition: callback_group.hpp:107
std::atomic_bool & can_be_taken_from()
void add_publisher(const rclcpp::PublisherBase::SharedPtr publisher_ptr)
Definition: callback_group.hpp:49
void add_service(const rclcpp::ServiceBase::SharedPtr service_ptr)
std::atomic_bool can_be_taken_from_
Definition: callback_group.hpp:206
const bool automatically_add_to_executor_with_node_
Definition: callback_group.hpp:207
Implementation of the NodeWaitables part of the Node API.
Definition: node_waitables.hpp:31
std::atomic_bool associated_with_executor_
Definition: callback_group.hpp:200