1616 * @file HelloWorldPubSubTypes.cpp
1717 * This header file contains the implementation of the serialization functions.
1818 *
19- * This file was generated by the tool fastddsgen (version: 4.0.5 ).
19+ * This file was generated by the tool fastddsgen (version: 4.0.6 ).
2020 */
2121
2222#include " HelloWorldPubSubTypes.hpp"
2323
24+ #include < algorithm>
25+ #include < mutex>
26+
2427#include < fastdds/dds/log/Log.hpp>
2528#include < fastdds/rtps/common/CdrSerialization.hpp>
2629
@@ -38,25 +41,19 @@ HelloWorldPubSubType::HelloWorldPubSubType()
3841 type_size += static_cast <uint32_t >(eprosima::fastcdr::Cdr::alignment (type_size, 4 )); /* possible submessage alignment */
3942 max_serialized_type_size = type_size + 4 ; /* encapsulation*/
4043 is_compute_key_provided = false ;
41- uint32_t key_length = HelloWorld_max_key_cdr_typesize > 16 ? HelloWorld_max_key_cdr_typesize : 16 ;
42- key_buffer_ = reinterpret_cast <unsigned char *>(malloc (key_length));
43- memset (key_buffer_, 0 , key_length);
4444}
4545
4646HelloWorldPubSubType::~HelloWorldPubSubType ()
4747{
48- if (key_buffer_ != nullptr )
49- {
50- free (key_buffer_);
51- }
5248}
5349
5450bool HelloWorldPubSubType::serialize (
5551 const void * const data,
5652 SerializedPayload_t& payload,
5753 DataRepresentationId_t data_representation)
5854{
59- const HelloWorld* p_type = static_cast <const HelloWorld*>(data);
55+ const HelloWorld* p_type =
56+ static_cast <const HelloWorld*>(data);
6057
6158 // Object that manages the raw buffer.
6259 eprosima::fastcdr::FastBuffer fastbuffer (reinterpret_cast <char *>(payload.data ), payload.max_size );
@@ -76,7 +73,7 @@ bool HelloWorldPubSubType::serialize(
7673 ser.serialize_encapsulation ();
7774 // Serialize the object.
7875 ser << *p_type;
79- ser.set_dds_cdr_options ({0 ,0 });
76+ ser.set_dds_cdr_options ({0 , 0 });
8077 }
8178 catch (eprosima::fastcdr::exception::Exception& /* exception*/ )
8279 {
@@ -95,7 +92,8 @@ bool HelloWorldPubSubType::deserialize(
9592 try
9693 {
9794 // Convert DATA to pointer of your type
98- HelloWorld* p_type = static_cast <HelloWorld*>(data);
95+ HelloWorld* p_type =
96+ static_cast <HelloWorld*>(data);
9997
10098 // Object that manages the raw buffer.
10199 eprosima::fastcdr::FastBuffer fastbuffer (reinterpret_cast <char *>(payload.data ), payload.length );
@@ -154,16 +152,9 @@ bool HelloWorldPubSubType::compute_key(
154152 InstanceHandle_t& handle,
155153 bool force_md5)
156154{
157- if (!is_compute_key_provided)
158- {
159- return false ;
160- }
161-
162- HelloWorld data;
163- if (deserialize (payload, static_cast <void *>(&data)))
164- {
165- return compute_key (static_cast <void *>(&data), handle, force_md5);
166- }
155+ static_cast <void >(payload);
156+ static_cast <void >(handle);
157+ static_cast <void >(force_md5);
167158
168159 return false ;
169160}
@@ -173,46 +164,17 @@ bool HelloWorldPubSubType::compute_key(
173164 InstanceHandle_t& handle,
174165 bool force_md5)
175166{
176- if (!is_compute_key_provided)
177- {
178- return false ;
179- }
167+ static_cast <void >(data);
168+ static_cast <void >(handle);
169+ static_cast <void >(force_md5);
180170
181- const HelloWorld* p_type = static_cast <const HelloWorld*>(data);
182-
183- // Object that manages the raw buffer.
184- eprosima::fastcdr::FastBuffer fastbuffer (reinterpret_cast <char *>(key_buffer_),
185- HelloWorld_max_key_cdr_typesize);
186-
187- // Object that serializes the data.
188- eprosima::fastcdr::Cdr ser (fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2);
189- ser.set_encoding_flag (eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2);
190- eprosima::fastcdr::serialize_key (ser, *p_type);
191- if (force_md5 || HelloWorld_max_key_cdr_typesize > 16 )
192- {
193- md5_.init ();
194- md5_.update (key_buffer_, static_cast <unsigned int >(ser.get_serialized_data_length ()));
195- md5_.finalize ();
196- for (uint8_t i = 0 ; i < 16 ; ++i)
197- {
198- handle.value [i] = md5_.digest [i];
199- }
200- }
201- else
202- {
203- for (uint8_t i = 0 ; i < 16 ; ++i)
204- {
205- handle.value [i] = key_buffer_[i];
206- }
207- }
208- return true ;
171+ return false ;
209172}
210173
211174void HelloWorldPubSubType::register_type_object_representation ()
212175{
213176 register_HelloWorld_type_identifier (type_identifiers_);
214177}
215178
216-
217179// Include auxiliary functions like for serializing/deserializing.
218180#include " HelloWorldCdrAux.ipp"
0 commit comments