From a296583e87028deac70a101aab98e79f310c6568 Mon Sep 17 00:00:00 2001 From: eduponz Date: Tue, 18 Jun 2024 09:07:33 +0200 Subject: [PATCH] Refs #21183: Adjust for const changes in DataWriter APIs Signed-off-by: eduponz --- .../test/types/test_completePubSubTypes.cxx | 36 +++++++++---------- .../test/types/test_completePubSubTypes.h | 30 ++++++++-------- .../test_included_modulesPubSubTypes.cxx | 12 +++---- .../types/test_included_modulesPubSubTypes.h | 10 +++--- .../test/types/test_modulesPubSubTypes.cxx | 36 +++++++++---------- .../test/types/test_modulesPubSubTypes.h | 30 ++++++++-------- .../HelloWorldPubSubTypes.cxx | 12 +++---- .../HelloWorldExample/HelloWorldPubSubTypes.h | 10 +++--- 8 files changed, 88 insertions(+), 88 deletions(-) diff --git a/fastdds_python/test/types/test_completePubSubTypes.cxx b/fastdds_python/test/types/test_completePubSubTypes.cxx index 699bf638..2ab4ef2b 100644 --- a/fastdds_python/test/types/test_completePubSubTypes.cxx +++ b/fastdds_python/test/types/test_completePubSubTypes.cxx @@ -57,11 +57,11 @@ StructTypePubSubType::~StructTypePubSubType() } bool StructTypePubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - StructType* p_type = static_cast(data); + const StructType* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool StructTypePubSubType::deserialize( } std::function StructTypePubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function StructTypePubSubType::getSerializedSizeProvider( eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); size_t current_alignment {0}; return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void StructTypePubSubType::deleteData( } bool StructTypePubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool StructTypePubSubType::getKey( return false; } - StructType* p_type = static_cast(data); + const StructType* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), @@ -252,11 +252,11 @@ CompleteTestTypePubSubType::~CompleteTestTypePubSubType() } bool CompleteTestTypePubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - CompleteTestType* p_type = static_cast(data); + const CompleteTestType* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -328,7 +328,7 @@ bool CompleteTestTypePubSubType::deserialize( } std::function CompleteTestTypePubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -345,7 +345,7 @@ std::function CompleteTestTypePubSubType::getSerializedSizeProvider( eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); size_t current_alignment {0}; return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -368,7 +368,7 @@ void CompleteTestTypePubSubType::deleteData( } bool CompleteTestTypePubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -377,7 +377,7 @@ bool CompleteTestTypePubSubType::getKey( return false; } - CompleteTestType* p_type = static_cast(data); + const CompleteTestType* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), @@ -445,11 +445,11 @@ KeyedCompleteTestTypePubSubType::~KeyedCompleteTestTypePubSubType() } bool KeyedCompleteTestTypePubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - KeyedCompleteTestType* p_type = static_cast(data); + const KeyedCompleteTestType* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -521,7 +521,7 @@ bool KeyedCompleteTestTypePubSubType::deserialize( } std::function KeyedCompleteTestTypePubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -538,7 +538,7 @@ std::function KeyedCompleteTestTypePubSubType::getSerializedSizeProv eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); size_t current_alignment {0}; return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -561,7 +561,7 @@ void KeyedCompleteTestTypePubSubType::deleteData( } bool KeyedCompleteTestTypePubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -570,7 +570,7 @@ bool KeyedCompleteTestTypePubSubType::getKey( return false; } - KeyedCompleteTestType* p_type = static_cast(data); + const KeyedCompleteTestType* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/fastdds_python/test/types/test_completePubSubTypes.h b/fastdds_python/test/types/test_completePubSubTypes.h index a7fc7bf2..fa220fe7 100644 --- a/fastdds_python/test/types/test_completePubSubTypes.h +++ b/fastdds_python/test/types/test_completePubSubTypes.h @@ -54,14 +54,14 @@ class StructTypePubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~StructTypePubSubType() override; eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; @@ -70,17 +70,17 @@ class StructTypePubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, + const void* const data, eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; @@ -147,14 +147,14 @@ class CompleteTestTypePubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~CompleteTestTypePubSubType() override; eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; @@ -163,17 +163,17 @@ class CompleteTestTypePubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, + const void* const data, eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; @@ -238,14 +238,14 @@ class KeyedCompleteTestTypePubSubType : public eprosima::fastdds::dds::TopicData eProsima_user_DllExport ~KeyedCompleteTestTypePubSubType() override; eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; @@ -254,17 +254,17 @@ class KeyedCompleteTestTypePubSubType : public eprosima::fastdds::dds::TopicData void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, + const void* const data, eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; diff --git a/fastdds_python/test/types/test_included_modulesPubSubTypes.cxx b/fastdds_python/test/types/test_included_modulesPubSubTypes.cxx index 00e40149..e8cd3bda 100644 --- a/fastdds_python/test/types/test_included_modulesPubSubTypes.cxx +++ b/fastdds_python/test/types/test_included_modulesPubSubTypes.cxx @@ -59,11 +59,11 @@ namespace eprosima { } bool StructType2PubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - StructType2* p_type = static_cast(data); + const StructType2* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -135,7 +135,7 @@ namespace eprosima { } std::function StructType2PubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -152,7 +152,7 @@ namespace eprosima { eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); size_t current_alignment {0}; return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -175,7 +175,7 @@ namespace eprosima { } bool StructType2PubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -184,7 +184,7 @@ namespace eprosima { return false; } - StructType2* p_type = static_cast(data); + const StructType2* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/fastdds_python/test/types/test_included_modulesPubSubTypes.h b/fastdds_python/test/types/test_included_modulesPubSubTypes.h index 907cda2e..241563a3 100644 --- a/fastdds_python/test/types/test_included_modulesPubSubTypes.h +++ b/fastdds_python/test/types/test_included_modulesPubSubTypes.h @@ -57,14 +57,14 @@ namespace eprosima eProsima_user_DllExport ~StructType2PubSubType() override; eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; @@ -73,17 +73,17 @@ namespace eprosima void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, + const void* const data, eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; diff --git a/fastdds_python/test/types/test_modulesPubSubTypes.cxx b/fastdds_python/test/types/test_modulesPubSubTypes.cxx index 2cab23dd..58acd3dd 100644 --- a/fastdds_python/test/types/test_modulesPubSubTypes.cxx +++ b/fastdds_python/test/types/test_modulesPubSubTypes.cxx @@ -59,11 +59,11 @@ namespace eprosima { } bool StructTypePubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - StructType* p_type = static_cast(data); + const StructType* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -135,7 +135,7 @@ namespace eprosima { } std::function StructTypePubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -152,7 +152,7 @@ namespace eprosima { eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); size_t current_alignment {0}; return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -175,7 +175,7 @@ namespace eprosima { } bool StructTypePubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -184,7 +184,7 @@ namespace eprosima { return false; } - StructType* p_type = static_cast(data); + const StructType* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), @@ -254,11 +254,11 @@ namespace eprosima { } bool CompleteTestTypePubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - CompleteTestType* p_type = static_cast(data); + const CompleteTestType* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -330,7 +330,7 @@ namespace eprosima { } std::function CompleteTestTypePubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -347,7 +347,7 @@ namespace eprosima { eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); size_t current_alignment {0}; return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -370,7 +370,7 @@ namespace eprosima { } bool CompleteTestTypePubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -379,7 +379,7 @@ namespace eprosima { return false; } - CompleteTestType* p_type = static_cast(data); + const CompleteTestType* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), @@ -447,11 +447,11 @@ namespace eprosima { } bool KeyedCompleteTestTypePubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - KeyedCompleteTestType* p_type = static_cast(data); + const KeyedCompleteTestType* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -523,7 +523,7 @@ namespace eprosima { } std::function KeyedCompleteTestTypePubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -540,7 +540,7 @@ namespace eprosima { eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); size_t current_alignment {0}; return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -563,7 +563,7 @@ namespace eprosima { } bool KeyedCompleteTestTypePubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -572,7 +572,7 @@ namespace eprosima { return false; } - KeyedCompleteTestType* p_type = static_cast(data); + const KeyedCompleteTestType* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/fastdds_python/test/types/test_modulesPubSubTypes.h b/fastdds_python/test/types/test_modulesPubSubTypes.h index 5cf3cff8..4868f052 100644 --- a/fastdds_python/test/types/test_modulesPubSubTypes.h +++ b/fastdds_python/test/types/test_modulesPubSubTypes.h @@ -57,14 +57,14 @@ namespace eprosima eProsima_user_DllExport ~StructTypePubSubType() override; eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; @@ -73,17 +73,17 @@ namespace eprosima void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, + const void* const data, eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; @@ -150,14 +150,14 @@ namespace eprosima eProsima_user_DllExport ~CompleteTestTypePubSubType() override; eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; @@ -166,17 +166,17 @@ namespace eprosima void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, + const void* const data, eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; @@ -241,14 +241,14 @@ namespace eprosima eProsima_user_DllExport ~KeyedCompleteTestTypePubSubType() override; eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; @@ -257,17 +257,17 @@ namespace eprosima void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, + const void* const data, eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override; diff --git a/fastdds_python_examples/HelloWorldExample/HelloWorldPubSubTypes.cxx b/fastdds_python_examples/HelloWorldExample/HelloWorldPubSubTypes.cxx index a73cf0ff..41da3940 100644 --- a/fastdds_python_examples/HelloWorldExample/HelloWorldPubSubTypes.cxx +++ b/fastdds_python_examples/HelloWorldExample/HelloWorldPubSubTypes.cxx @@ -57,11 +57,11 @@ HelloWorldPubSubType::~HelloWorldPubSubType() } bool HelloWorldPubSubType::serialize( - void* data, + const void* const data, SerializedPayload_t* payload, DataRepresentationId_t data_representation) { - HelloWorld* p_type = static_cast(data); + const HelloWorld* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); @@ -133,7 +133,7 @@ bool HelloWorldPubSubType::deserialize( } std::function HelloWorldPubSubType::getSerializedSizeProvider( - void* data, + const void* const data, DataRepresentationId_t data_representation) { return [data, data_representation]() -> uint32_t @@ -150,7 +150,7 @@ std::function HelloWorldPubSubType::getSerializedSizeProvider( eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); size_t current_alignment {0}; return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + + *static_cast(data), current_alignment)) + 4u /*encapsulation*/; } catch (eprosima::fastcdr::exception::Exception& /*exception*/) @@ -173,7 +173,7 @@ void HelloWorldPubSubType::deleteData( } bool HelloWorldPubSubType::getKey( - void* data, + const void* const data, InstanceHandle_t* handle, bool force_md5) { @@ -182,7 +182,7 @@ bool HelloWorldPubSubType::getKey( return false; } - HelloWorld* p_type = static_cast(data); + const HelloWorld* p_type = static_cast(data); // Object that manages the raw buffer. eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), diff --git a/fastdds_python_examples/HelloWorldExample/HelloWorldPubSubTypes.h b/fastdds_python_examples/HelloWorldExample/HelloWorldPubSubTypes.h index f048c9be..3db9ca96 100644 --- a/fastdds_python_examples/HelloWorldExample/HelloWorldPubSubTypes.h +++ b/fastdds_python_examples/HelloWorldExample/HelloWorldPubSubTypes.h @@ -53,14 +53,14 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~HelloWorldPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload) override { return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport bool serialize( - void* data, + const void* const data, eprosima::fastdds::rtps::SerializedPayload_t* payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; @@ -69,17 +69,17 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType void* data) override; eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override + const void* const data) override { return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); } eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool getKey( - void* data, + const void* const data, eprosima::fastdds::rtps::InstanceHandle_t* ihandle, bool force_md5 = false) override;