Skip to content

Commit

Permalink
Binary compatible interface.
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <[email protected]>
  • Loading branch information
MiguelCompany committed Apr 15, 2021
1 parent 565433c commit 81fdacd
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
13 changes: 11 additions & 2 deletions rosidl_typesupport_fastrtps_c/resource/msg__type_support_c.cpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,19 @@ if isinstance(type_, AbstractNestedType):
return current_alignment - initial_alignment;
}

static size_t _@(message.structure.namespaced_type.name)__max_serialized_size(bool & full_bounded, bool & is_plain)
static size_t _@(message.structure.namespaced_type.name)__max_serialized_size(char & bounds_info)
{
return max_serialized_size_@('__'.join([package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name]))(
bool full_bounded;
bool is_plain;
size_t ret_val;

ret_val = max_serialized_size_@('__'.join([package_name] + list(interface_path.parents[0].parts) + [message.structure.namespaced_type.name]))(
full_bounded, is_plain, 0);

bounds_info =
is_plain ? ROSIDL_TYPESUPPORT_FASTRTPS_PLAIN_TYPE :
is_bounded ? ROSIDL_TYPESUPPORT_FASTRTPS_BOUNDED_TYPE : ROSIDL_TYPESUPPORT_FASTRTPS_UNBOUNDED_TYPE;
return ret_val;
}

@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
/// Feature define to allow API version detection
#define ROSIDL_TYPESUPPORT_FASTRTPS_HAS_PLAIN_TYPES

#define ROSIDL_TYPESUPPORT_FASTRTPS_UNBOUNDED_TYPE 0x00
#define ROSIDL_TYPESUPPORT_FASTRTPS_BOUNDED_TYPE 0x01
#define ROSIDL_TYPESUPPORT_FASTRTPS_PLAIN_TYPE 0x03

/// Encapsulates the callbacks for getting properties of this rosidl type.
/**
* These callbacks are implemented in the generated sources.
Expand Down Expand Up @@ -63,12 +67,15 @@ typedef struct message_type_support_callbacks_t
/// Callback function to determine the maximum size needed for serialization, which is used for
/// type support initialization.
/**
* \param[out] full_bounded Whether the maximum serialized size was fully bounded,
* (i.e. not unbounded strings or sequences).
* \param[out] is_plain Whether the type is plain (i.e. does not have strings or sequences).
* \param[out] bounds_info Bounds information for the type.
* May return one of the following values:
* - \c ROSIDL_TYPESUPPORT_FASTRTPS_PLAIN_TYPE for POD types
* - \c ROSIDL_TYPESUPPORT_FASTRTPS_BOUNDED_TYPE for fully bounded types,
* (i.e. not unbounded strings or sequences).
* - \c ROSIDL_TYPESUPPORT_FASTRTPS_UNBOUNDED_TYPE for unbounded types
* \return The maximum serialized size, in bytes.
*/
size_t (* max_serialized_size)(bool & full_bounded, bool & is_plain);
size_t (* max_serialized_size)(char & bounds_info);
} message_type_support_callbacks_t;

#endif // ROSIDL_TYPESUPPORT_FASTRTPS_CPP__MESSAGE_TYPE_SUPPORT_H_
13 changes: 11 additions & 2 deletions rosidl_typesupport_fastrtps_cpp/resource/msg__type_support.cpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,18 @@ static uint32_t _@(message.structure.namespaced_type.name)__get_serialized_size(
return static_cast<uint32_t>(get_serialized_size(*typed_message, 0));
}

static size_t _@(message.structure.namespaced_type.name)__max_serialized_size(bool & full_bounded, bool & is_plain)
static size_t _@(message.structure.namespaced_type.name)__max_serialized_size(char & bounds_info)
{
return max_serialized_size_@(message.structure.namespaced_type.name)(full_bounded, is_plain, 0);
bool full_bounded;
bool is_plain;
size_t ret_val;

ret_val = max_serialized_size_@(message.structure.namespaced_type.name)(full_bounded, is_plain, 0);

bounds_info =
is_plain ? ROSIDL_TYPESUPPORT_FASTRTPS_PLAIN_TYPE :
is_bounded ? ROSIDL_TYPESUPPORT_FASTRTPS_BOUNDED_TYPE : ROSIDL_TYPESUPPORT_FASTRTPS_UNBOUNDED_TYPE;
return ret_val;
}

static message_type_support_callbacks_t _@(message.structure.namespaced_type.name)__callbacks = {
Expand Down

0 comments on commit 81fdacd

Please sign in to comment.