From 530b8a6dde379057f5581883f43dea50d07b7f92 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Tue, 26 Mar 2024 15:31:52 +0000 Subject: [PATCH] Refs #20676: add message_type_support_key_callbacks_t to message_type_support Signed-off-by: Mario Dominguez --- .../message_type_support.h | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/rosidl_typesupport_fastrtps_cpp/include/rosidl_typesupport_fastrtps_cpp/message_type_support.h b/rosidl_typesupport_fastrtps_cpp/include/rosidl_typesupport_fastrtps_cpp/message_type_support.h index 4f37fdb..15bacaa 100644 --- a/rosidl_typesupport_fastrtps_cpp/include/rosidl_typesupport_fastrtps_cpp/message_type_support.h +++ b/rosidl_typesupport_fastrtps_cpp/include/rosidl_typesupport_fastrtps_cpp/message_type_support.h @@ -26,6 +26,38 @@ #define ROSIDL_TYPESUPPORT_FASTRTPS_BOUNDED_TYPE 0x01 #define ROSIDL_TYPESUPPORT_FASTRTPS_PLAIN_TYPE 0x03 +// Holds generated methods related with keys +typedef struct message_type_support_key_callbacks_t +{ + /// Callback function to determine the maximum size needed for key serialization, + /// which is used for key type support initialization. + /** + * \param [in,out] is_unbounded Whether the key has any unbounded member. + * \return The maximum key serialized size, in bytes. + */ + size_t (* max_serialized_size_key)( + bool & is_unbounded); + + /// Callback function to get size of the key data + /** + * \param [in] untyped_ros_message Type erased pointer to message instance + * \return The size of the serialized key in bytes. + */ + size_t (* get_serialized_size_key)( + const void * untyped_ros_message); + + /// Callback function for key serialization + /** + * \param[in] untyped_ros_message Type erased pointer to message instance. + * \param [in,out] Serialized FastCDR data object. + * \return true if serialization succeeded, false otherwise. + */ + bool (* cdr_serialize_key)( + const void * untyped_ros_message, + eprosima::fastcdr::Cdr & cdr); + +} message_type_support_key_callbacks_t; + /// Encapsulates the callbacks for getting properties of this rosidl type. /** * These callbacks are implemented in the generated sources. @@ -76,6 +108,11 @@ typedef struct message_type_support_callbacks_t * \return The maximum serialized size, in bytes. */ size_t (* max_serialized_size)(char & bounds_info); + + /// Pointer to the message_type_support_key_callbacks_t. + /// Nullptr if the type is not keyed. + message_type_support_key_callbacks_t * key_callbacks; + } message_type_support_callbacks_t; #endif // ROSIDL_TYPESUPPORT_FASTRTPS_CPP__MESSAGE_TYPE_SUPPORT_H_