rcl  master
C API providing common ROS client library functionality.
publisher.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__PUBLISHER_H_
16 #define RCL__PUBLISHER_H_
17 
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #include "rosidl_runtime_c/message_type_support_struct.h"
24 
25 #include "rcl/macros.h"
26 #include "rcl/node.h"
27 #include "rcl/visibility_control.h"
28 
30 struct rcl_publisher_impl_t;
31 
33 typedef struct rcl_publisher_t
34 {
36  struct rcl_publisher_impl_t * impl;
38 
41 {
45 
50 
52 
56 RCL_PUBLIC
57 RCL_WARN_UNUSED
59 rcl_get_zero_initialized_publisher(void);
60 
62 
148 RCL_PUBLIC
149 RCL_WARN_UNUSED
150 rcl_ret_t
151 rcl_publisher_init(
152  rcl_publisher_t * publisher,
153  const rcl_node_t * node,
154  const rosidl_message_type_support_t * type_support,
155  const char * topic_name,
156  const rcl_publisher_options_t * options);
157 
159 
182 RCL_PUBLIC
183 RCL_WARN_UNUSED
184 rcl_ret_t
185 rcl_publisher_fini(rcl_publisher_t * publisher, rcl_node_t * node);
186 
188 
195 RCL_PUBLIC
196 RCL_WARN_UNUSED
198 rcl_publisher_get_default_options(void);
199 
201 
224 RCL_PUBLIC
225 RCL_WARN_UNUSED
226 rcl_ret_t
227 rcl_borrow_loaned_message(
228  const rcl_publisher_t * publisher,
229  const rosidl_message_type_support_t * type_support,
230  void ** ros_message);
231 
233 
254 RCL_PUBLIC
255 RCL_WARN_UNUSED
256 rcl_ret_t
257 rcl_return_loaned_message_from_publisher(
258  const rcl_publisher_t * publisher,
259  void * loaned_message);
260 
262 
318 RCL_PUBLIC
319 RCL_WARN_UNUSED
320 rcl_ret_t
321 rcl_publish(
322  const rcl_publisher_t * publisher,
323  const void * ros_message,
324  rmw_publisher_allocation_t * allocation);
325 
327 
358 RCL_PUBLIC
359 RCL_WARN_UNUSED
360 rcl_ret_t
361 rcl_publish_serialized_message(
362  const rcl_publisher_t * publisher,
363  const rcl_serialized_message_t * serialized_message,
364  rmw_publisher_allocation_t * allocation);
365 
367 
399 RCL_PUBLIC
400 RCL_WARN_UNUSED
401 rcl_ret_t
402 rcl_publish_loaned_message(
403  const rcl_publisher_t * publisher,
404  void * ros_message,
405  rmw_publisher_allocation_t * allocation);
406 
408 
427 RCL_PUBLIC
428 RCL_WARN_UNUSED
429 rcl_ret_t
430 rcl_publisher_assert_liveliness(const rcl_publisher_t * publisher);
431 
433 
454 RCL_PUBLIC
455 RCL_WARN_UNUSED
456 const char *
457 rcl_publisher_get_topic_name(const rcl_publisher_t * publisher);
458 
460 
481 RCL_PUBLIC
482 RCL_WARN_UNUSED
484 rcl_publisher_get_options(const rcl_publisher_t * publisher);
485 
487 
512 RCL_PUBLIC
513 RCL_WARN_UNUSED
515 rcl_publisher_get_rmw_handle(const rcl_publisher_t * publisher);
516 
518 
540 RCL_PUBLIC
541 RCL_WARN_UNUSED
543 rcl_publisher_get_context(const rcl_publisher_t * publisher);
544 
546 
563 RCL_PUBLIC
564 bool
565 rcl_publisher_is_valid(const rcl_publisher_t * publisher);
566 
568 
576 RCL_PUBLIC
577 bool
578 rcl_publisher_is_valid_except_context(const rcl_publisher_t * publisher);
579 
581 
600 RCL_PUBLIC
601 RCL_WARN_UNUSED
602 rcl_ret_t
603 rcl_publisher_get_subscription_count(
604  const rcl_publisher_t * publisher,
605  size_t * subscription_count);
606 
608 
628 RCL_PUBLIC
629 RCL_WARN_UNUSED
630 const rmw_qos_profile_t *
631 rcl_publisher_get_actual_qos(const rcl_publisher_t * publisher);
632 
633 
635 
639 RCL_PUBLIC
640 bool
641 rcl_publisher_can_loan_messages(const rcl_publisher_t * publisher);
642 
643 #ifdef __cplusplus
644 }
645 #endif
646 
647 #endif // RCL__PUBLISHER_H_
rcl_node_t
Structure which encapsulates a ROS Node.
Definition: node.h:37
rcl_publisher_options_t::rmw_publisher_options
rmw_publisher_options_t rmw_publisher_options
rmw specific publisher options, e.g. the rmw implementation specific payload.
Definition: publisher.h:48
rcl_publisher_t::impl
struct rcl_publisher_impl_t * impl
Pointer to the publisher implementation.
Definition: publisher.h:36
rcutils_uint8_array_t
rmw_publisher_options_t
rcl_publisher_options_t::qos
rmw_qos_profile_t qos
Middleware quality of service settings for the publisher.
Definition: publisher.h:43
rmw_publisher_allocation_t
rcl_publisher_t
Structure which encapsulates a ROS Publisher.
Definition: publisher.h:33
rmw_publisher_t
rcutils_allocator_t
rcl_context_t
Encapsulates the non-global state of an init/shutdown cycle.
Definition: context.h:108
rmw_qos_profile_t
rcl_publisher_options_t::allocator
rcl_allocator_t allocator
Custom allocator for the publisher, used for incidental allocations.
Definition: publisher.h:46
rcl_publisher_options_t
Options available for a rcl publisher.
Definition: publisher.h:40