rcl  master
C API providing common ROS client library functionality.
publisher.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__PUBLISHER_H_
18 #define RCL__PUBLISHER_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 
32 struct rcl_publisher_impl_t;
33 
35 typedef struct rcl_publisher_t
36 {
38  struct rcl_publisher_impl_t * impl;
40 
43 {
47 
52 
54 
58 RCL_PUBLIC
59 RCL_WARN_UNUSED
62 
64 
150 RCL_PUBLIC
151 RCL_WARN_UNUSED
152 rcl_ret_t
154  rcl_publisher_t * publisher,
155  const rcl_node_t * node,
156  const rosidl_message_type_support_t * type_support,
157  const char * topic_name,
158  const rcl_publisher_options_t * options);
159 
161 
184 RCL_PUBLIC
185 RCL_WARN_UNUSED
186 rcl_ret_t
187 rcl_publisher_fini(rcl_publisher_t * publisher, rcl_node_t * node);
188 
190 
199 RCL_PUBLIC
200 RCL_WARN_UNUSED
203 
205 
229 RCL_PUBLIC
230 RCL_WARN_UNUSED
231 rcl_ret_t
233  const rcl_publisher_t * publisher,
234  const rosidl_message_type_support_t * type_support,
235  void ** ros_message);
236 
238 
259 RCL_PUBLIC
260 RCL_WARN_UNUSED
261 rcl_ret_t
263  const rcl_publisher_t * publisher,
264  void * loaned_message);
265 
267 
323 RCL_PUBLIC
324 RCL_WARN_UNUSED
325 rcl_ret_t
327  const rcl_publisher_t * publisher,
328  const void * ros_message,
329  rmw_publisher_allocation_t * allocation);
330 
332 
363 RCL_PUBLIC
364 RCL_WARN_UNUSED
365 rcl_ret_t
367  const rcl_publisher_t * publisher,
368  const rcl_serialized_message_t * serialized_message,
369  rmw_publisher_allocation_t * allocation);
370 
372 
404 RCL_PUBLIC
405 RCL_WARN_UNUSED
406 rcl_ret_t
408  const rcl_publisher_t * publisher,
409  void * ros_message,
410  rmw_publisher_allocation_t * allocation);
411 
413 
432 RCL_PUBLIC
433 RCL_WARN_UNUSED
434 rcl_ret_t
436 
438 
459 RCL_PUBLIC
460 RCL_WARN_UNUSED
461 const char *
463 
465 
486 RCL_PUBLIC
487 RCL_WARN_UNUSED
489 rcl_publisher_get_options(const rcl_publisher_t * publisher);
490 
492 
517 RCL_PUBLIC
518 RCL_WARN_UNUSED
521 
523 
545 RCL_PUBLIC
546 RCL_WARN_UNUSED
548 rcl_publisher_get_context(const rcl_publisher_t * publisher);
549 
551 
568 RCL_PUBLIC
569 bool
570 rcl_publisher_is_valid(const rcl_publisher_t * publisher);
571 
573 
581 RCL_PUBLIC
582 bool
584 
586 
605 RCL_PUBLIC
606 RCL_WARN_UNUSED
607 rcl_ret_t
609  const rcl_publisher_t * publisher,
610  size_t * subscription_count);
611 
613 
633 RCL_PUBLIC
634 RCL_WARN_UNUSED
635 const rmw_qos_profile_t *
637 
638 
640 
644 RCL_PUBLIC
645 bool
647 
648 #ifdef __cplusplus
649 }
650 #endif
651 
652 #endif // RCL__PUBLISHER_H_
rmw_serialized_message_t
rcl_publisher_get_topic_name
const char * rcl_publisher_get_topic_name(const rcl_publisher_t *publisher)
Get the topic name for the publisher.
rcl_node_t
Structure which encapsulates a ROS Node.
Definition: node.h:39
rcl_publisher_get_context
rcl_context_t * rcl_publisher_get_context(const rcl_publisher_t *publisher)
Return the context associated with this publisher.
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:50
rcl_publisher_is_valid_except_context
bool rcl_publisher_is_valid_except_context(const rcl_publisher_t *publisher)
Return true if the publisher is valid except the context, otherwise false.
rcl_publisher_assert_liveliness
rcl_ret_t rcl_publisher_assert_liveliness(const rcl_publisher_t *publisher)
Manually assert that this Publisher is alive (for RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC)
rcl_ret_t
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:23
rcl_publisher_get_actual_qos
const rmw_qos_profile_t * rcl_publisher_get_actual_qos(const rcl_publisher_t *publisher)
Get the actual qos settings of the publisher.
rcl_publisher_t::impl
struct rcl_publisher_impl_t * impl
Pointer to the publisher implementation.
Definition: publisher.h:38
rcl_borrow_loaned_message
rcl_ret_t rcl_borrow_loaned_message(const rcl_publisher_t *publisher, const rosidl_message_type_support_t *type_support, void **ros_message)
Borrow a loaned message.
rcl_publisher_get_options
const rcl_publisher_options_t * rcl_publisher_get_options(const rcl_publisher_t *publisher)
Return the rcl publisher options.
rcl_publisher_t
struct rcl_publisher_t rcl_publisher_t
Structure which encapsulates a ROS Publisher.
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:45
rcl_publish_serialized_message
rcl_ret_t rcl_publish_serialized_message(const rcl_publisher_t *publisher, const rcl_serialized_message_t *serialized_message, rmw_publisher_allocation_t *allocation)
Publish a serialized message on a topic using a publisher.
rmw_publisher_allocation_t
rcl_get_zero_initialized_publisher
rcl_publisher_t rcl_get_zero_initialized_publisher(void)
Return a rcl_publisher_t struct with members set to NULL.
rcl_publisher_init
rcl_ret_t rcl_publisher_init(rcl_publisher_t *publisher, const rcl_node_t *node, const rosidl_message_type_support_t *type_support, const char *topic_name, const rcl_publisher_options_t *options)
Initialize a rcl publisher.
rcl_publisher_options_t
struct rcl_publisher_options_t rcl_publisher_options_t
Options available for a rcl publisher.
rcl_publisher_t
Structure which encapsulates a ROS Publisher.
Definition: publisher.h:35
node.h
rmw_publisher_t
rcl_publish
rcl_ret_t rcl_publish(const rcl_publisher_t *publisher, const void *ros_message, rmw_publisher_allocation_t *allocation)
Publish a ROS message on a topic using a publisher.
rcl_publisher_is_valid
bool rcl_publisher_is_valid(const rcl_publisher_t *publisher)
Return true if the publisher is valid, otherwise false.
rcutils_allocator_t
rcl_context_t
Encapsulates the non-global state of an init/shutdown cycle.
Definition: context.h:113
rmw_qos_profile_t
rcl_publisher_can_loan_messages
bool rcl_publisher_can_loan_messages(const rcl_publisher_t *publisher)
Check if publisher instance can loan messages.
rcl_publisher_options_t::allocator
rcl_allocator_t allocator
Custom allocator for the publisher, used for incidental allocations.
Definition: publisher.h:48
rcl_return_loaned_message_from_publisher
rcl_ret_t rcl_return_loaned_message_from_publisher(const rcl_publisher_t *publisher, void *loaned_message)
Return a loaned message previously borrowed from a publisher.
rcl_publish_loaned_message
rcl_ret_t rcl_publish_loaned_message(const rcl_publisher_t *publisher, void *ros_message, rmw_publisher_allocation_t *allocation)
Publish a loaned message on a topic using a publisher.
rcl_publisher_options_t
Options available for a rcl publisher.
Definition: publisher.h:42
rcl_publisher_fini
rcl_ret_t rcl_publisher_fini(rcl_publisher_t *publisher, rcl_node_t *node)
Finalize a rcl_publisher_t.
rcl_publisher_get_subscription_count
rcl_ret_t rcl_publisher_get_subscription_count(const rcl_publisher_t *publisher, size_t *subscription_count)
Get the number of subscriptions matched to a publisher.
rcl_publisher_get_rmw_handle
rmw_publisher_t * rcl_publisher_get_rmw_handle(const rcl_publisher_t *publisher)
Return the rmw publisher handle.
rcl_publisher_get_default_options
rcl_publisher_options_t rcl_publisher_get_default_options(void)
Return the default publisher options in a rcl_publisher_options_t.