ROS 2 rclcpp + rcl - jazzy  jazzy
ROS 2 C++ Client Library with ROS Client Library
executable_list.hpp
1 // Copyright 2019 Nobleo Technology
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef RCLCPP__EXPERIMENTAL__EXECUTABLE_LIST_HPP_
16 #define RCLCPP__EXPERIMENTAL__EXECUTABLE_LIST_HPP_
17 
18 #include <vector>
19 
20 #include "rclcpp/client.hpp"
21 #include "rclcpp/service.hpp"
22 #include "rclcpp/subscription_base.hpp"
23 #include "rclcpp/timer.hpp"
24 #include "rclcpp/visibility_control.hpp"
25 #include "rclcpp/waitable.hpp"
26 
27 namespace rclcpp
28 {
29 namespace experimental
30 {
31 
33 class ExecutableList final
34 {
35 public:
36  RCLCPP_PUBLIC
38 
39  RCLCPP_PUBLIC
40  ~ExecutableList();
41 
42  RCLCPP_PUBLIC
43  void
44  clear();
45 
46  RCLCPP_PUBLIC
47  void
48  add_subscription(rclcpp::SubscriptionBase::SharedPtr subscription);
49 
50  RCLCPP_PUBLIC
51  void
52  add_timer(rclcpp::TimerBase::SharedPtr timer);
53 
54  RCLCPP_PUBLIC
55  void
56  add_service(rclcpp::ServiceBase::SharedPtr service);
57 
58  RCLCPP_PUBLIC
59  void
60  add_client(rclcpp::ClientBase::SharedPtr client);
61 
62  RCLCPP_PUBLIC
63  void
64  add_waitable(rclcpp::Waitable::SharedPtr waitable);
65 
66  // Vector containing the SubscriptionBase of all the subscriptions added to the executor.
67  std::vector<rclcpp::SubscriptionBase::SharedPtr> subscription;
68  // Contains the count of added subscriptions
69  size_t number_of_subscriptions;
70  // Vector containing the TimerBase of all the timers added to the executor.
71  std::vector<rclcpp::TimerBase::SharedPtr> timer;
72  // Contains the count of added timers
73  size_t number_of_timers;
74  // Vector containing the ServiceBase of all the services added to the executor.
75  std::vector<rclcpp::ServiceBase::SharedPtr> service;
76  // Contains the count of added services
77  size_t number_of_services;
78  // Vector containing the ClientBase of all the clients added to the executor.
79  std::vector<rclcpp::ClientBase::SharedPtr> client;
80  // Contains the count of added clients
81  size_t number_of_clients;
82  // Vector containing all the waitables added to the executor.
83  std::vector<rclcpp::Waitable::SharedPtr> waitable;
84  // Contains the count of added waitables
85  size_t number_of_waitables;
86 };
87 
88 } // namespace experimental
89 } // namespace rclcpp
90 
91 #endif // RCLCPP__EXPERIMENTAL__EXECUTABLE_LIST_HPP_
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.