Program Listing for File publisher.h

Return to documentation for file (include/rcl/publisher.h)

// Copyright 2015 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


#ifndef RCL__PUBLISHER_H_
#define RCL__PUBLISHER_H_

#ifdef __cplusplus
extern "C"
{
#endif

#include "rosidl_runtime_c/message_type_support_struct.h"

#include "rcl/macros.h"
#include "rcl/node.h"
#include "rcl/visibility_control.h"
#include "rcl/time.h"

typedef struct rcl_publisher_impl_s rcl_publisher_impl_t;

typedef struct rcl_publisher_s
{
  rcl_publisher_impl_t * impl;
} rcl_publisher_t;

typedef struct rcl_publisher_options_s
{
  rmw_qos_profile_t qos;

  rcl_allocator_t allocator;
  rmw_publisher_options_t rmw_publisher_options;
  bool disable_loaned_message;
} rcl_publisher_options_t;


RCL_PUBLIC
RCL_WARN_UNUSED
rcl_publisher_t
rcl_get_zero_initialized_publisher(void);


RCL_PUBLIC
RCL_WARN_UNUSED
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);


RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_publisher_fini(rcl_publisher_t * publisher, rcl_node_t * node);


RCL_PUBLIC
RCL_WARN_UNUSED
rcl_publisher_options_t
rcl_publisher_get_default_options(void);


RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_borrow_loaned_message(
  const rcl_publisher_t * publisher,
  const rosidl_message_type_support_t * type_support,
  void ** ros_message);


RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_return_loaned_message_from_publisher(
  const rcl_publisher_t * publisher,
  void * loaned_message);


RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_publish(
  const rcl_publisher_t * publisher,
  const void * ros_message,
  rmw_publisher_allocation_t * allocation);


RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_publish_serialized_message(
  const rcl_publisher_t * publisher,
  const rcl_serialized_message_t * serialized_message,
  rmw_publisher_allocation_t * allocation);


RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_publish_loaned_message(
  const rcl_publisher_t * publisher,
  void * ros_message,
  rmw_publisher_allocation_t * allocation);


RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_publisher_assert_liveliness(const rcl_publisher_t * publisher);


RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_publisher_wait_for_all_acked(
  const rcl_publisher_t * publisher,
  rcl_duration_value_t timeout);


RCL_PUBLIC
RCL_WARN_UNUSED
const char *
rcl_publisher_get_topic_name(const rcl_publisher_t * publisher);


RCL_PUBLIC
RCL_WARN_UNUSED
const rcl_publisher_options_t *
rcl_publisher_get_options(const rcl_publisher_t * publisher);


RCL_PUBLIC
RCL_WARN_UNUSED
rmw_publisher_t *
rcl_publisher_get_rmw_handle(const rcl_publisher_t * publisher);


RCL_PUBLIC
RCL_WARN_UNUSED
rcl_context_t *
rcl_publisher_get_context(const rcl_publisher_t * publisher);


RCL_PUBLIC
bool
rcl_publisher_is_valid(const rcl_publisher_t * publisher);


RCL_PUBLIC
bool
rcl_publisher_is_valid_except_context(const rcl_publisher_t * publisher);


RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_publisher_get_subscription_count(
  const rcl_publisher_t * publisher,
  size_t * subscription_count);


RCL_PUBLIC
RCL_WARN_UNUSED
const rmw_qos_profile_t *
rcl_publisher_get_actual_qos(const rcl_publisher_t * publisher);



RCL_PUBLIC
bool
rcl_publisher_can_loan_messages(const rcl_publisher_t * publisher);

#ifdef __cplusplus
}
#endif

#endif  // RCL__PUBLISHER_H_