Skip to content

Commit e4752c2

Browse files
committed
Refs #23874. Regenerate code with Fast DDS Gen v4.0.6.
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
1 parent 582e029 commit e4752c2

File tree

7 files changed

+24
-63
lines changed

7 files changed

+24
-63
lines changed

code/Examples/C++/DDSHelloWorld/src/HelloWorld.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @file HelloWorld.hpp
1717
* This header file contains the declaration of the described types in the IDL file.
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
#ifndef FAST_DDS_GENERATED__HELLOWORLD_HPP

code/Examples/C++/DDSHelloWorld/src/HelloWorldCdrAux.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @file HelloWorldCdrAux.hpp
1717
* This source file contains some definitions of CDR related 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
#ifndef FAST_DDS_GENERATED__HELLOWORLDCDRAUX_HPP

code/Examples/C++/DDSHelloWorld/src/HelloWorldCdrAux.ipp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @file HelloWorldCdrAux.ipp
1717
* This source file contains some declarations of CDR related 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
#ifndef FAST_DDS_GENERATED__HELLOWORLDCDRAUX_IPP

code/Examples/C++/DDSHelloWorld/src/HelloWorldPubSubTypes.cxx

Lines changed: 16 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
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

4646
HelloWorldPubSubType::~HelloWorldPubSubType()
4747
{
48-
if (key_buffer_ != nullptr)
49-
{
50-
free(key_buffer_);
51-
}
5248
}
5349

5450
bool 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

211174
void 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"

code/Examples/C++/DDSHelloWorld/src/HelloWorldPubSubTypes.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616
* @file HelloWorldPubSubTypes.hpp
1717
* This header file contains the declaration 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

2323
#ifndef FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP
2424
#define FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP
2525

26+
#include <mutex>
27+
2628
#include <fastdds/dds/core/policy/QosPolicies.hpp>
2729
#include <fastdds/dds/topic/TopicDataType.hpp>
2830
#include <fastdds/rtps/common/InstanceHandle.hpp>
@@ -114,9 +116,6 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType
114116

115117
private:
116118

117-
eprosima::fastdds::MD5 md5_;
118-
unsigned char* key_buffer_;
119-
120119
};
121120

122121
#endif // FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP

code/Examples/C++/DDSHelloWorld/src/HelloWorldTypeObjectSupport.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @file HelloWorldTypeObjectSupport.cxx
1717
* Source file containing the implementation to register the TypeObject representation of the described types in the IDL file
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 "HelloWorldTypeObjectSupport.hpp"

code/Examples/C++/DDSHelloWorld/src/HelloWorldTypeObjectSupport.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @file HelloWorldTypeObjectSupport.hpp
1717
* Header file containing the API required to register the TypeObject representation of the described types in the IDL file
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
#ifndef FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP

0 commit comments

Comments
 (0)