Skip to content

Commit 0447469

Browse files
committed
Refs #21183: Adjust for const changes in DataWriter APIs
Signed-off-by: eduponz <eduardoponz@eprosima.com>
1 parent e46dc74 commit 0447469

8 files changed

Lines changed: 88 additions & 88 deletions

fastdds_python/test/types/test_completePubSubTypes.cxx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ StructTypePubSubType::~StructTypePubSubType()
5757
}
5858

5959
bool StructTypePubSubType::serialize(
60-
void* data,
60+
const void* const data,
6161
SerializedPayload_t* payload,
6262
DataRepresentationId_t data_representation)
6363
{
64-
StructType* p_type = static_cast<StructType*>(data);
64+
const StructType* p_type = static_cast<const StructType*>(data);
6565

6666
// Object that manages the raw buffer.
6767
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->max_size);
@@ -133,7 +133,7 @@ bool StructTypePubSubType::deserialize(
133133
}
134134

135135
std::function<uint32_t()> StructTypePubSubType::getSerializedSizeProvider(
136-
void* data,
136+
const void* const data,
137137
DataRepresentationId_t data_representation)
138138
{
139139
return [data, data_representation]() -> uint32_t
@@ -150,7 +150,7 @@ std::function<uint32_t()> StructTypePubSubType::getSerializedSizeProvider(
150150
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
151151
size_t current_alignment {0};
152152
return static_cast<uint32_t>(calculator.calculate_serialized_size(
153-
*static_cast<StructType*>(data), current_alignment)) +
153+
*static_cast<const StructType*>(data), current_alignment)) +
154154
4u /*encapsulation*/;
155155
}
156156
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
@@ -173,7 +173,7 @@ void StructTypePubSubType::deleteData(
173173
}
174174

175175
bool StructTypePubSubType::getKey(
176-
void* data,
176+
const void* const data,
177177
InstanceHandle_t* handle,
178178
bool force_md5)
179179
{
@@ -182,7 +182,7 @@ bool StructTypePubSubType::getKey(
182182
return false;
183183
}
184184

185-
StructType* p_type = static_cast<StructType*>(data);
185+
const StructType* p_type = static_cast<const StructType*>(data);
186186

187187
// Object that manages the raw buffer.
188188
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),
@@ -252,11 +252,11 @@ CompleteTestTypePubSubType::~CompleteTestTypePubSubType()
252252
}
253253

254254
bool CompleteTestTypePubSubType::serialize(
255-
void* data,
255+
const void* const data,
256256
SerializedPayload_t* payload,
257257
DataRepresentationId_t data_representation)
258258
{
259-
CompleteTestType* p_type = static_cast<CompleteTestType*>(data);
259+
const CompleteTestType* p_type = static_cast<const CompleteTestType*>(data);
260260

261261
// Object that manages the raw buffer.
262262
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->max_size);
@@ -328,7 +328,7 @@ bool CompleteTestTypePubSubType::deserialize(
328328
}
329329

330330
std::function<uint32_t()> CompleteTestTypePubSubType::getSerializedSizeProvider(
331-
void* data,
331+
const void* const data,
332332
DataRepresentationId_t data_representation)
333333
{
334334
return [data, data_representation]() -> uint32_t
@@ -345,7 +345,7 @@ std::function<uint32_t()> CompleteTestTypePubSubType::getSerializedSizeProvider(
345345
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
346346
size_t current_alignment {0};
347347
return static_cast<uint32_t>(calculator.calculate_serialized_size(
348-
*static_cast<CompleteTestType*>(data), current_alignment)) +
348+
*static_cast<const CompleteTestType*>(data), current_alignment)) +
349349
4u /*encapsulation*/;
350350
}
351351
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
@@ -368,7 +368,7 @@ void CompleteTestTypePubSubType::deleteData(
368368
}
369369

370370
bool CompleteTestTypePubSubType::getKey(
371-
void* data,
371+
const void* const data,
372372
InstanceHandle_t* handle,
373373
bool force_md5)
374374
{
@@ -377,7 +377,7 @@ bool CompleteTestTypePubSubType::getKey(
377377
return false;
378378
}
379379

380-
CompleteTestType* p_type = static_cast<CompleteTestType*>(data);
380+
const CompleteTestType* p_type = static_cast<const CompleteTestType*>(data);
381381

382382
// Object that manages the raw buffer.
383383
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),
@@ -445,11 +445,11 @@ KeyedCompleteTestTypePubSubType::~KeyedCompleteTestTypePubSubType()
445445
}
446446

