@@ -48,36 +48,37 @@ extern "C"
48
48
// outlives those downstream classes.
49
49
typedef struct rosidl_dynamic_message_type_support_impl_s
50
50
{
51
- rosidl_type_hash_t * type_hash ;
52
- rosidl_runtime_c__type_description__TypeDescription * type_description ;
51
+ rcutils_allocator_t allocator ;
52
+
53
+ rosidl_type_hash_t type_hash ;
54
+ rosidl_runtime_c__type_description__TypeDescription type_description ;
55
+
56
+ // Unused for now, but placed here just in case
57
+ rosidl_runtime_c__type_description__TypeSource__Sequence type_description_sources ;
53
58
54
- // NOTE(methylDragon): Unused for now, but placed here just in case
55
- rosidl_runtime_c__type_description__TypeSource__Sequence * type_description_sources ;
56
59
rosidl_dynamic_typesupport_serialization_support_t * serialization_support ;
57
60
58
- // NOTE(methylDragon): I'm unsure if these are necessary. Though I think they are convenient.
59
- // dynamic_message_type moreso than dynamic_message.
60
- //
61
- // I'd err on including them to be able to support more middlewares
62
- //
63
- // The dynamic_message_type allows us to do a one time alloc and reuse it for
64
- // subscription creation and data creation
65
- // The dynamic_message allows us to either reuse it, or clone it, but it's
66
- // technically redundant because data can be created from dynamic_message_type
61
+ // The dynamic_message_type allows us to do a one time alloc and reuse it for subscription
62
+ // creation and data creation
67
63
rosidl_dynamic_typesupport_dynamic_type_t * dynamic_message_type ;
64
+
65
+ // The dynamic_message allows us to either reuse it, or clone it, but it's technically redundant
66
+ //because data can be created from dynamic_message_type
68
67
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_message ;
69
68
} rosidl_dynamic_message_type_support_impl_t ;
70
69
71
- /// Create a dynamic type message typesupport with bound message description
70
+ /// Initialize a dynamic type message type support with bound message description
72
71
/**
73
- * NOTE: Take note of the ownership rules for the returned struct and the `description` argument!
72
+ * Take note of the ownership rules for the returned struct and the `description` argument.
74
73
*
74
+ * The `rosidl_message_type_support_t *` returned from this function has different ownership rules
75
+ * compared to the statically allocated `rosidl_message_type_support_t` structs from code-generated
76
+ * types.
75
77
*
76
- * Ownership:
77
- * - The `rosidl_message_type_support_t *` returned from this function has different ownership
78
- * rules compared to the statically allocated `rosidl_message_type_support_t` structs from
79
- * code-generated types!
80
- * - The caller is responsible for deallocating the returned pointer
78
+ * The `type_hash`, `type_description`, `type_description_sources`, and `allocator` arguments are
79
+ * copied.
80
+
81
+ * The caller is responsible for deallocating the returned pointer.
81
82
*
82
83
* <hr>
83
84
* Attribute | Adherence
@@ -89,21 +90,53 @@ typedef struct rosidl_dynamic_message_type_support_impl_s
89
90
*/
90
91
ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
91
92
rcutils_ret_t
92
- rosidl_dynamic_message_type_support_handle_create (
93
+ rosidl_dynamic_message_type_support_handle_init (
93
94
rosidl_dynamic_typesupport_serialization_support_t * serialization_support ,
94
95
const rosidl_type_hash_t * type_hash ,
95
96
const rosidl_runtime_c__type_description__TypeDescription * type_description ,
96
97
const rosidl_runtime_c__type_description__TypeSource__Sequence * type_description_sources ,
97
- rosidl_message_type_support_t * * ts ); // OUT
98
+ rcutils_allocator_t * allocator ,
99
+ rosidl_message_type_support_t * ts ); // OUT
98
100
99
- /// Destroy a rosidl_message_type_support_t obtained with
100
- /// `rosidl_dynamic_message_type_support_handle_create ()`, which has dynamically allocated members
101
+ /// Finalize a rosidl_message_type_support_t obtained with
102
+ /// `rosidl_dynamic_message_type_support_handle_init ()`, which has dynamically allocated members
101
103
///
102
104
/// NOTE: Using this on a statically allocated typesupport will cause undefined behavior!
103
105
/// (Static memory will get freed in that case.)
104
106
ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
105
107
rcutils_ret_t
106
- rosidl_dynamic_message_type_support_handle_destroy (rosidl_message_type_support_t * ts );
108
+ rosidl_dynamic_message_type_support_handle_fini (rosidl_message_type_support_t * ts );
109
+
110
+ /// Initialized a `rosidl_dynamic_message_type_support_impl_t` with bound message description
111
+ /**
112
+ * The `type_hash`, `type_description`, `type_description_sources`, and `allocator` arguments are
113
+ * copied.
114
+ *
115
+ * The caller is responsible for deallocating the returned pointer.
116
+ *
117
+ * <hr>
118
+ * Attribute | Adherence
119
+ * ------------------ | -------------
120
+ * Allocates Memory | Yes
121
+ * Thread-Safe | No
122
+ * Uses Atomics | No
123
+ * Lock-Free | Yes
124
+ */
125
+ ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
126
+ rcutils_ret_t
127
+ rosidl_dynamic_message_type_support_handle_impl_init (
128
+ rosidl_dynamic_typesupport_serialization_support_t * serialization_support ,
129
+ const rosidl_type_hash_t * type_hash ,
130
+ const rosidl_runtime_c__type_description__TypeDescription * type_description ,
131
+ const rosidl_runtime_c__type_description__TypeSource__Sequence * type_description_sources ,
132
+ rcutils_allocator_t * allocator ,
133
+ rosidl_dynamic_message_type_support_impl_t * ts_impl ); // OUT
134
+
135
+ /// Finalize a `rosidl_dynamic_message_type_support_impl_t`
136
+ ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
137
+ rcutils_ret_t
138
+ rosidl_dynamic_message_type_support_handle_impl_fini (
139
+ rosidl_dynamic_message_type_support_impl_t * ts_impl );
107
140
108
141
/// Return type_hash member in rosidl_dynamic_message_type_support_impl_t
109
142
ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
0 commit comments