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 
15 #ifndef RCL__PUBLISHER_H_
16 #define RCL__PUBLISHER_H_
17 
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #include "rosidl_generator_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 {
35  struct rcl_publisher_impl_t * impl;
37 
40 {
44 
49 
51 
59 
61 
149 rcl_ret_t
151  rcl_publisher_t * publisher,
152  const rcl_node_t * node,
153  const rosidl_message_type_support_t * type_support,
154  const char * topic_name,
155  const rcl_publisher_options_t * options
156 );
157 
159 
184 rcl_ret_t
185 rcl_publisher_fini(rcl_publisher_t * publisher, rcl_node_t * node);
186 
188 
198 
200 
225 rcl_ret_t
227  const rcl_publisher_t * publisher,
228  const rosidl_message_type_support_t * type_support,
229  void ** ros_message);
230 
232 
254 rcl_ret_t
256  const rcl_publisher_t * publisher,
257  void * loaned_message);
258 
260 
318 rcl_ret_t
320  const rcl_publisher_t * publisher,
321  const void * ros_message,
322  rmw_publisher_allocation_t * allocation
323 );
324 
326 
358 rcl_ret_t
360  const rcl_publisher_t * publisher,
361  const rcl_serialized_message_t * serialized_message,
362  rmw_publisher_allocation_t * allocation
363 );
364 
366 
400 rcl_ret_t
402  const rcl_publisher_t * publisher,
403  void * ros_message,
404  rmw_publisher_allocation_t * allocation
405 );
406 
408 
429 rcl_ret_t
431 
433 
456 const char *
458 
460 
484 rcl_publisher_get_options(const rcl_publisher_t * publisher);
485 
487 
516 
518 
543 rcl_publisher_get_context(const rcl_publisher_t * publisher);
544 
546 
564 bool
565 rcl_publisher_is_valid(const rcl_publisher_t * publisher);
566 
568 
577 bool
579 
581 
602 rmw_ret_t
604  const rcl_publisher_t * publisher,
605  size_t * subscription_count);
606 
608 
630 const rmw_qos_profile_t *
632 
633 
635 
640 bool
642 
643 #ifdef __cplusplus
644 }
645 #endif
646 
647 #endif // RCL__PUBLISHER_H_
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_ret_t rcl_publisher_fini(rcl_publisher_t *publisher, rcl_node_t *node)
Finalize a rcl_publisher_t.
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.
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.
struct rcl_publisher_impl_t * impl
Definition: publisher.h:35
rmw_ret_t rcl_ret_t
Definition: types.h:20
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.
rmw_qos_profile_t qos
Middleware quality of service settings for the publisher.
Definition: publisher.h:42
bool rcl_publisher_is_valid(const rcl_publisher_t *publisher)
Return true if the publisher is valid, otherwise false.
rmw_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_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_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) ...
struct rcl_publisher_options_t rcl_publisher_options_t
Options available for a rcl publisher.
rcl_publisher_t rcl_get_zero_initialized_publisher(void)
Return a rcl_publisher_t struct with members set to NULL.
#define RCL_WARN_UNUSED
Ignored return values of functions with this macro will emit a warning.
Definition: macros.h:25
rmw_publisher_t * rcl_publisher_get_rmw_handle(const rcl_publisher_t *publisher)
Return the rmw publisher handle.
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.
#define RCL_PUBLIC
Definition: visibility_control.h:48
bool rcl_publisher_is_valid_except_context(const rcl_publisher_t *publisher)
Return true if the publisher is valid except the context, otherwise false.
const rmw_qos_profile_t * rcl_publisher_get_actual_qos(const rcl_publisher_t *publisher)
Get the actual qos settings of the publisher.
rcl_allocator_t allocator
Custom allocator for the publisher, used for incidental allocations.
Definition: publisher.h:45
rcl_publisher_options_t rcl_publisher_get_default_options(void)
Return the default publisher options in a rcl_publisher_options_t.
struct rcl_publisher_t rcl_publisher_t
Structure which encapsulates a ROS Publisher.
rmw_publisher_options_t rmw_publisher_options
rmw specific publisher options, e.g. the rmw implementation specific payload.
Definition: publisher.h:47
Structure which encapsulates a ROS Publisher.
Definition: publisher.h:33
const rcl_publisher_options_t * rcl_publisher_get_options(const rcl_publisher_t *publisher)
Return the rcl publisher options.
int32_t rmw_ret_t
Encapsulates the non-global state of an init/shutdown cycle.
Definition: context.h:108
const char * rcl_publisher_get_topic_name(const rcl_publisher_t *publisher)
Get the topic name for the publisher.
bool rcl_publisher_can_loan_messages(const rcl_publisher_t *publisher)
Check if publisher instance can loan messages.
Structure which encapsulates a ROS Node.
Definition: node.h:37
rcl_context_t * rcl_publisher_get_context(const rcl_publisher_t *publisher)
Return the context associated with this publisher.
Options available for a rcl publisher.
Definition: publisher.h:39