@@ -48,36 +48,35 @@ 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 encapsulated 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.
81
80
*
82
81
* <hr>
83
82
* Attribute | Adherence
@@ -89,21 +88,51 @@ typedef struct rosidl_dynamic_message_type_support_impl_s
89
88
*/
90
89
ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
91
90
rcutils_ret_t
92
- rosidl_dynamic_message_type_support_handle_create (
91
+ rosidl_dynamic_message_type_support_handle_init (
93
92
rosidl_dynamic_typesupport_serialization_support_t * serialization_support ,
94
93
const rosidl_type_hash_t * type_hash ,
95
94
const rosidl_runtime_c__type_description__TypeDescription * type_description ,
96
95
const rosidl_runtime_c__type_description__TypeSource__Sequence * type_description_sources ,
97
- rosidl_message_type_support_t * * ts ); // OUT
96
+ rcutils_allocator_t * allocator ,
97
+ rosidl_message_type_support_t * ts ); // OUT
98
98
99
- /// Destroy a rosidl_message_type_support_t obtained with
100
- /// `rosidl_dynamic_message_type_support_handle_create ()`, which has dynamically allocated members
99
+ /// Finalize a rosidl_message_type_support_t obtained with
100
+ /// `rosidl_dynamic_message_type_support_handle_init ()`, which has dynamically allocated members
101
101
///
102
102
/// NOTE: Using this on a statically allocated typesupport will cause undefined behavior!
103
103
/// (Static memory will get freed in that case.)
104
104
ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
105
105
rcutils_ret_t
106
- rosidl_dynamic_message_type_support_handle_destroy (rosidl_message_type_support_t * ts );
106
+ rosidl_dynamic_message_type_support_handle_fini (rosidl_message_type_support_t * ts );
107
+
108
+ /// Initialized a `rosidl_dynamic_message_type_support_impl_t` with bound message description
109
+ /**
110
+ * The `type_hash`, `type_description`, `type_description_sources`, and `allocator` arguments are
111
+ * copied.
112
+ *
113
+ * <hr>
114
+ * Attribute | Adherence
115
+ * ------------------ | -------------
116
+ * Allocates Memory | Yes
117
+ * Thread-Safe | No
118
+ * Uses Atomics | No
119
+ * Lock-Free | Yes
120
+ */
121
+ ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
122
+ rcutils_ret_t
123
+ rosidl_dynamic_message_type_support_handle_impl_init (
124
+ rosidl_dynamic_typesupport_serialization_support_t * serialization_support ,
125
+ const rosidl_type_hash_t * type_hash ,
126
+ const rosidl_runtime_c__type_description__TypeDescription * type_description ,
127
+ const rosidl_runtime_c__type_description__TypeSource__Sequence * type_description_sources ,
128
+ rcutils_allocator_t * allocator ,
129
+ rosidl_dynamic_message_type_support_impl_t * ts_impl ); // OUT
130
+
131
+ /// Finalize a `rosidl_dynamic_message_type_support_impl_t`
132
+ ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
133
+ rcutils_ret_t
134
+ rosidl_dynamic_message_type_support_handle_impl_fini (
135
+ rosidl_dynamic_message_type_support_impl_t * ts_impl );
107
136
108
137
/// Return type_hash member in rosidl_dynamic_message_type_support_impl_t
109
138
ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
0 commit comments