rcl  beta1
C API providing common ROS client library functionality.
wait.h
Go to the documentation of this file.
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 #if __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/types.h"
33 #include "rcl/visibility_control.h"
34 
35 struct rcl_wait_set_impl_t;
36 
38 typedef struct rcl_wait_set_t
39 {
47  const rcl_timer_t ** timers;
56  struct rcl_wait_set_impl_t * impl;
58 
64 
66 
116 rcl_ret_t
118  rcl_wait_set_t * wait_set,
119  size_t number_of_subscriptions,
120  size_t number_of_guard_conditions,
121  size_t number_of_timers,
122  size_t number_of_clients,
123  size_t number_of_services,
124  rcl_allocator_t allocator);
125 
127 
153 rcl_ret_t
155 
157 
177 rcl_ret_t
178 rcl_wait_set_get_allocator(const rcl_wait_set_t * wait_set, rcl_allocator_t * allocator);
179 
181 
206 rcl_ret_t
208  rcl_wait_set_t * wait_set,
209  const rcl_subscription_t * subscription);
210 
212 
236 rcl_ret_t
238 
240 
275 rcl_ret_t
276 rcl_wait_set_resize_subscriptions(rcl_wait_set_t * wait_set, size_t size);
277 
279 
285 rcl_ret_t
287  rcl_wait_set_t * wait_set,
288  const rcl_guard_condition_t * guard_condition);
289 
291 
297 rcl_ret_t
299 
301 
307 rcl_ret_t
309 
311 
317 rcl_ret_t
319  rcl_wait_set_t * wait_set,
320  const rcl_timer_t * timer);
321 
323 
329 rcl_ret_t
331 
333 
339 rcl_ret_t
340 rcl_wait_set_resize_timers(rcl_wait_set_t * wait_set, size_t size);
341 
343 
349 rcl_ret_t
351  rcl_wait_set_t * wait_set,
352  const rcl_client_t * client);
353 
355 
361 rcl_ret_t
363 
365 
371 rcl_ret_t
372 rcl_wait_set_resize_clients(rcl_wait_set_t * wait_set, size_t size);
373 
375 
381 rcl_ret_t
383  rcl_wait_set_t * wait_set,
384  const rcl_service_t * service);
385 
387 
393 rcl_ret_t
395 
397 
403 rcl_ret_t
404 rcl_wait_set_resize_services(rcl_wait_set_t * wait_set, size_t size);
405 
407 
500 rcl_ret_t
501 rcl_wait(rcl_wait_set_t * wait_set, int64_t timeout);
502 
503 #if __cplusplus
504 }
505 #endif
506 
507 #endif // RCL__WAIT_H_
Container for subscription&#39;s, guard condition&#39;s, etc to be waited on.
Definition: wait.h:38
const rcl_service_t ** services
Storage for service pointers.
Definition: wait.h:53
rmw_ret_t rcl_ret_t
Definition: types.h:20
size_t size_of_clients
Definition: wait.h:51
size_t size_of_guard_conditions
Definition: wait.h:45
rcl_ret_t rcl_wait_set_get_allocator(const rcl_wait_set_t *wait_set, rcl_allocator_t *allocator)
Retrieve the wait set&#39;s allocator.
rcl_ret_t rcl_wait_set_add_subscription(rcl_wait_set_t *wait_set, const rcl_subscription_t *subscription)
Store a pointer to the given subscription in the next empty spot in the set.
size_t size_of_subscriptions
Definition: wait.h:42
size_t size_of_services
Definition: wait.h:54
const rcl_client_t ** clients
Storage for client pointers.
Definition: wait.h:50
Structure which encapsulates a ROS Client.
Definition: client.h:33
rcl_wait_set_t rcl_get_zero_initialized_wait_set(void)
Return a rcl_wait_set_t struct with members set to NULL.
const rcl_timer_t ** timers
Storage for timer pointers.
Definition: wait.h:47
rcl_ret_t rcl_wait_set_clear_clients(rcl_wait_set_t *wait_set)
Remove (sets to NULL) the clients in the wait set.
rcl_ret_t rcl_wait_set_resize_guard_conditions(rcl_wait_set_t *wait_set, size_t size)
Reallocate space for the guard conditions in the wait set.
rcl_ret_t rcl_wait_set_add_guard_condition(rcl_wait_set_t *wait_set, const rcl_guard_condition_t *guard_condition)
Store a pointer to the guard condition in the next empty spot in the set.
#define RCL_WARN_UNUSED
Ignored return values of functions with this macro will emit a warning.
Definition: macros.h:25
size_t size_of_timers
Definition: wait.h:48
#define RCL_PUBLIC
Definition: visibility_control.h:48
rcl_ret_t rcl_wait_set_fini(rcl_wait_set_t *wait_set)
Finalize a rcl wait set.
struct rcl_wait_set_impl_t * impl
Implementation specific storage.
Definition: wait.h:56
Structure which encapsulates a ROS Service.
Definition: service.h:33
struct rcl_wait_set_t rcl_wait_set_t
Container for subscription&#39;s, guard condition&#39;s, etc to be waited on.
rcl_ret_t rcl_wait_set_clear_timers(rcl_wait_set_t *wait_set)
Remove (sets to NULL) the timers in the wait set.
rcl_ret_t rcl_wait_set_add_client(rcl_wait_set_t *wait_set, const rcl_client_t *client)
Store a pointer to the client in the next empty spot in the set.
rcl_ret_t rcl_wait_set_resize_services(rcl_wait_set_t *wait_set, size_t size)
Reallocate space for the services in the wait set.
rcl_ret_t rcl_wait_set_clear_subscriptions(rcl_wait_set_t *wait_set)
Remove (sets to NULL) the subscriptions in the wait set.
rcl_ret_t rcl_wait_set_add_service(rcl_wait_set_t *wait_set, const rcl_service_t *service)
Store a pointer to the client in the next empty spot in the set.
Encapsulation of an allocator.
Definition: allocator.h:40
rcl_ret_t rcl_wait_set_clear_services(rcl_wait_set_t *wait_set)
Remove (sets to NULL) the services in the wait set.
rcl_ret_t rcl_wait_set_clear_guard_conditions(rcl_wait_set_t *wait_set)
Remove (sets to NULL) the guard conditions in the wait set.
rcl_ret_t rcl_wait_set_resize_clients(rcl_wait_set_t *wait_set, size_t size)
Reallocate space for the clients in the wait set.
Structure which encapsulates a ROS Subscription.
Definition: subscription.h:33
rcl_ret_t rcl_wait(rcl_wait_set_t *wait_set, int64_t timeout)
Block until the wait set is ready or until the timeout has been exceeded.
rcl_ret_t rcl_wait_set_resize_subscriptions(rcl_wait_set_t *wait_set, size_t size)
Reallocate space for the subscriptions in the wait set.
Structure which encapsulates a ROS Timer.
Definition: timer.h:34
rcl_ret_t rcl_wait_set_init(rcl_wait_set_t *wait_set, size_t number_of_subscriptions, size_t number_of_guard_conditions, size_t number_of_timers, size_t number_of_clients, size_t number_of_services, rcl_allocator_t allocator)
Initialize a rcl wait set with space for items to be waited on.
Handle for a rcl guard condition.
Definition: guard_condition.h:32
rcl_ret_t rcl_wait_set_resize_timers(rcl_wait_set_t *wait_set, size_t size)
Reallocate space for the timers in the wait set.
const rcl_guard_condition_t ** guard_conditions
Storage for guard condition pointers.
Definition: wait.h:44
rcl_ret_t rcl_wait_set_add_timer(rcl_wait_set_t *wait_set, const rcl_timer_t *timer)
Store a pointer to the timer in the next empty spot in the set.
const rcl_subscription_t ** subscriptions
Storage for subscription pointers.
Definition: wait.h:41