15 #ifndef RCLCPP__EXECUTORS__STATIC_EXECUTOR_ENTITIES_COLLECTOR_HPP_
16 #define RCLCPP__EXECUTORS__STATIC_EXECUTOR_ENTITIES_COLLECTOR_HPP_
27 #include "rclcpp/experimental/executable_list.hpp"
28 #include "rclcpp/macros.hpp"
29 #include "rclcpp/memory_strategy.hpp"
30 #include "rclcpp/visibility_control.hpp"
31 #include "rclcpp/waitable.hpp"
37 typedef std::map<rclcpp::CallbackGroup::WeakPtr,
38 rclcpp::node_interfaces::NodeBaseInterface::WeakPtr,
39 std::owner_less<rclcpp::CallbackGroup::WeakPtr>> WeakCallbackGroupsToNodesMap;
43 public std::enable_shared_from_this<StaticExecutorEntitiesCollector>
66 rclcpp::memory_strategy::MemoryStrategy::SharedPtr memory_strategy);
80 execute(std::shared_ptr<void> & data)
override;
99 refresh_wait_set(std::chrono::nanoseconds timeout = std::chrono::nanoseconds(-1));
119 rclcpp::CallbackGroup::SharedPtr group_ptr,
120 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr);
130 rclcpp::CallbackGroup::SharedPtr group_ptr,
131 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr,
132 WeakCallbackGroupsToNodesMap & weak_groups_to_nodes);
141 rclcpp::CallbackGroup::SharedPtr group_ptr);
150 rclcpp::CallbackGroup::SharedPtr group_ptr,
151 WeakCallbackGroupsToNodesMap & weak_groups_to_nodes);
160 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr);
169 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr);
172 std::vector<rclcpp::CallbackGroup::WeakPtr>
173 get_all_callback_groups();
180 std::vector<rclcpp::CallbackGroup::WeakPtr>
188 std::vector<rclcpp::CallbackGroup::WeakPtr>
247 rclcpp::SubscriptionBase::SharedPtr
256 rclcpp::TimerBase::SharedPtr
265 rclcpp::ServiceBase::SharedPtr
274 rclcpp::ClientBase::SharedPtr
283 rclcpp::Waitable::SharedPtr
295 fill_executable_list();
298 fill_memory_strategy();
308 const rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr,
309 const WeakCallbackGroupsToNodesMap & weak_groups_to_nodes)
const;
318 add_callback_groups_from_nodes_associated_to_executor();
321 fill_executable_list_from_map(
const WeakCallbackGroupsToNodesMap & weak_groups_to_nodes);
324 rclcpp::memory_strategy::MemoryStrategy::SharedPtr memory_strategy_;
327 WeakCallbackGroupsToNodesMap weak_groups_associated_with_executor_to_nodes_;
329 WeakCallbackGroupsToNodesMap weak_groups_to_nodes_associated_with_executor_;
331 typedef std::map<rclcpp::node_interfaces::NodeBaseInterface::WeakPtr,
333 std::owner_less<rclcpp::node_interfaces::NodeBaseInterface::WeakPtr>>
334 WeakNodesToGuardConditionsMap;
335 WeakNodesToGuardConditionsMap weak_nodes_to_guard_conditions_;
338 std::list<rclcpp::node_interfaces::NodeBaseInterface::WeakPtr> weak_nodes_;
341 std::mutex new_nodes_mutex_;
342 std::vector<rclcpp::node_interfaces::NodeBaseInterface::WeakPtr> new_nodes_;
351 bool initialized_ =
false;
A condition that can be waited on in a single wait set and asynchronously triggered.
RCLCPP_PUBLIC std::vector< rclcpp::CallbackGroup::WeakPtr > get_automatically_added_callback_groups_from_nodes()
Get callback groups that belong to executor.
RCLCPP_PUBLIC std::vector< rclcpp::CallbackGroup::WeakPtr > get_manually_added_callback_groups()
Get callback groups that belong to executor.
RCLCPP_PUBLIC bool remove_callback_group_from_map(rclcpp::CallbackGroup::SharedPtr group_ptr, WeakCallbackGroupsToNodesMap &weak_groups_to_nodes)
Remove a callback group from the executor.
RCLCPP_PUBLIC std::shared_ptr< void > take_data() override
Take the data so that it can be consumed with execute.
RCLCPP_PUBLIC rclcpp::ClientBase::SharedPtr get_client(size_t i)
RCLCPP_PUBLIC void refresh_wait_set(std::chrono::nanoseconds timeout=std::chrono::nanoseconds(-1))
Function to add_handles_to_wait_set and wait for work and.
RCLCPP_PUBLIC size_t get_number_of_clients()
Return number of clients.
RCLCPP_PUBLIC rclcpp::Waitable::SharedPtr get_waitable(size_t i)
RCLCPP_PUBLIC size_t get_number_of_subscriptions()
Return number of subscriptions.
RCLCPP_PUBLIC size_t get_number_of_ready_guard_conditions() override
Get the number of ready guard_conditions.
RCLCPP_PUBLIC bool add_callback_group(rclcpp::CallbackGroup::SharedPtr group_ptr, rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr)
Add a callback group to an executor.
RCLCPP_PUBLIC rclcpp::ServiceBase::SharedPtr get_service(size_t i)
RCLCPP_PUBLIC bool is_ready(rcl_wait_set_t *wait_set) override
Complete all available queued work without blocking.
RCLCPP_PUBLIC size_t get_number_of_timers()
Return number of timers.
RCLCPP_PUBLIC bool remove_callback_group(rclcpp::CallbackGroup::SharedPtr group_ptr)
Remove a callback group from the executor.
RCLCPP_PUBLIC size_t get_number_of_waitables()
Return number of waitables.
RCLCPP_PUBLIC size_t get_number_of_services()
Return number of services.
RCLCPP_PUBLIC bool is_init()
Finalize StaticExecutorEntitiesCollector to clear resources.
RCLCPP_PUBLIC void add_to_wait_set(rcl_wait_set_t *wait_set) override
RCLCPP_PUBLIC rclcpp::TimerBase::SharedPtr get_timer(size_t i)
RCLCPP_PUBLIC void init(rcl_wait_set_t *p_wait_set, rclcpp::memory_strategy::MemoryStrategy::SharedPtr memory_strategy)
Initialize StaticExecutorEntitiesCollector.
RCLCPP_PUBLIC bool add_node(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr)
RCLCPP_PUBLIC void execute(std::shared_ptr< void > &data) override
Execute the waitable.
RCLCPP_PUBLIC bool remove_node(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr)
RCLCPP_PUBLIC rclcpp::SubscriptionBase::SharedPtr get_subscription(size_t i)
This class contains subscriptionbase, timerbase, etc. which can be used to run callbacks.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
Container for subscription's, guard condition's, etc to be waited on.