@@ -33,15 +33,60 @@ extern "C"
33
33
34
34
// NOTE(methylDragon): How do we test this? It depends on specific serialization support. Do I just
35
35
// use the FastRTPS support then?
36
+ rmw_ret_t
37
+ rmw_dynamic_message_type_support_handle_init (
38
+ rosidl_dynamic_typesupport_serialization_support_t * serialization_support ,
39
+ bool middleware_supports_type_discovery ,
40
+ const rosidl_type_hash_t * type_hash ,
41
+ const rosidl_runtime_c__type_description__TypeDescription * type_description ,
42
+ const rosidl_runtime_c__type_description__TypeSource__Sequence * type_description_sources ,
43
+ rcutils_allocator_t * allocator ,
44
+ rosidl_message_type_support_t * ts )
45
+ {
46
+ if (!middleware_supports_type_discovery && type_description == NULL ) {
47
+ RMW_SET_ERROR_MSG (
48
+ "Middleware does not support type discovery. Deferred dynamic type message type support will "
49
+ "never be populated. You must provide a type description." );
50
+ return RMW_RET_INVALID_ARGUMENT ;
51
+ }
52
+ // TODO(methylDragon): Remove if and when the deferred description path is supported
53
+ if (type_description == NULL ) {
54
+ RMW_SET_ERROR_MSG (
55
+ "Deferred type description is not currently supported. You must provide a type description." );
56
+ return RMW_RET_INVALID_ARGUMENT ;
57
+ }
58
+
59
+ RMW_CHECK_ARGUMENT_FOR_NULL (serialization_support , RMW_RET_INVALID_ARGUMENT );
60
+ RMW_CHECK_ARGUMENT_FOR_NULL (type_hash , RMW_RET_INVALID_ARGUMENT );
61
+ RMW_CHECK_ARGUMENT_FOR_NULL (type_description , RMW_RET_INVALID_ARGUMENT );
62
+ RMW_CHECK_ARGUMENT_FOR_NULL (allocator , RMW_RET_INVALID_ARGUMENT );
63
+ RMW_CHECK_ARGUMENT_FOR_NULL (ts , RMW_RET_INVALID_ARGUMENT );
64
+
65
+ // NOTE(methylDragon): Not supported for now
66
+ // RMW_CHECK_ARGUMENT_FOR_NULL(type_description_sources, RMW_RET_INVALID_ARGUMENT);
67
+
68
+ return rmw_convert_rcutils_ret_to_rmw_ret (
69
+ rosidl_dynamic_message_type_support_handle_init (
70
+ serialization_support , type_hash , type_description , type_description_sources , allocator , ts ));
71
+ }
72
+
73
+ rmw_ret_t
74
+ rmw_dynamic_message_type_support_handle_fini (rosidl_message_type_support_t * ts )
75
+ {
76
+ if (!ts ) {
77
+ return RCUTILS_RET_OK ;
78
+ }
79
+ return rmw_convert_rcutils_ret_to_rmw_ret (rosidl_dynamic_message_type_support_handle_fini (ts ));
80
+ }
36
81
37
- /// Create a rosidl_message_type_support_t from a TypeDescription message
38
82
rmw_ret_t
39
83
rmw_dynamic_message_type_support_handle_create (
40
84
rosidl_dynamic_typesupport_serialization_support_t * serialization_support ,
41
85
bool middleware_supports_type_discovery ,
42
86
const rosidl_type_hash_t * type_hash ,
43
87
const rosidl_runtime_c__type_description__TypeDescription * type_description ,
44
88
const rosidl_runtime_c__type_description__TypeSource__Sequence * type_description_sources ,
89
+ rcutils_allocator_t * allocator ,
45
90
rosidl_message_type_support_t * * ts )
46
91
{
47
92
if (!middleware_supports_type_discovery && type_description == NULL ) {
@@ -60,20 +105,23 @@ rmw_dynamic_message_type_support_handle_create(
60
105
RMW_CHECK_ARGUMENT_FOR_NULL (serialization_support , RMW_RET_INVALID_ARGUMENT );
61
106
RMW_CHECK_ARGUMENT_FOR_NULL (type_hash , RMW_RET_INVALID_ARGUMENT );
62
107
RMW_CHECK_ARGUMENT_FOR_NULL (type_description , RMW_RET_INVALID_ARGUMENT );
108
+ RMW_CHECK_ARGUMENT_FOR_NULL (allocator , RMW_RET_INVALID_ARGUMENT );
63
109
RMW_CHECK_ARGUMENT_FOR_NULL (ts , RMW_RET_INVALID_ARGUMENT );
64
110
65
111
// NOTE(methylDragon): Not supported for now
66
112
// RMW_CHECK_ARGUMENT_FOR_NULL(type_description_sources, RMW_RET_INVALID_ARGUMENT);
67
113
68
114
return rmw_convert_rcutils_ret_to_rmw_ret (
69
115
rosidl_dynamic_message_type_support_handle_create (
70
- serialization_support , type_hash , type_description , type_description_sources , ts ));
116
+ serialization_support , type_hash , type_description , type_description_sources , allocator , ts ));
71
117
}
72
118
73
119
rmw_ret_t
74
120
rmw_dynamic_message_type_support_handle_destroy (rosidl_message_type_support_t * ts )
75
121
{
76
- RCUTILS_CHECK_ARGUMENT_FOR_NULL (ts , RMW_RET_INVALID_ARGUMENT );
122
+ if (!ts ) {
123
+ return RCUTILS_RET_OK ;
124
+ }
77
125
return rmw_convert_rcutils_ret_to_rmw_ret (rosidl_dynamic_message_type_support_handle_destroy (ts ));
78
126
}
79
127
0 commit comments