Skip to content

Commit 467b8ab

Browse files
Regenerate types with Fast DDS Gen 3.3.2 (#1209)
Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com>
1 parent dd7642d commit 467b8ab

6 files changed

Lines changed: 21 additions & 67 deletions

File tree

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @file HelloWorld.cpp
1717
* This source file contains the implementation of the described types in the IDL file.
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
#ifdef _WIN32
@@ -28,8 +28,6 @@ char dummy;
2828

2929
#include "HelloWorld.h"
3030

31-
#if FASTCDR_VERSION_MAJOR > 1
32-
3331
#include <fastcdr/Cdr.h>
3432

3533

@@ -165,4 +163,3 @@ std::string& HelloWorld::message()
165163
// Include auxiliary functions like for serializing/deserializing.
166164
#include "HelloWorldCdrAux.ipp"
167165

168-
#endif // FASTCDR_VERSION_MAJOR > 1

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,9 @@
1616
* @file HelloWorld.h
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.
19+
* This file was generated by the tool fastddsgen (version: 3.3.2).
2020
*/
2121

22-
#include <fastcdr/config.h>
23-
#include "HelloWorldv1.h"
24-
25-
#if FASTCDR_VERSION_MAJOR > 1
26-
2722
#ifndef _FAST_DDS_GENERATED_HELLOWORLD_H_
2823
#define _FAST_DDS_GENERATED_HELLOWORLD_H_
2924

@@ -192,4 +187,3 @@ class HelloWorld
192187

193188

194189

195-
#endif // FASTCDR_VERSION_MAJOR > 1

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.
19+
* This file was generated by the tool fastddsgen (version: 3.3.2).
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.
19+
* This file was generated by the tool fastddsgen (version: 3.3.2).
2020
*/
2121

2222
#ifndef _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_

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

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

5151
HelloWorldPubSubType::~HelloWorldPubSubType()
5252
{
53-
if (m_keyBuffer != nullptr)
54-
{
55-
free(m_keyBuffer);
56-
}
5753
}
5854

5955
bool 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+

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

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

2323
#ifndef _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_
2424
#define _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_
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.h>
@@ -123,9 +125,6 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType
123125

124126
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
125127

126-
MD5 m_md5;
127-
unsigned char* m_keyBuffer;
128-
129128
};
130129

131130
#endif // _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_

0 commit comments

Comments
 (0)