1515#ifndef RMW_CONNEXTDDS__TYPE_SUPPORT_HPP_
1616#define RMW_CONNEXTDDS__TYPE_SUPPORT_HPP_
1717
18+ #include < cstdint>
1819#include < string>
1920#include < stdexcept>
2021
@@ -56,10 +57,16 @@ struct RMW_Connext_RequestReplyMessage
5657
5758class RMW_Connext_MessageTypeSupport
5859{
60+ const rosidl_message_type_support_t * _message_type_support;
5961 const rosidl_message_type_support_t * _type_support_fastrtps;
62+ message_type_support_key_callbacks_t _key_callbacks;
6063 bool _unbounded;
6164 bool _empty;
65+ bool _keyed;
66+ bool _unbounded_key;
67+ bool _is_cpp;
6268 uint32_t _serialized_size_max;
69+ uint32_t _key_serialized_size_max;
6370 std::string _type_name;
6471 RMW_Connext_MessageType _message_type;
6572 rmw_context_impl_t * const _ctx;
@@ -79,6 +86,11 @@ class RMW_Connext_MessageTypeSupport
7986 this ->_type_support_fastrtps ->data );
8087 }
8188
89+ const rosidl_message_type_support_t * message_type_support () const
90+ {
91+ return this ->_message_type_support ;
92+ }
93+
8294 rmw_context_impl_t * ctx () const
8395 {
8496 return this ->_ctx ;
@@ -99,6 +111,14 @@ class RMW_Connext_MessageTypeSupport
99111 return this ->_serialized_size_max ;
100112 }
101113
114+ uint32_t type_key_serialized_size_max () const
115+ {
116+ if (!this ->_keyed ) {
117+ return 0 ;
118+ }
119+ return this ->_key_serialized_size_max ;
120+ }
121+
102122 bool unbounded () const
103123 {
104124 return this ->_unbounded ;
@@ -109,6 +129,21 @@ class RMW_Connext_MessageTypeSupport
109129 return this ->_empty ;
110130 }
111131
132+ bool keyed () const
133+ {
134+ return this ->_keyed ;
135+ }
136+
137+ bool unbounded_key () const
138+ {
139+ return this ->_unbounded_key ;
140+ }
141+
142+ bool is_cpp () const
143+ {
144+ return this ->_is_cpp ;
145+ }
146+
112147 RMW_Connext_MessageType message_type () const
113148 {
114149 return this ->_message_type ;
@@ -139,14 +174,32 @@ class RMW_Connext_MessageTypeSupport
139174
140175 rmw_ret_t serialize (
141176 const void * const ros_msg,
142- rcutils_uint8_array_t * const to_buffer);
177+ rcutils_uint8_array_t * const to_buffer,
178+ const bool include_encapsulation = true );
143179
144180 rmw_ret_t deserialize (
145181 void * const ros_msg,
146182 const rcutils_uint8_array_t * const from_buffer,
147- size_t & size_out,
148183 const bool header_only = false );
149184
185+ rmw_ret_t serialize_key (
186+ const void * const ros_msg,
187+ rcutils_uint8_array_t * const to_buffer,
188+ RTIEncapsulationId encapsulation_id,
189+ const bool include_encapsulation = true );
190+
191+ // Not available in message_type_support_key_callbacks_t yet
192+ //
193+ // Because deserialize_key is not supported yet there will be errors receiving dispose samples
194+ // that have the serialized key as payload and the sample will be reported as lost.
195+ //
196+ // By default, dispose samples do not contain the serialized key, so this should only be a
197+ // problem if the DataWriterQos.protocol.serialize_key_with_dispose is set to true.
198+ //
199+ // rmw_ret_t deserialize_key(
200+ // void * const ros_msg,
201+ // const rcutils_uint8_array_t * const from_buffer);
202+
150203 static
151204 RMW_Connext_MessageTypeSupport *
152205 register_type_support (
@@ -174,7 +227,11 @@ class RMW_Connext_MessageTypeSupport
174227 const rosidl_message_type_support_t * const type_support,
175228 uint32_t & serialized_size_max,
176229 bool & unbounded,
177- bool & empty);
230+ bool & empty,
231+ bool & keyed,
232+ bool & unbounded_key,
233+ message_type_support_key_callbacks_t & key_callbacks,
234+ uint32_t & key_serialized_size_max);
178235};
179236
180237struct RMW_Connext_Message
0 commit comments