Function rcl_borrow_loaned_message

Function Documentation

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.

The memory allocated for the ros message belongs to the middleware and must not be deallocated other than by a call to

Attribute

Adherence

Allocates Memory

No [0]

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

[0] the underlying middleware might allocate new memory or returns an existing chunk form a pool. The function in rcl however does not allocate any additional memory.

Parameters:
  • publisher[in] Publisher to which the allocated message is associated.

  • type_support[in] Typesupport to which the internal ros message is allocated.

  • ros_message[out] The pointer to be filled to a valid ros message by the middleware.

Returns:

RCL_RET_OK if the ros message was correctly initialized, or

Returns:

RCL_RET_PUBLISHER_INVALID if the passed publisher is invalid, or

Returns:

RCL_RET_INVALID_ARGUMENT if an argument other than the ros message is null, or

Returns:

RCL_RET_BAD_ALLOC if the ros message could not be correctly created, or

Returns:

RCL_RET_UNSUPPORTED if the middleware does not support that feature, or

Returns:

RCL_RET_ERROR if an unexpected error occured.