Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21325] Remove all code related to FAST CDR v1 #5073

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions include/fastdds/config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,4 @@
(FASTDDS_VERSION_MAJOR == major && FASTDDS_VERSION_MINOR < minor), \
"TODO before version " #major "." #minor " : " #msg)

#if FASTCDR_VERSION_MAJOR > 1
#define FASTDDS_SER_METHOD_DEPRECATED(major, entity_name, msg) FASTDDS_DEPRECATED_UNTIL(major, entity_name, msg)
#else
#define FASTDDS_SER_METHOD_DEPRECATED(major, entity_name, msg)
#endif // if FASTCDR_VERSION_MAJOR > 1

#endif // FASTDDS__CONFIG_H
72 changes: 0 additions & 72 deletions include/fastdds/rtps/common/CdrSerialization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,76 +20,6 @@
#define FASTDDS_RTPS_COMMON__CDRSERIALIZATION_HPP

#include <fastcdr/Cdr.h>

#if FASTCDR_VERSION_MAJOR == 1

#include <fastcdr/exceptions/BadParamException.h>
#include <fastcdr/cdr/fixed_size_string.hpp>

namespace eprosima {
namespace fastcdr {

namespace CdrVersion {
const eprosima::fastcdr::Cdr::CdrType DDS_CDR = eprosima::fastcdr::Cdr::CdrType::DDS_CDR;
const eprosima::fastcdr::Cdr::CdrType XCDRv1 = eprosima::fastcdr::Cdr::CdrType::DDS_CDR;
const eprosima::fastcdr::Cdr::CdrType XCDRv2 = eprosima::fastcdr::Cdr::CdrType::DDS_CDR;
} // namespace CdrVersion

class CdrSizeCalculator;

template<class _T>
extern size_t calculate_serialized_size(
eprosima::fastcdr::CdrSizeCalculator& calculator,
const _T& data,
size_t& current_alignment);

template<class _T>
extern void serialize(
Cdr&,
const _T&);

template<class _T>
extern void deserialize(
Cdr&,
_T&);

// Dummy class
class CdrSizeCalculator
{
public:

CdrSizeCalculator(
eprosima::fastcdr::Cdr::CdrType)
{
}

template<class _T>
size_t calculate_serialized_size(
const _T& data,
size_t current_alignment)
{
return eprosima::fastcdr::calculate_serialized_size(*this, data, current_alignment);
}

};

template<size_t MAX_CHARS>
using fastcdr::fixed_string = eprosima::fastcdr::fixed_string<MAX_CHARS>;

} // namespace fastcdr
} // namespace eprosima

namespace eprosima {
namespace fastdds {
namespace rtps {
//! Default XCDR encoding version used in Fast DDS.
constexpr eprosima::fastcdr::Cdr::CdrType DEFAULT_XCDR_VERSION {eprosima::fastcdr::Cdr::CdrType::DDS_CDR};
} // namespace rtps
} // namespace fastdds
} // namespace eprosima

#else

#include <fastcdr/CdrSizeCalculator.hpp>

namespace eprosima {
Expand All @@ -101,6 +31,4 @@ constexpr eprosima::fastcdr::CdrVersion DEFAULT_XCDR_VERSION {eprosima::fastcdr:
} // namespace fastdds
} // namespace eprosima

#endif //FASTCDR_VERSION_MAJOR == 1

