Skip to content

Commit

Permalink
Adjust for const changes in DataWriter APIs (#147)
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 ee6df28 commit dc0e829
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
12 changes: 6 additions & 6 deletions types/KeylessShapeTypePubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ namespace shapes_demo_typesupport {
}

bool KeylessShapeTypePubSubType::serialize(
void* data,
const void* const data,
SerializedPayload_t* payload,
DataRepresentationId_t data_representation)
{
KeylessShapeType* p_type = static_cast<KeylessShapeType*>(data);
const KeylessShapeType* p_type = static_cast<const KeylessShapeType*>(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 shapes_demo_typesupport {
}

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

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

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

// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),
Expand Down
10 changes: 5 additions & 5 deletions types/KeylessShapeTypePubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ namespace shapes_demo_typesupport
eProsima_user_DllExport ~KeylessShapeTypePubSubType() 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 shapes_demo_typesupport
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 types/ShapePubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ ShapeTypePubSubType::~ShapeTypePubSubType()
}

bool ShapeTypePubSubType::serialize(
void* data,
const void* const data,
SerializedPayload_t* payload,
DataRepresentationId_t data_representation)
{
ShapeType* p_type = static_cast<ShapeType*>(data);
const ShapeType* p_type = static_cast<const ShapeType*>(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 ShapeTypePubSubType::deserialize(
}

std::function<uint32_t()> ShapeTypePubSubType::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()> ShapeTypePubSubType::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<ShapeType*>(data), current_alignment)) +
*static_cast<const ShapeType*>(data), current_alignment)) +
4u /*encapsulation*/;
}
catch (eprosima::fastcdr::exception::Exception& /*exception*/)
Expand All @@ -173,7 +173,7 @@ void ShapeTypePubSubType::deleteData(
}

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

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

// Object that manages the raw buffer.
eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),
Expand Down
10 changes: 5 additions & 5 deletions types/ShapePubSubTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ class ShapeTypePubSubType : public eprosima::fastdds::dds::TopicDataType
eProsima_user_DllExport ~ShapeTypePubSubType() 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 @@ -69,17 +69,17 @@ class ShapeTypePubSubType : 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

0 comments on commit dc0e829

Please sign in to comment.