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.
19+ * This file was generated by the tool fastddsgen (version: 3.3.2) .
2020 */
2121
2222
23+ #include < algorithm>
24+ #include < mutex>
25+
2326#include < fastdds/rtps/common/CdrSerialization.hpp>
2427
2528#include " HelloWorldPubSubTypes.h"
@@ -43,25 +46,19 @@ HelloWorldPubSubType::HelloWorldPubSubType()
4346 type_size += static_cast <uint32_t >(eprosima::fastcdr::Cdr::alignment (type_size, 4 )); /* possible submessage alignment */
4447 m_typeSize = type_size + 4 ; /* encapsulation*/
4548 m_isGetKeyDefined = false ;
46- uint32_t keyLength = HelloWorld_max_key_cdr_typesize > 16 ? HelloWorld_max_key_cdr_typesize : 16 ;
47- m_keyBuffer = reinterpret_cast <unsigned char *>(malloc (keyLength));
48- memset (m_keyBuffer, 0 , keyLength);
4949}
5050
5151HelloWorldPubSubType::~HelloWorldPubSubType ()
5252{
53- if (m_keyBuffer != nullptr )
54- {
55- free (m_keyBuffer);
56- }
5753}
5854
5955bool HelloWorldPubSubType::serialize (
6056 void * data,
6157 SerializedPayload_t* payload,
6258 DataRepresentationId_t data_representation)
6359{
64- HelloWorld* p_type = static_cast <HelloWorld*>(data);
60+ HelloWorld* p_type =
61+ static_cast <HelloWorld*>(data);
6562
6663 // Object that manages the raw buffer.
6764 eprosima::fastcdr::FastBuffer fastbuffer (reinterpret_cast <char *>(payload->data ), payload->max_size );
@@ -84,7 +81,7 @@ bool HelloWorldPubSubType::serialize(
8481 // Serialize the object.
8582 ser << *p_type;
8683#if FASTCDR_VERSION_MAJOR > 1
87- ser.set_dds_cdr_options ({0 ,0 });
84+ ser.set_dds_cdr_options ({0 , 0 });
8885#else
8986 ser.setDDSCdrOptions (0 );
9087#endif // FASTCDR_VERSION_MAJOR > 1
@@ -110,7 +107,8 @@ bool HelloWorldPubSubType::deserialize(
110107 try
111108 {
112109 // Convert DATA to pointer of your type
113- HelloWorld* p_type = static_cast <HelloWorld*>(data);
110+ HelloWorld* p_type =
111+ static_cast <HelloWorld*>(data);
114112
115113 // Object that manages the raw buffer.
116114 eprosima::fastcdr::FastBuffer fastbuffer (reinterpret_cast <char *>(payload->data ), payload->length );
@@ -182,45 +180,11 @@ bool HelloWorldPubSubType::getKey(
182180 InstanceHandle_t* handle,
183181 bool force_md5)
184182{
185- if (!m_isGetKeyDefined)
186- {
187- return false ;
188- }
183+ static_cast <void >(data);
184+ static_cast <void >(handle);
185+ static_cast <void >(force_md5);
189186
190- HelloWorld* p_type = static_cast <HelloWorld*>(data);
191-
192- // Object that manages the raw buffer.
193- eprosima::fastcdr::FastBuffer fastbuffer (reinterpret_cast <char *>(m_keyBuffer),
194- HelloWorld_max_key_cdr_typesize);
195-
196- // Object that serializes the data.
197- eprosima::fastcdr::Cdr ser (fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS , eprosima::fastcdr::CdrVersion::XCDRv1);
198- #if FASTCDR_VERSION_MAJOR == 1
199- p_type->serializeKey (ser);
200- #else
201- eprosima::fastcdr::serialize_key (ser, *p_type);
202- #endif // FASTCDR_VERSION_MAJOR == 1
203- if (force_md5 || HelloWorld_max_key_cdr_typesize > 16 )
204- {
205- m_md5.init ();
206- #if FASTCDR_VERSION_MAJOR == 1
207- m_md5.update (m_keyBuffer, static_cast <unsigned int >(ser.getSerializedDataLength ()));
208- #else
209- m_md5.update (m_keyBuffer, static_cast <unsigned int >(ser.get_serialized_data_length ()));
210- #endif // FASTCDR_VERSION_MAJOR == 1
211- m_md5.finalize ();
212- for (uint8_t i = 0 ; i < 16 ; ++i)
213- {
214- handle->value [i] = m_md5.digest [i];
215- }
216- }
217- else
218- {
219- for (uint8_t i = 0 ; i < 16 ; ++i)
220- {
221- handle->value [i] = m_keyBuffer[i];
222- }
223- }
224- return true ;
187+ return false ;
225188}
226189
190+
0 commit comments