rcl  master
C API providing common ROS client library functionality.
wait.h
1 // Copyright 2015 Open Source Robotics Foundation, Inc.
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 RCL__WAIT_H_
16 #define RCL__WAIT_H_
17 
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #include <stdbool.h>
24 #include <stddef.h>
25 
26 #include "rcl/client.h"
27 #include "rcl/guard_condition.h"
28 #include "rcl/macros.h"
29 #include "rcl/service.h"
30 #include "rcl/subscription.h"
31 #include "rcl/timer.h"
32 #include "rcl/event.h"
33 #include "rcl/types.h"
34 #include "rcl/visibility_control.h"
35 
36 struct rcl_wait_set_impl_t;
37 
39 typedef struct rcl_wait_set_t
40 {
50  const rcl_timer_t ** timers;
62  const rcl_event_t ** events;
66  struct rcl_wait_set_impl_t * impl;
68 
70 RCL_PUBLIC
71 RCL_WARN_UNUSED
73 rcl_get_zero_initialized_wait_set(void);
74 
76 
129 RCL_PUBLIC
130 RCL_WARN_UNUSED
131 rcl_ret_t
132 rcl_wait_set_init(
133  rcl_wait_set_t * wait_set,
134  size_t number_of_subscriptions,
135  size_t number_of_guard_conditions,
136  size_t number_of_timers,
137  size_t number_of_clients,
138  size_t number_of_services,
139  size_t number_of_events,
140  rcl_context_t * context,
141  rcl_allocator_t allocator);
142 
144 
169 RCL_PUBLIC
170 RCL_WARN_UNUSED
171 rcl_ret_t
172 rcl_wait_set_fini(rcl_wait_set_t * wait_set);
173 
175 
194 RCL_PUBLIC
195 RCL_WARN_UNUSED
196 rcl_ret_t
197 rcl_wait_set_get_allocator(const rcl_wait_set_t * wait_set, rcl_allocator_t * allocator);
198 
200 
225 RCL_PUBLIC
226 RCL_WARN_UNUSED
227 rcl_ret_t
228 rcl_wait_set_add_subscription(
229  rcl_wait_set_t * wait_set,
230  const rcl_subscription_t * subscription,
231  size_t * index);
232 
234 
256 RCL_PUBLIC
257 RCL_WARN_UNUSED
258 rcl_ret_t
259 rcl_wait_set_clear(rcl_wait_set_t * wait_set);
260 
262 
299 RCL_PUBLIC
300 RCL_WARN_UNUSED
301 rcl_ret_t
302 rcl_wait_set_resize(
303  rcl_wait_set_t * wait_set,
304  size_t subscriptions_size,
305  size_t guard_conditions_size,
306  size_t timers_size,
307  size_t clients_size,
308  size_t services_size,
309  size_t events_size);
310 
312 
316 RCL_PUBLIC
317 RCL_WARN_UNUSED
318 rcl_ret_t
319 rcl_wait_set_add_guard_condition(
320  rcl_wait_set_t * wait_set,
321  const rcl_guard_condition_t * guard_condition,
322  size_t * index);
323 
325 
329 RCL_PUBLIC
330 RCL_WARN_UNUSED
331 rcl_ret_t
332 rcl_wait_set_add_timer(
333  rcl_wait_set_t * wait_set,
334  const rcl_timer_t * timer,
335  size_t * index);
336 
338 
342 RCL_PUBLIC
343 RCL_WARN_UNUSED
344 rcl_ret_t
345 rcl_wait_set_add_client(
346  rcl_wait_set_t * wait_set,
347  const rcl_client_t * client,
348  size_t * index);
349 
351 
355 RCL_PUBLIC
356 RCL_WARN_UNUSED
357 rcl_ret_t
358 rcl_wait_set_add_service(
359  rcl_wait_set_t * wait_set,
360  const rcl_service_t * service,
361  size_t * index);
362 
364 
368 RCL_PUBLIC
369 RCL_WARN_UNUSED
370 rcl_ret_t
371 rcl_wait_set_add_event(
372  rcl_wait_set_t * wait_set,
373  const rcl_event_t * event,
374  size_t * index);
375 
377 
468 RCL_PUBLIC
469 RCL_WARN_UNUSED
470 rcl_ret_t
471 rcl_wait(rcl_wait_set_t * wait_set, int64_t timeout);
472 
474 
492 RCL_PUBLIC
493 bool
494 rcl_wait_set_is_valid(const rcl_wait_set_t * wait_set);
495 
496 #ifdef __cplusplus
497 }
498 #endif
499 
500 #endif // RCL__WAIT_H_
rcl_wait_set_t::size_of_timers
size_t size_of_timers
Number of timers.
Definition: wait.h:52
rcl_timer_t
Structure which encapsulates a ROS Timer.
Definition: timer.h:37
rcl_client_t
Structure which encapsulates a ROS Client.
Definition: client.h:33
rcl_wait_set_t::size_of_guard_conditions
size_t size_of_guard_conditions
Number of guard_conditions.
Definition: wait.h:48
rcl_wait_set_t::events
const rcl_event_t ** events
Storage for event pointers.
Definition: wait.h:62
rcl_guard_condition_t
Handle for a rcl guard condition.
Definition: guard_condition.h:33
rcl_wait_set_t::timers
const rcl_timer_t ** timers
Storage for timer pointers.
Definition: wait.h:50
rcl_wait_set_t::size_of_subscriptions
size_t size_of_subscriptions
Number of subscriptions.
Definition: wait.h:44
rcl_wait_set_t::services
const rcl_service_t ** services
Storage for service pointers.
Definition: wait.h:58
rcl_wait_set_t::guard_conditions
const rcl_guard_condition_t ** guard_conditions
Storage for guard condition pointers.
Definition: wait.h:46
rcl_wait_set_t::subscriptions
const rcl_subscription_t ** subscriptions
Storage for subscription pointers.
Definition: wait.h:42
rcl_wait_set_t
Container for subscription's, guard condition's, etc to be waited on.
Definition: wait.h:39
rcl_wait_set_t::size_of_clients
size_t size_of_clients
Number of clients.
Definition: wait.h:56
rcl_wait_set_t::impl
struct rcl_wait_set_impl_t * impl
Implementation specific storage.
Definition: wait.h:66
rcutils_allocator_t
rcl_wait_set_t::clients
const rcl_client_t ** clients
Storage for client pointers.
Definition: wait.h:54
rcl_subscription_t
Structure which encapsulates a ROS Subscription.
Definition: subscription.h:35
rcl_context_t
Encapsulates the non-global state of an init/shutdown cycle.
Definition: context.h:108
rcl_event_t
Structure which encapsulates a ROS QoS event handle.
Definition: event.h:51
rcl_service_t
Structure which encapsulates a ROS Service.
Definition: service.h:33
rcl_wait_set_t::size_of_events
size_t size_of_events
Number of events.
Definition: wait.h:64
rcl_wait_set_t::size_of_services
size_t size_of_services
Number of services.
Definition: wait.h:60