Skip to content

Commit

Permalink
Refs #21183: Adjust for const changes in DataWriter APIs
Browse files Browse the repository at this point in the history
Signed-off-by: eduponz <eduardoponz@eprosima.com>
  • Loading branch information
EduPonz committed Jun 20, 2024
1 parent fd95234 commit d813157
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions code/CodeTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class HelloWorld
class HelloWorldPubSubType : public TopicDataType
{
bool serialize(
void* data,
const void* const data,
rtps::SerializedPayload_t* payload) override
{
return false;
Expand All @@ -50,7 +50,7 @@ class HelloWorldPubSubType : public TopicDataType
}

std::function<uint32_t()> getSerializedSizeProvider(
void* data) override
const void* const data) override
{
return []
{
Expand All @@ -69,7 +69,7 @@ class HelloWorldPubSubType : public TopicDataType
}

bool getKey(
void* data,
const void* const data,
rtps::InstanceHandle_t* ihandle,
bool force_md5 = false) override
{
Expand Down
12 changes: 6 additions & 6 deletions code/DDSCodeTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,7 @@ class CustomDataType : public TopicDataType
}

bool serialize(
void* data,
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t* payload) override
{
return true;
Expand All @@ -1538,7 +1538,7 @@ class CustomDataType : public TopicDataType
}

std::function<uint32_t()> getSerializedSizeProvider(
void* data) override
const void* const data) override
{
return std::function<uint32_t()>();
}
Expand All @@ -1554,7 +1554,7 @@ class CustomDataType : public TopicDataType
}

bool getKey(
void* data,
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t* ihandle,
bool force_md5) override
{
Expand Down Expand Up @@ -6914,7 +6914,7 @@ class LoanableHelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataTyp
}

bool serialize(
void* data,
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t* payload) override
{
return true;
Expand All @@ -6928,7 +6928,7 @@ class LoanableHelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataTyp
}

std::function<uint32_t()> getSerializedSizeProvider(
void* data) override
const void* const data) override
{
return std::function<uint32_t()>();
}
Expand All @@ -6944,7 +6944,7 @@ class LoanableHelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataTyp
}

bool getKey(
void* data,
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t* ihandle,
bool force_md5) override
{
Expand Down
12 changes: 6 additions & 6 deletions code/Examples/C++/DDSHelloWorld/src/HelloWorldPubSubTypes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<HelloWorld*>(data);
const HelloWorld* p_type = static_cast<const HelloWorld*>(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 HelloWorldPubSubType::deserialize(
}

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

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

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

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

Expand All @@ -69,17 +69,17 @@ class HelloWorldPubSubType : 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 d813157

Please sign in to comment.