#endif // FASTDDS_RTPS_COMMON__CDRSERIALIZATION_HPP
21 changes: 0 additions & 21 deletions src/cpp/fastdds/core/policy/QosPoliciesSerializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,13 +906,8 @@ inline bool QosPoliciesSerializer<TypeIdV1>::add_to_cdr_message(
ser.serialize_encapsulation();

ser << qos_policy.m_type_identifier;
#if FASTCDR_VERSION_MAJOR == 1
payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length
size = (ser.getSerializedDataLength() + 3) & ~3;
#else
payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length
size = (ser.get_serialized_data_length() + 3) & ~3;
#endif // FASTCDR_VERSION_MAJOR == 1

bool valid = rtps::CDRMessage::addUInt16(cdr_message, qos_policy.Pid);
valid &= rtps::CDRMessage::addUInt16(cdr_message, static_cast<uint16_t>(size));
Expand All @@ -938,9 +933,6 @@ inline bool QosPoliciesSerializer<TypeIdV1>::read_content_from_cdr_message(
rtps::CDRMessage::readData(cdr_message, payload.data, parameter_length); // Object that manages the raw buffer.

eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN
#if FASTCDR_VERSION_MAJOR == 1
, eprosima::fastcdr::Cdr::CdrType::DDS_CDR
#endif // FASTCDR_VERSION_MAJOR == 1
);

try
Expand Down Expand Up @@ -988,13 +980,8 @@ inline bool QosPoliciesSerializer<TypeObjectV1>::add_to_cdr_message(
ser.serialize_encapsulation();

ser << qos_policy.m_type_object;
#if FASTCDR_VERSION_MAJOR == 1
payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length
size = (ser.getSerializedDataLength() + 3) & ~3;
#else
payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length
size = (ser.get_serialized_data_length() + 3) & ~3;
#endif // FASTCDR_VERSION_MAJOR == 1

bool valid = rtps::CDRMessage::addUInt16(cdr_message, qos_policy.Pid);
valid &= rtps::CDRMessage::addUInt16(cdr_message, static_cast<uint16_t>(size));
Expand All @@ -1020,9 +1007,6 @@ inline bool QosPoliciesSerializer<TypeObjectV1>::read_content_from_cdr_message(
rtps::CDRMessage::readData(cdr_message, payload.data, parameter_length); // Object that manages the raw buffer.

eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN
#if FASTCDR_VERSION_MAJOR == 1
, eprosima::fastcdr::Cdr::CdrType::DDS_CDR
#endif // FASTCDR_VERSION_MAJOR == 1
);

try
Expand Down Expand Up @@ -1071,13 +1055,8 @@ inline bool QosPoliciesSerializer<xtypes::TypeInformationParameter>::add_to_cdr_
ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2);

ser << qos_policy.type_information;
#if FASTCDR_VERSION_MAJOR == 1
payload.length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length
size = (ser.getSerializedDataLength() + 3) & ~3;
#else
payload.length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length
size = (ser.get_serialized_data_length() + 3) & ~3;
#endif // FASTCDR_VERSION_MAJOR == 1

bool valid = rtps::CDRMessage::addUInt16(cdr_message, qos_policy.Pid);
valid &= rtps::CDRMessage::addUInt16(cdr_message, static_cast<uint16_t>(size));
Expand Down
4 changes: 0 additions & 4 deletions src/cpp/fastdds/topic/DDSSQLFilter/DDSFilterExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ bool DDSFilterExpression::evaluate(
{
FastBuffer fastbuffer(reinterpret_cast<char*>(payload.data), payload.length);
Cdr deser(fastbuffer
#if FASTCDR_VERSION_MAJOR == 1
, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN
, eprosima::fastcdr::Cdr::CdrType::DDS_CDR
#endif // FASTCDR_VERSION_MAJOR == 1
);
deser.read_encapsulation();
traits<DynamicData>::narrow<DynamicDataImpl>(dyn_data_)->deserialize(deser);
Expand Down
28 changes: 0 additions & 28 deletions src/cpp/rtps/transport/tcp/TCPControlMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,7 @@ bool ConnectionRequest_t::serialize(
return false;
}

#if FASTCDR_VERSION_MAJOR == 1
payload->length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length
#else
payload->length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length
#endif // FASTCDR_VERSION_MAJOR == 1

return true;
}
Expand Down Expand Up @@ -256,11 +252,7 @@ bool OpenLogicalPortRequest_t::serialize(
return false;
}

#if FASTCDR_VERSION_MAJOR == 1
payload->length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length
#else
payload->length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length
#endif // FASTCDR_VERSION_MAJOR == 1

return true;
}
Expand Down Expand Up @@ -349,11 +341,7 @@ bool CheckLogicalPortsRequest_t::serialize(
return false;
}

#if FASTCDR_VERSION_MAJOR == 1
payload->length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length
#else
payload->length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length
#endif // FASTCDR_VERSION_MAJOR == 1

return true;
}
Expand Down Expand Up @@ -441,11 +429,7 @@ bool KeepAliveRequest_t::serialize(
return false;
}

