Function rmw_init_publisher_allocation

Function Documentation

rmw_ret_t rmw_init_publisher_allocation(const rosidl_message_type_support_t *type_support, const rosidl_runtime_c__Sequence__bound *message_bounds, rmw_publisher_allocation_t *allocation)

Initialize a publisher allocation to be used with later publications.

This creates an allocation object that can be used in conjunction with the rmw_publish method to perform more carefully control memory allocations.

This will allow the middleware to preallocate the correct amount of memory for a given message type and message bounds. As allocation is performed in this method, it will not be necessary to allocate in the rmw_publish method.

Parameters:
  • type_support[in] Type support of the message to be preallocated.

  • message_bounds[in] Bounds structure of the message to be preallocated.

  • allocation[out] Allocation structure to be passed to rmw_publish.

Returns:

RMW_RET_OK if successful, or

Returns:

RMW_RET_UNSUPPORTED if it’s unimplemented

Returns:

RMW_RET_INVALID_ARGUMENT if an argument is null, or

Returns:

RMW_RET_ERROR if an unexpected error occurs.