Skip to content

Commit

Permalink
Adjust for const changes in DataWriter APIs (#142)
Browse files Browse the repository at this point in the history
Signed-off-by: eduponz <eduardoponz@eprosima.com>
  • Loading branch information
EduPonz authored Jun 21, 2024
1 parent ad827a8 commit 2c25e60
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 88 deletions.
36 changes: 18 additions & 18 deletions fastdds_python/test/types/test_completePubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<StructType*>(data);
const StructType* p_type = static_cast<const StructType*>(data);

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

std::function<uint32_t()> StructTypePubSubType::getSerializedSizeProvider(
void* data,
const void* const data,
DataRepresentationId_t data_representation)
{
return [data, data_representation]() -> uint32_t
Expand All @@ -150,7 +150,7 @@ std::function<uint32_t()> StructTypePubSubType::getSerializedSizeProvider(
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<StructType*>(data), current_alignment)) +
*static_cast<const StructType*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
Expand All @@ -173,7 +173,7 @@ void StructTypePubSubType::deleteData(
}

bool StructTypePubSubType::getKey(
void* data,
const void* const data,
InstanceHandle_t* handle,
bool force_md5)
{
Expand All @@ -182,7 +182,7 @@ bool StructTypePubSubType::getKey(
return false;
}

StructType* p_type = static_cast<StructType*>(data);
const StructType* p_type = static_cast<const StructType*>(data);

// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),
Expand Down Expand Up @@ -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<CompleteTestType*>(data);
const CompleteTestType* p_type = static_cast<const CompleteTestType*>(data);

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

std::function<uint32_t()> CompleteTestTypePubSubType::getSerializedSizeProvider(
void* data,
const void* const data,
DataRepresentationId_t data_representation)
{
return [data, data_representation]() -> uint32_t
Expand All @@ -345,7 +345,7 @@ std::function<uint32_t()> CompleteTestTypePubSubType::getSerializedSizeProvider(
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<CompleteTestType*>(data), current_alignment)) +
*static_cast<const CompleteTestType*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
Expand All @@ -368,7 +368,7 @@ void CompleteTestTypePubSubType::deleteData(
}

bool CompleteTestTypePubSubType::getKey(
void* data,
const void* const data,
InstanceHandle_t* handle,
bool force_md5)
{
Expand All @@ -377,7 +377,7 @@ bool CompleteTestTypePubSubType::getKey(
return false;
}

CompleteTestType* p_type = static_cast<CompleteTestType*>(data);
const CompleteTestType* p_type = static_cast<const CompleteTestType*>(data);

// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),
Expand Down Expand Up @@ -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<KeyedCompleteTestType*>(data);
const KeyedCompleteTestType* p_type = static_cast<const KeyedCompleteTestType*>(data);

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

std::function<uint32_t()> KeyedCompleteTestTypePubSubType::getSerializedSizeProvider(
void* data,
const void* const data,
DataRepresentationId_t data_representation)
{
return [data, data_representation]() -> uint32_t
Expand All @@ -538,7 +538,7 @@ std::function<uint32_t()> KeyedCompleteTestTypePubSubType::getSerializedSizeProv
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<KeyedCompleteTestType*>(data), current_alignment)) +
*static_cast<const KeyedCompleteTestType*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
Expand All @@ -561,7 +561,7 @@ void KeyedCompleteTestTypePubSubType::deleteData(
}

bool KeyedCompleteTestTypePubSubType::getKey(
void* data,
const void* const data,
InstanceHandle_t* handle,
bool force_md5)
{
Expand All @@ -570,7 +570,7 @@ bool KeyedCompleteTestTypePubSubType::getKey(
return false;
}

KeyedCompleteTestType* p_type = static_cast<KeyedCompleteTestType*>(data);
const KeyedCompleteTestType* p_type = static_cast<const KeyedCompleteTestType*>(data);

// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),
Expand Down
30 changes: 15 additions & 15 deletions fastdds_python/test/types/test_completePubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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

eProsima_user_DllExport std::function<uint32_t()> getSerializedSizeProvider(
void* data) override
const void* const data) override
{
return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION);
}

eProsima_user_DllExport std::function<uint32_t()> 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;

Expand Down Expand Up @@ -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;

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

eProsima_user_DllExport std::function<uint32_t()> getSerializedSizeProvider(
void* data) override
const void* const data) override
{
return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION);
}

eProsima_user_DllExport std::function<uint32_t()> 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;

Expand Down Expand Up @@ -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;

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

eProsima_user_DllExport std::function<uint32_t()> getSerializedSizeProvider(
void* data) override
const void* const data) override
{
return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION);
}

eProsima_user_DllExport std::function<uint32_t()> 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;

Expand Down
12 changes: 6 additions & 6 deletions fastdds_python/test/types/test_included_modulesPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<StructType2*>(data);
const StructType2* p_type = static_cast<const StructType2*>(data);

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

std::function<uint32_t()> StructType2PubSubType::getSerializedSizeProvider(
void* data,
const void* const data,
DataRepresentationId_t data_representation)
{
return [data, data_representation]() -> uint32_t
Expand All @@ -152,7 +152,7 @@ namespace eprosima {
eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
return static_cast<uint32_t>(calculator.calculate_serialized_size(
*static_cast<StructType2*>(data), current_alignment)) +
*static_cast<const StructType2*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
Expand All @@ -175,7 +175,7 @@ namespace eprosima {
}

bool StructType2PubSubType::getKey(
void* data,
const void* const data,
InstanceHandle_t* handle,
bool force_md5)
{
Expand All @@ -184,7 +184,7 @@ namespace eprosima {
return false;
}

StructType2* p_type = static_cast<StructType2*>(data);
const StructType2* p_type = static_cast<const StructType2*>(data);

// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),
Expand Down
10 changes: 5 additions & 5 deletions fastdds_python/test/types/test_included_modulesPubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -73,17 +73,17 @@ namespace eprosima
void* data) override;

eProsima_user_DllExport std::function<uint32_t()> getSerializedSizeProvider(
void* data) override
const void* const data) override
{
return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION);
}

eProsima_user_DllExport std::function<uint32_t()> 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;

Expand Down
Loading

0 comments on commit 2c25e60

Please sign in to comment.