Function rmw_serialize

Function Documentation

rmw_ret_t rmw_serialize(const void *ros_message, const rosidl_message_type_support_t *type_support, rmw_serialized_message_t *serialized_message)

Serialize a ROS message into a rmw_serialized_message_t.

The ROS message is serialized into a byte stream contained within the rmw_serialized_message_t structure. The serialization format depends on the underlying implementation.

Attribute

Adherence

Allocates Memory

Maybe [1]

Thread-Safe

No

Uses Atomics

Maybe [2]

Lock-Free

Maybe [2]

[1] if the given serialized message does not have enough capacity to hold the ROS message serialization [2] rmw implementation defined, check the implementation documentation

Pre:

Given ROS message must be a valid non-null instance, initialized by the caller and matching the provided typesupport.

Pre:

Given typesupport must be a valid non-null instance, as provided by rosidl APIs.

Pre:

Given serialized message must be a valid non-null instance, initialized by the caller.

Parameters:
  • ros_message[in] the typed ROS message

  • type_support[in] the typesupport for the ROS message

  • serialized_message[out] the destination for the serialize ROS message

Returns:

RMW_RET_OK if successful, or

Returns:

RMW_RET_BAD_ALLOC if memory allocation failed, or

Returns:

RMW_RET_ERROR if an unexpected error occurs.