From bd4f8be867bd69179d7b5ac24677b9d8cba852a3 Mon Sep 17 00:00:00 2001 From: eduponz Date: Tue, 16 Jul 2024 14:34:52 +0200 Subject: [PATCH] Refs #21325: Remove FASTCDR_VERSION_MAJOR == 1 related code Signed-off-by: eduponz --- .../idl/templates/TypesSwigInterface.stg | 6 ---- .../idl/templates/DDSPubSubTypeSource.stg | 30 +------------------ 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSwigInterface.stg b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSwigInterface.stg index cbd12bda..156d344e 100644 --- a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSwigInterface.stg +++ b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSwigInterface.stg @@ -52,9 +52,7 @@ $ctx.directIncludeDependencies : {include | %include "$include$.i"}; separator=" %} %include -#if FASTCDR_VERSION_MAJOR > 1 %import(module="fastdds") "fastcdr/xcdr/optional.hpp" -#endif %import(module="fastdds") "fastdds/dds/core/LoanableCollection.hpp" %import(module="fastdds") "fastdds/dds/core/LoanableTypedCollection.hpp" %import(module="fastdds") "fastdds/dds/core/LoanableSequence.hpp" @@ -147,9 +145,6 @@ $endif$ member_getters(struct_name, member) ::= << $if(member.annotationOptional)$ -#if FASTCDR_VERSION_MAJOR == 1 -%ignore $struct_name$::$member.name$($member.typecode.cppTypename$&&); -#else %ignore eprosima::fastcdr::optional::value; %ignore eprosima::fastcdr::optional::reset; %template($member.typecode.noScopedCppTypename$Opt) eprosima::fastcdr::optional<$member.typecode.cppTypename$>; @@ -163,7 +158,6 @@ $if(member.annotationOptional)$ } } %ignore $struct_name$::$member.name$(eprosima::fastcdr::optional<$member.typecode.cppTypename$>&&); -#endif $else$ %ignore $struct_name$::$member.name$($member.typecode.cppTypename$&&); $endif$ diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/DDSPubSubTypeSource.stg b/src/main/java/com/eprosima/fastdds/idl/templates/DDSPubSubTypeSource.stg index 40509350..391d23fe 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/DDSPubSubTypeSource.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/DDSPubSubTypeSource.stg @@ -54,12 +54,7 @@ $member_list$ $struct.name$PubSubType::$struct.name$PubSubType() { $if(ctx.GenerateTypesROS2)$setName("$struct.ROS2Scopedname$");$else$setName("$struct.scopedname$");$endif$ - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast($struct.name$::getMaxCdrSerializedSize()); -#else - $struct.cScopedname$_max_cdr_typesize; -#endif + uint32_t type_size = $struct.cScopedname$_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ m_typeSize = type_size + 4; /*encapsulation*/ m_isGetKeyDefined = $if(struct.hasKey)$true$else$false$endif$; @@ -90,12 +85,10 @@ bool $struct.name$PubSubType::serialize( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; -#if FASTCDR_VERSION_MAJOR > 1 ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? $if(struct.annotationFinal || struct.annotationAppendable)$eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR $elseif(struct.annotationMutable)$eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR$endif$ : $if(struct.annotationFinal)$eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2$elseif(struct.annotationAppendable)$eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2$elseif(struct.annotationMutable)$eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2$endif$); -#endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -110,11 +103,7 @@ bool $struct.name$PubSubType::serialize( } // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 return true; } @@ -132,9 +121,6 @@ bool $struct.name$PubSubType::deserialize( // Object that deserializes the data. 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 ); // Deserialize encapsulation. @@ -158,11 +144,6 @@ std::function $struct.name$PubSubType::getSerializedSizeProvider( { return [data, data_representation]() -> uint32_t { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast<$struct.name$*>(data))) + - 4u /*encapsulation*/; -#else try { eprosima::fastcdr::CdrSizeCalculator calculator( @@ -177,7 +158,6 @@ std::function $struct.name$PubSubType::getSerializedSizeProvider( { return 0; } -#endif // FASTCDR_VERSION_MAJOR == 1 }; } @@ -210,19 +190,11 @@ bool $struct.name$PubSubType::getKey( // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || $struct.cScopedname$_max_key_cdr_typesize > 16) { m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 m_md5.finalize(); for (uint8_t i = 0; i < 16; ++i) {