447447
bool KeyedCompleteTestTypePubSubType::serialize(
448-
void* data,
448+
const void* const data,
449449
SerializedPayload_t* payload,
450450
DataRepresentationId_t data_representation)
451451
{
452-
KeyedCompleteTestType* p_type = static_cast<KeyedCompleteTestType*>(data);
452+
const KeyedCompleteTestType* p_type = static_cast<const KeyedCompleteTestType*>(data);
453453

454454
// Object that manages the raw buffer.
455455
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->max_size);
@@ -521,7 +521,7 @@ bool KeyedCompleteTestTypePubSubType::deserialize(
521521
}
522522

523523
std::function<uint32_t()> KeyedCompleteTestTypePubSubType::getSerializedSizeProvider(
524-
void* data,
524+
const void* const data,
525525
DataRepresentationId_t data_representation)
526526
{
527527
return [data, data_representation]() -> uint32_t
@@ -538,7 +538,7 @@ std::function<uint32_t()> KeyedCompleteTestTypePubSubType::getSerializedSizeProv
538538
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
539539
size_t current_alignment {0};
540540
return static_cast<uint32_t>(calculator.calculate_serialized_size(
541-
*static_cast<KeyedCompleteTestType*>(data), current_alignment)) +
541+
*static_cast<const KeyedCompleteTestType*>(data), current_alignment)) +
542542
4u /*encapsulation*/;
543543
}
544544
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
@@ -561,7 +561,7 @@ void KeyedCompleteTestTypePubSubType::deleteData(
561561
}
562562

563563
bool KeyedCompleteTestTypePubSubType::getKey(
564-
void* data,
564+
const void* const data,
565565
InstanceHandle_t* handle,
566566
bool force_md5)
567567
{
@@ -570,7 +570,7 @@ bool KeyedCompleteTestTypePubSubType::getKey(
570570
return false;
571571
}
572572

573-
KeyedCompleteTestType* p_type = static_cast<KeyedCompleteTestType*>(data);
573+
const KeyedCompleteTestType* p_type = static_cast<const KeyedCompleteTestType*>(data);
574574

575575
// Object that manages the raw buffer.
576576
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),

fastdds_python/test/types/test_completePubSubTypes.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ class StructTypePubSubType : public eprosima::fastdds::dds::TopicDataType
5454
eProsima_user_DllExport ~StructTypePubSubType() override;
5555

5656
eProsima_user_DllExport bool serialize(
57-
void* data,
57+
const void* const data,
5858
eprosima::fastdds::rtps::SerializedPayload_t* payload) override
5959
{
6060
return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION);
6161
}
6262

6363
eProsima_user_DllExport bool serialize(
64-
void* data,
64+
const void* const data,
6565
eprosima::fastdds::rtps::SerializedPayload_t* payload,
6666
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
6767

@@ -70,17 +70,17 @@ class StructTypePubSubType : public eprosima::fastdds::dds::TopicDataType
7070
void* data) override;
7171

7272
eProsima_user_DllExport std::function<uint32_t()> getSerializedSizeProvider(
73-
void* data) override
73+
const void* const data) override
7474
{
7575
return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION);
7676
}
7777

7878
eProsima_user_DllExport std::function<uint32_t()> getSerializedSizeProvider(
79-
void* data,
79+
const void* const data,
8080
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
8181

8282
eProsima_user_DllExport bool getKey(
83-
void* data,
83+
const void* const data,
8484
eprosima::fastdds::rtps::InstanceHandle_t* ihandle,
8585
bool force_md5 = false) override;
8686

@@ -147,14 +147,14 @@ class CompleteTestTypePubSubType : public eprosima::fastdds::dds::TopicDataType
147147
eProsima_user_DllExport ~CompleteTestTypePubSubType() override;
148148

149149
eProsima_user_DllExport bool serialize(
150-
void* data,
150+
const void* const data,
151151
eprosima::fastdds::rtps::SerializedPayload_t* payload) override
152152
{
153153
return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION);
154154
}
155155

156156
eProsima_user_DllExport bool serialize(
157-
void* data,
157+
const void* const data,
158158
eprosima::fastdds::rtps::SerializedPayload_t* payload,
159159
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
160160

@@ -163,17 +163,17 @@ class CompleteTestTypePubSubType : public eprosima::fastdds::dds::TopicDataType
163163
void* data) override;
164164

165165
eProsima_user_DllExport std::function<uint32_t()> getSerializedSizeProvider(
166-
void* data) override
166+
const void* const data) override
167167
{
168168
return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION);
169169
}
170170

