rcl  master
C API providing common ROS client library functionality.
subscription.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 
16 
17 #ifndef RCL__SUBSCRIPTION_H_
18 #define RCL__SUBSCRIPTION_H_
19 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include "rosidl_runtime_c/message_type_support_struct.h"
26 
27 #include "rcl/macros.h"
28 #include "rcl/node.h"
29 #include "rcl/visibility_control.h"
30 
31 #include "rmw/message_sequence.h"
32 
34 struct rcl_subscription_impl_t;
35 
37 typedef struct rcl_subscription_t
38 {
40  struct rcl_subscription_impl_t * impl;
42 
45 {
49 
54 
56 
60 RCL_PUBLIC
61 RCL_WARN_UNUSED
64 
66 
154 RCL_PUBLIC
155 RCL_WARN_UNUSED
156 rcl_ret_t
158  rcl_subscription_t * subscription,
159  const rcl_node_t * node,
160  const rosidl_message_type_support_t * type_support,
161  const char * topic_name,
162  const rcl_subscription_options_t * options
163 );
164 
166 
191 RCL_PUBLIC
192 RCL_WARN_UNUSED
193 rcl_ret_t
194 rcl_subscription_fini(rcl_subscription_t * subscription, rcl_node_t * node);
195 
197 
206 RCL_PUBLIC
207 RCL_WARN_UNUSED
210 
212 
267 RCL_PUBLIC
268 RCL_WARN_UNUSED
269 rcl_ret_t
270 rcl_take(
271  const rcl_subscription_t * subscription,
272  void * ros_message,
273  rmw_message_info_t * message_info,
274  rmw_subscription_allocation_t * allocation
275 );
276 
278 
318 RCL_PUBLIC
319 RCL_WARN_UNUSED
320 rcl_ret_t
322  const rcl_subscription_t * subscription,
323  size_t count,
324  rmw_message_sequence_t * message_sequence,
325  rmw_message_info_sequence_t * message_info_sequence,
326  rmw_subscription_allocation_t * allocation
327 );
328 
330 
365 RCL_PUBLIC
366 RCL_WARN_UNUSED
367 rcl_ret_t
369  const rcl_subscription_t * subscription,
370  rcl_serialized_message_t * serialized_message,
371  rmw_message_info_t * message_info,
372  rmw_subscription_allocation_t * allocation);
373 
375 
403 RCL_PUBLIC
404 RCL_WARN_UNUSED
405 rcl_ret_t
407  const rcl_subscription_t * subscription,
408  void ** loaned_message,
409  rmw_message_info_t * message_info,
410  rmw_subscription_allocation_t * allocation);
411 
413 
435 RCL_PUBLIC
436 RCL_WARN_UNUSED
437 rcl_ret_t
439  const rcl_subscription_t * subscription,
440  void * loaned_message);
441 
443 
464 RCL_PUBLIC
465 RCL_WARN_UNUSED
466 const char *
468 
470 
491 RCL_PUBLIC
492 RCL_WARN_UNUSED
495 
497 
522 RCL_PUBLIC
523 RCL_WARN_UNUSED
526 
528 
545 RCL_PUBLIC
546 bool
547 rcl_subscription_is_valid(const rcl_subscription_t * subscription);
548 
550 
569 RCL_PUBLIC
570 RCL_WARN_UNUSED
571 rmw_ret_t
573  const rcl_subscription_t * subscription,
574  size_t * publisher_count);
575 
577 
597 RCL_PUBLIC
598 RCL_WARN_UNUSED
599 const rmw_qos_profile_t *
601 
603 
610 RCL_PUBLIC
611 bool
613 
614 #ifdef __cplusplus
615 }
616 #endif
617 
618 #endif // RCL__SUBSCRIPTION_H_
rmw_serialized_message_t
rcl_node_t
Structure which encapsulates a ROS Node.
Definition: node.h:39
rcl_subscription_get_publisher_count
rmw_ret_t rcl_subscription_get_publisher_count(const rcl_subscription_t *subscription, size_t *publisher_count)
Get the number of publishers matched to a subscription.
rcl_take
rcl_ret_t rcl_take(const rcl_subscription_t *subscription, void *ros_message, rmw_message_info_t *message_info, rmw_subscription_allocation_t *allocation)
Take a ROS message from a topic using a rcl subscription.
rcl_subscription_is_valid
bool rcl_subscription_is_valid(const rcl_subscription_t *subscription)
Check that the subscription is valid.
rcl_subscription_options_t::allocator
rcl_allocator_t allocator
Custom allocator for the subscription, used for incidental allocations.
Definition: subscription.h:50
rcl_subscription_options_t::rmw_subscription_options
rmw_subscription_options_t rmw_subscription_options
rmw specific subscription options, e.g. the rmw implementation specific payload.
Definition: subscription.h:52
rmw_message_info_t
rcl_ret_t
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:23
rmw_subscription_allocation_t
rcl_take_serialized_message
rcl_ret_t rcl_take_serialized_message(const rcl_subscription_t *subscription, rcl_serialized_message_t *serialized_message, rmw_message_info_t *message_info, rmw_subscription_allocation_t *allocation)
Take a serialized raw message from a topic using a rcl subscription.
rcl_subscription_t::impl
struct rcl_subscription_impl_t * impl
Pointer to the subscription implementation.
Definition: subscription.h:40
rcl_take_loaned_message
rcl_ret_t rcl_take_loaned_message(const rcl_subscription_t *subscription, void **loaned_message, rmw_message_info_t *message_info, rmw_subscription_allocation_t *allocation)
Take a loaned message from a topic using a rcl subscription.
rmw_message_info_sequence_t
rcl_subscription_get_rmw_handle
rmw_subscription_t * rcl_subscription_get_rmw_handle(const rcl_subscription_t *subscription)
Return the rmw subscription handle.
rcl_subscription_get_actual_qos
const rmw_qos_profile_t * rcl_subscription_get_actual_qos(const rcl_subscription_t *subscription)
Get the actual qos settings of the subscription.
rcl_subscription_fini
rcl_ret_t rcl_subscription_fini(rcl_subscription_t *subscription, rcl_node_t *node)
Finalize a rcl_subscription_t.
rcl_subscription_options_t::qos
rmw_qos_profile_t qos
Middleware quality of service settings for the subscription.
Definition: subscription.h:47
rmw_subscription_t
rcl_take_sequence
rcl_ret_t rcl_take_sequence(const rcl_subscription_t *subscription, size_t count, rmw_message_sequence_t *message_sequence, rmw_message_info_sequence_t *message_info_sequence, rmw_subscription_allocation_t *allocation)
Take a sequence of messages from a topic using a rcl subscription.
node.h
rcl_subscription_can_loan_messages
bool rcl_subscription_can_loan_messages(const rcl_subscription_t *subscription)
Check if subscription instance can loan messages.
rcl_subscription_t
struct rcl_subscription_t rcl_subscription_t
Structure which encapsulates a ROS Subscription.
rcl_subscription_get_topic_name
const char * rcl_subscription_get_topic_name(const rcl_subscription_t *subscription)
Get the topic name for the subscription.
rcl_return_loaned_message_from_subscription
rcl_ret_t rcl_return_loaned_message_from_subscription(const rcl_subscription_t *subscription, void *loaned_message)
Return a loaned message from a topic using a rcl subscription.
rmw_ret_t
int32_t rmw_ret_t
rmw_message_sequence_t
rcl_get_zero_initialized_subscription
rcl_subscription_t rcl_get_zero_initialized_subscription(void)
Return a rcl_subscription_t struct with members set to NULL.
rcl_subscription_options_t
struct rcl_subscription_options_t rcl_subscription_options_t
Options available for a rcl subscription.
rcl_subscription_options_t
Options available for a rcl subscription.
Definition: subscription.h:44
rmw_subscription_options_t
message_sequence.h
rcutils_allocator_t
rcl_subscription_get_default_options
rcl_subscription_options_t rcl_subscription_get_default_options(void)
Return the default subscription options in a rcl_subscription_options_t.
rcl_subscription_t
Structure which encapsulates a ROS Subscription.
Definition: subscription.h:37
rmw_qos_profile_t
rcl_subscription_get_options
const rcl_subscription_options_t * rcl_subscription_get_options(const rcl_subscription_t *subscription)
Return the rcl subscription options.
rcl_subscription_init
rcl_ret_t rcl_subscription_init(rcl_subscription_t *subscription, const rcl_node_t *node, const rosidl_message_type_support_t *type_support, const char *topic_name, const rcl_subscription_options_t *options)
Initialize a ROS subscription.