#if FASTCDR_VERSION_MAJOR == 1
payload->length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length
#else
payload->length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length
#endif // FASTCDR_VERSION_MAJOR == 1

return true;
}
Expand Down Expand Up @@ -533,11 +517,7 @@ bool LogicalPortIsClosedRequest_t::serialize(
return false;
}

#if FASTCDR_VERSION_MAJOR == 1
payload->length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length
#else
payload->length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length
#endif // FASTCDR_VERSION_MAJOR == 1

return true;
}
Expand Down Expand Up @@ -625,11 +605,7 @@ bool BindConnectionResponse_t::serialize(
return false;
}

#if FASTCDR_VERSION_MAJOR == 1
payload->length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length
#else
payload->length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length
#endif // FASTCDR_VERSION_MAJOR == 1

return true;
}
Expand Down Expand Up @@ -718,11 +694,7 @@ bool CheckLogicalPortsResponse_t::serialize(
return false;
}

#if FASTCDR_VERSION_MAJOR == 1
payload->length = (uint32_t)ser.getSerializedDataLength(); //Get the serialized length
#else
payload->length = (uint32_t)ser.get_serialized_data_length(); //Get the serialized length
#endif // FASTCDR_VERSION_MAJOR == 1

return true;
}
Expand Down
9 changes: 0 additions & 9 deletions src/cpp/security/cryptography/AESGCMGMAC_Transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@
#undef max
#endif // ifdef WIN32

#if FASTCDR_VERSION_MAJOR == 1
#define change_endianness changeEndianness
#define get_serialized_data_length getSerializedDataLength
#define get_state getState
#define get_current_position getCurrentPosition
#define get_buffer_pointer getBufferPointer
#define set_state setState
#endif // FASTCDR_VERSION_MAJOR == 1

namespace eprosima {
namespace fastdds {
namespace rtps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

using namespace eprosima::fastdds::dds;

#if FASTCDR_VERSION_MAJOR > 1

class MockHelloWorldPubSubType : public HelloWorldPubSubType
{
public:
Expand Down Expand Up @@ -150,5 +148,3 @@ INSTANTIATE_TEST_SUITE_P(
std::make_tuple(XCDR2_VECTOR, XCDR2_VECTOR, true, XCDR2_DATA_REPRESENTATION, eprosima::fastcdr::PLAIN_CDR2),
std::make_tuple(XCDR2_VECTOR, BOTH_XCDR_VECTOR, true, XCDR2_DATA_REPRESENTATION, eprosima::fastcdr::PLAIN_CDR2)
));

#endif // FASTCDR_VERSION_MAJOR > 1
4 changes: 0 additions & 4 deletions test/blackbox/common/RTPSAsSocketWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,7 @@ class RTPSAsSocketWriter : public eprosima::fastdds::rtps::WriterListener

cdr << magicword_;
cdr << *it;
#if FASTCDR_VERSION_MAJOR == 1
ch->serializedPayload.length = static_cast<uint32_t>(cdr.getSerializedDataLength());
#else
ch->serializedPayload.length = static_cast<uint32_t>(cdr.get_serialized_data_length());
#endif // FASTCDR_VERSION_MAJOR == 1

history_->add_change(ch);
it = msgs.erase(it);
Expand Down
4 changes: 0 additions & 4 deletions test/blackbox/common/RTPSWithRegistrationReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,10 +576,6 @@ class RTPSWithRegistrationReader
eprosima::fastcdr::FastBuffer buffer((char*)change->serializedPayload.data,
change->serializedPayload.length);
eprosima::fastcdr::Cdr cdr(buffer
#if FASTCDR_VERSION_MAJOR == 1
, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN
, eprosima::fastcdr::Cdr::CdrType::DDS_CDR
#endif // FASTCDR_VERSION_MAJOR == 1
);

cdr.read_encapsulation();
Expand Down
Loading
Loading