171171
eProsima_user_DllExport std::function<uint32_t()> getSerializedSizeProvider(
172-
void* data,
172+
const void* const data,
173173
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
174174

175175
eProsima_user_DllExport bool getKey(
176-
void* data,
176+
const void* const data,
177177
eprosima::fastdds::rtps::InstanceHandle_t* ihandle,
178178
bool force_md5 = false) override;
179179

@@ -238,14 +238,14 @@ class KeyedCompleteTestTypePubSubType : public eprosima::fastdds::dds::TopicData
238238
eProsima_user_DllExport ~KeyedCompleteTestTypePubSubType() override;
239239

240240
eProsima_user_DllExport bool serialize(
241-
void* data,
241+
const void* const data,
242242
eprosima::fastdds::rtps::SerializedPayload_t* payload) override
243243
{
244244
return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION);
245245
}
246246

247247
eProsima_user_DllExport bool serialize(
248-
void* data,
248+
const void* const data,
249249
eprosima::fastdds::rtps::SerializedPayload_t* payload,
250250
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
251251

@@ -254,17 +254,17 @@ class KeyedCompleteTestTypePubSubType : public eprosima::fastdds::dds::TopicData
254254
void* data) override;
255255

256256
eProsima_user_DllExport std::function<uint32_t()> getSerializedSizeProvider(
257-
void* data) override
257+
const void* const data) override
258258
{
259259
return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION);
260260
}
261261

262262
eProsima_user_DllExport std::function<uint32_t()> getSerializedSizeProvider(
263-
void* data,
263+
const void* const data,
264264
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
265265

266266
eProsima_user_DllExport bool getKey(
267-
void* data,
267+
const void* const data,
268268
eprosima::fastdds::rtps::InstanceHandle_t* ihandle,
269269
bool force_md5 = false) override;
270270

fastdds_python/test/types/test_included_modulesPubSubTypes.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ namespace eprosima {
5959
}
6060

6161
bool StructType2PubSubType::serialize(
62-
void* data,
62+
const void* const data,
6363
SerializedPayload_t* payload,
6464
DataRepresentationId_t data_representation)
6565
{
66-
StructType2* p_type = static_cast<StructType2*>(data);
66+
const StructType2* p_type = static_cast<const StructType2*>(data);
6767

6868
// Object that manages the raw buffer.
6969
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->max_size);
@@ -135,7 +135,7 @@ namespace eprosima {
135135
}
136136

137137
std::function<uint32_t()> StructType2PubSubType::getSerializedSizeProvider(
138-
void* data,
138+
const void* const data,
139139
DataRepresentationId_t data_representation)
140140
{
141141
return [data, data_representation]() -> uint32_t
@@ -152,7 +152,7 @@ namespace eprosima {
152152
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
153153
size_t current_alignment {0};
154154
return static_cast<uint32_t>(calculator.calculate_serialized_size(
155-
*static_cast<StructType2*>(data), current_alignment)) +
155+
*static_cast<const StructType2*>(data), current_alignment)) +
156156
4u /*encapsulation*/;
157157
}
158158
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
@@ -175,7 +175,7 @@ namespace eprosima {
175175
}
176176

177177
bool StructType2PubSubType::getKey(
178-
void* data,
178+
const void* const data,
179179
InstanceHandle_t* handle,
180180
bool force_md5)
181181
{
@@ -184,7 +184,7 @@ namespace eprosima {
184184
return false;
185185
}
186186

187-
StructType2* p_type = static_cast<StructType2*>(data);
187+
const StructType2* p_type = static_cast<const StructType2*>(data);
188188

189189
// Object that manages the raw buffer.
190190
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),

fastdds_python/test/types/test_included_modulesPubSubTypes.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ namespace eprosima
5757
eProsima_user_DllExport ~StructType2PubSubType() override;
5858

5959
eProsima_user_DllExport bool serialize(
60-
void* data,
60+
const void* const data,
6161
eprosima::fastdds::rtps::SerializedPayload_t* payload) override
6262
{
6363
return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION);
6464
}
6565

6666
eProsima_user_DllExport bool serialize(
67-
void* data,
67+
const void* const data,
6868
eprosima::fastdds::rtps::SerializedPayload_t* payload,
6969
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
7070

@@ -73,17 +73,17 @@ namespace eprosima
7373
void* data) override;
7474

7575
eProsima_user_DllExport std::function<uint32_t()> getSerializedSizeProvider(
76-
void* data) override
76+
const void* const data) override
7777
{
7878
return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION);
7979
}
8080

8181
eProsima_user_DllExport std::function<uint32_t()> getSerializedSizeProvider(
82-
void* data,
82+
const void* const data,
8383
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
8484

8585
eProsima_user_DllExport bool getKey(
86-
void* data,
86+
const void* const data,
8787
eprosima::fastdds::rtps::InstanceHandle_t* ihandle,
8888
bool force_md5 = false) override;
8989

0 commit comments

Comments
 (0)