From d95a389143afbcf1306c0a941a99d79eb041f210 Mon Sep 17 00:00:00 2001 From: JLBuenoLopez-eProsima Date: Thu, 20 Jul 2023 14:32:16 +0200 Subject: [PATCH 1/6] Refs #19236: fix bitmask type Signed-off-by: JLBuenoLopez-eProsima --- .../fastcdr/idl/templates/TypesHeader.stg | 93 +++++++++++++++++- .../fastcdr/idl/templates/TypesSource.stg | 96 ++++++++++++++++++- 2 files changed, 185 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg index abbaf1ab..4146fafc 100644 --- a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg +++ b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg @@ -418,9 +418,79 @@ bitmask_type(ctx, parent, bitmask) ::= << * @brief This class represents the bitmask $bitmask.name$ defined by the user in the IDL file. * @ingroup $ctx.trimfilename$ */ -enum $bitmask.name$$bitmask.boundType$ +class $bitmask.name$ { - $bitmask.members:{ member | $member.name$ = 0x01ull << $member.position$}; separator=",\n"$ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport $bitmask.name$(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~$bitmask.name$(); + + /*! + * @brief Copy constructor. + * + * @param x Reference to the object $bitmask.scopedname$ that will be copied. + */ + eProsima_user_DllExport $bitmask.name$( + const $bitmask.name$& x); + + /*! + * @brief Move constructor. + * + * @param x Reference to the object $bitmask.scopedname$ that will be copied. + */ + eProsima_user_DllExport $bitmask.name$( + $bitmask.name$&& x) noexcept; + + /*! + * @brief Copy assignment. + * + * @param x Reference to the object $bitmask.scopedname$ that will be copied. + */ + eProsima_user_DllExport $bitmask.name$& operator =( + const $bitmask.name$& x); + + /*! + * @brief Move assignment. + * + * @param x Reference to the object $bitmask.scopedname$ that will be copied. + */ + eProsima_user_DllExport $bitmask.name$& operator =( + $bitmask.name$&& x) noexcept; + + /*! + * @brief Comparison operator. + * + * @param x $bitmask.scopedname$ object to compare. + */ + eProsima_user_DllExport bool operator ==( + const $bitmask.name$& x) const; + + /*! + * @brief Comparison operator. + * + * @param x $bitmask.scopedname$ object to compare. + */ + eProsima_user_DllExport bool operator !=( + const $bitmask.name$& x) const; + + $bitmask.members:{$public_bitflag_declaration(it)$}; separator="\n"$ + + eProsima_user_DllExport const std::bitset<$bitmask.bitBound$>& bitmask() const; + + eProsima_user_DllExport std::bitset<$bitmask.bitBound$>& bitmask(); + + $serialization_functions(bitmask)$ + +private: + + std::bitset<$bitmask.bitBound$> m_bitmask; }; >> @@ -619,7 +689,24 @@ eProsima_user_DllExport const $member.typecode.cppTypename$& $member.name$() con eProsima_user_DllExport $member.typecode.cppTypename$& $member.name$(); >> -member_default_init(member) ::= <% +public_bitflag_declaration(member) ::= << +/*! + * @brief This function sets a value in flag $member.name$ + * + * @param _$member.name$ New value for flag $member.name$ + */ +eProsima_user_DllExport void $member.name$( + bool _$member.name$); + +/*! + * @brief This function returns the value of flag $member.name$ + * + * @return Value of flag $member.name$ + */ +eProsima_user_DllExport bool $member.name$() const; +>> + +member_default_init(member) ::= <<% $if(!member.typecode.forwarded)$ $if(member.annotationDefault)$ {$member.annotationDefaultValue$} diff --git a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSource.stg b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSource.stg index da32acdd..ce48d49d 100644 --- a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSource.stg +++ b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSource.stg @@ -516,7 +516,101 @@ $endif$ enum_type(ctx, parent, enum) ::= <<>> -bitmask_type(ctx, parent, bitmask) ::= <<>> +bitmask_type(ctx, parent, bitmask) ::= << +$bitmask.scopedname$::$bitmask.name$() +{ + $if(ctx.generateTypeObject)$ + // Just to register all known types + register$ctx.filename$Types(); + $endif$ +} + +$bitmask.scopedname$::~$bitmask.name$() +{ +} + +$bitmask.scopedname$::$bitmask.name$( + const $bitmask.name$& x) +{ + m_bitmask = x.m_bitmask; +} + +$bitmask.scopedname$::$bitmask.name$( + $bitmask.name$&& x) noexcept +{ + m_bitmask = x.m_bitmask; +} + +$bitmask.scopedname$& $bitmask.scopedname$::operator =( + const $bitmask.name$& x) +{ + m_bitmask = x.m_bitmask; + + return *this; +} + +$bitmask.scopedname$& $bitmask.scopedname$::operator =( + $bitmask.name$&& x) noexcept +{ + m_bitmask = x.m_bitmask; + + return *this; +} + +bool $bitmask.scopedname$::operator ==( + const $bitmask.name$& x) const +{ + return m_bitmask == x.m_bitmask; +} + +bool $bitmask.scopedname$::operator !=( + const $bitmask.name$& x) const +{ + return !(*this == x); +} + +$if(ctx.fastcdr)$ +void $bitmask.scopedname$::serialize( + eprosima::fastcdr::FastCdr& scdr) const +{ + scdr << m_bitmask; +} + +void $bitmask.scopedname$::deserialize( + eprosima::fastcdr::FastCdr& dcdr) +{ + dcdr \>> m_bitmask; +} + +$endif$ + + +$bitmask.members:{$public_bitmask_definition(it)$}; separator="\n"$ + +const std::bitset<$bitmask.bitBound$>& $bitmask.scopedname$::bitmask() const +{ + return m_bitmask; +} + +std::bitset<$bitmask.bitBound$>& $bitmask.scopedname$::bitmask() +{ + return m_bitmask; +} + +>> + +public_bitmask_definition(member) ::= << +void $bitmask.scopedname$::$member.name$( + bool _$member.name$) +{ + m_bitmask.set($member.position$, _$member.name$); +} + +bool $bitmask.scopedname$::$member.name$() const +{ + return m_bitmask.test($member.position$); +} +>> /***** Utils *****/ From d0de85022928dd84a09407141eac0a164e5fe827 Mon Sep 17 00:00:00 2001 From: JLBuenoLopez-eProsima Date: Thu, 20 Jul 2023 16:19:59 +0200 Subject: [PATCH 2/6] Refs #19236: add Fast CDR external auxiliary methods Signed-off-by: JLBuenoLopez-eProsima --- .../idl/templates/TypesCdrAuxHeader.stg | 19 ++++++++++- .../idl/templates/TypesCdrAuxHeaderImpl.stg | 32 ++++++++++++++++++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeader.stg b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeader.stg index e7b46369..d93854d0 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeader.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeader.stg @@ -95,4 +95,21 @@ union_type(ctx, parent, union) ::= <<>> enum_type(ctx, parent, enum) ::= <<>> -bitmask_type(ctx, parent, bitmask) ::= <<>> +bitmask_type(ctx, parent, bitmask) ::= << +$if(ctx.anyCdr)$ +size_t calculate_serialized_size( + eprosima::fastcdr::CdrSizeCalculator& calculator, + const $bitmask.scopedname$& data, + size_t current_alignment); +$endif$ + +$if(ctx.cdr)$ +void serialize( + eprosima::fastcdr::Cdr& scdr, + cons $bitmask.scopedname$& data); + +void deserialize( + eprosima::fastcdr::Cdr& dcdr, + $bitmask.scopedname$& data); +$endif$ +>> diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg index 6695b44d..717f9bec 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg @@ -321,4 +321,34 @@ $endif$ enum_type(ctx, parent, enum) ::= <<>> -bitmask_type(ctx, parent, bitmask) ::= <<>> +bitmask_type(ctx, parent, bitmask) ::= << +$if(ctx.anyCdr)$ +size_t calculate_serialized_size( + eprosima::fastcdr::CdrSizeCalulator& calculator, + const $bitmask.scopedname$& data, + size_t current_alignment) +{ + size_t initial_alignment = current_alignment; + + current_alignment += calculator.calculate_serialized_size(data.bitmask(), current_alignment); + + return current_alignment - initial_alignment; +} +$endif$ + +$if(ctx.cdr)$ +void serialize( + eprosima::fastcdr::Cdr& scdr, + const $bitmask.scopedname$& data) +{ + scdr << data.bitmask(); +} + +void deserialize( + eprosima::fastcdr::Cdr& dcdr, + $bitmask.scopedname$& data) +{ + dcdr \>> data.bitmask(); +} +$endif$ +>> From a3271ae752fb1e4c514acda6778da61f53b14920 Mon Sep 17 00:00:00 2001 From: JLBuenoLopez-eProsima Date: Mon, 24 Jul 2023 09:00:47 +0200 Subject: [PATCH 3/6] Refs #19236: fix typos Signed-off-by: JLBuenoLopez-eProsima --- .../com/eprosima/fastdds/idl/templates/TypesCdrAuxHeader.stg | 2 +- .../eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeader.stg b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeader.stg index d93854d0..6a63f7ee 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeader.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeader.stg @@ -106,7 +106,7 @@ $endif$ $if(ctx.cdr)$ void serialize( eprosima::fastcdr::Cdr& scdr, - cons $bitmask.scopedname$& data); + const $bitmask.scopedname$& data); void deserialize( eprosima::fastcdr::Cdr& dcdr, diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg index 717f9bec..a764fc85 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg @@ -324,7 +324,7 @@ enum_type(ctx, parent, enum) ::= <<>> bitmask_type(ctx, parent, bitmask) ::= << $if(ctx.anyCdr)$ size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalulator& calculator, + eprosima::fastcdr::CdrSizeCalculator& calculator, const $bitmask.scopedname$& data, size_t current_alignment) { From f8c2a46fc29b1d2be4438ea32cf722bf0ff0c799 Mon Sep 17 00:00:00 2001 From: JLBuenoLopez-eProsima Date: Mon, 24 Jul 2023 10:14:46 +0200 Subject: [PATCH 4/6] Refs #19236: fix bitmask serialization code Signed-off-by: JLBuenoLopez-eProsima --- .../idl/templates/SerializationSource.stg | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/SerializationSource.stg b/src/main/java/com/eprosima/fastdds/idl/templates/SerializationSource.stg index 77bae39b..547976e2 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/SerializationSource.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/SerializationSource.stg @@ -148,7 +148,29 @@ int $if(union.hasScope)$$union.scope$::$endif$compare$union.name$( enum_type(ctx, parent, enum) ::= <<>> -bitmask_type(ctx, parent, bitmask) ::= <<>> +bitmask_type(ctx, parent, bitmask) ::= << +void $if(bitmask.hasScope)$$bitmask.scope$::$endif$print$bitmask.name$( + $bitmask.name$* topic) +{ + printf("$bitmask.name$: { \n"); + $bitmask.members:{printf("$it.name$: %s\n", topic->$it.name$() ? "true" : "false");}; separator="\n"$ +} + +void $if(bitmask.hasScope)$$bitmask.scope$::$endif$initialize$bitmask.name$( + $bitmask.name$* topic) +{ + $bitmask.members:{topic->$it.name$(static_cast(rand()%2==1));}; separator="\n"$ +} + +int $if(bitmask.hasScope)$$bitmask.scope$::$endif$compare$bitmask.name$( + $bitmask.name$* topic_a, + $bitmask.name$* topic_b) +{ + $bitmask.members:{if(topic_a->$it.name$() != topic_b->$it.name$()) return 0;$endif$}; separator="\n"$ + return 1; +} + +>> typedef_decl(ctx, parent, typedefs) ::= <<>> From 84a3c1b668fd82e49320c99ec9e638584c1617e5 Mon Sep 17 00:00:00 2001 From: JLBuenoLopez-eProsima Date: Thu, 27 Jul 2023 08:52:36 +0200 Subject: [PATCH 5/6] Refs #19236: fix warnings upgrading to ST4 Signed-off-by: JLBuenoLopez-eProsima --- .../fastcdr/idl/templates/TypesHeader.stg | 4 +++- .../fastcdr/idl/templates/TypesSource.stg | 7 ++++++- .../idl/templates/SerializationHeader.stg | 13 ++++++++++++- .../idl/templates/SerializationSource.stg | 6 +++--- .../idl/templates/TypesCdrAuxHeader.stg | 19 +------------------ .../idl/templates/TypesCdrAuxHeaderImpl.stg | 13 +++++++++---- 6 files changed, 34 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg index 4146fafc..f6ae4b8f 100644 --- a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg +++ b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg @@ -480,12 +480,14 @@ public: eProsima_user_DllExport bool operator !=( const $bitmask.name$& x) const; - $bitmask.members:{$public_bitflag_declaration(it)$}; separator="\n"$ + $bitmask.members:{ it | $public_bitflag_declaration(it)$}; separator="\n"$ eProsima_user_DllExport const std::bitset<$bitmask.bitBound$>& bitmask() const; eProsima_user_DllExport std::bitset<$bitmask.bitBound$>& bitmask(); + eProsima_user_DllExport void bitmask(const std::bitset<$bitmask.bitBound$>&); + $serialization_functions(bitmask)$ private: diff --git a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSource.stg b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSource.stg index ce48d49d..f03e6995 100644 --- a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSource.stg +++ b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSource.stg @@ -585,7 +585,7 @@ void $bitmask.scopedname$::deserialize( $endif$ -$bitmask.members:{$public_bitmask_definition(it)$}; separator="\n"$ +$bitmask.members:{ it | $public_bitmask_definition(it)$}; separator="\n"$ const std::bitset<$bitmask.bitBound$>& $bitmask.scopedname$::bitmask() const { @@ -597,6 +597,11 @@ std::bitset<$bitmask.bitBound$>& $bitmask.scopedname$::bitmask() return m_bitmask; } +void $bitmask.scopedname$::bitmask(const std::bitset<$bitmask.bitBound$>& bitmask) +{ + m_bitmask = bitmask; +} + >> public_bitmask_definition(member) ::= << diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/SerializationHeader.stg b/src/main/java/com/eprosima/fastdds/idl/templates/SerializationHeader.stg index 774110f7..0db7af6b 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/SerializationHeader.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/SerializationHeader.stg @@ -70,7 +70,18 @@ enum_type(ctx, parent, enum) ::= <<>> typedef_decl(ctx, parent, typedefs) ::= <<>> -bitmask_type(ctx, parent, bitmask) ::= <<>> +bitmask_type(ctx, parent, bitmask) ::= << +void print$bitmask.name$( + $bitmask.name$* topic); + +void initialize$bitmask.name$( + $bitmask.name$* topic); + +int compare$bitmask.name$( + $bitmask.name$* a, + $bitmask.name$* b); + +>> bitset_type(ctx, parent, bitset) ::= << void print$bitset.name$( diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/SerializationSource.stg b/src/main/java/com/eprosima/fastdds/idl/templates/SerializationSource.stg index 547976e2..f121e57c 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/SerializationSource.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/SerializationSource.stg @@ -153,20 +153,20 @@ void $if(bitmask.hasScope)$$bitmask.scope$::$endif$print$bitmask.name$( $bitmask.name$* topic) { printf("$bitmask.name$: { \n"); - $bitmask.members:{printf("$it.name$: %s\n", topic->$it.name$() ? "true" : "false");}; separator="\n"$ + $bitmask.members:{ it | printf("$it.name$: %s\n", topic->$it.name$() ? "true" : "false");}; separator="\n"$ } void $if(bitmask.hasScope)$$bitmask.scope$::$endif$initialize$bitmask.name$( $bitmask.name$* topic) { - $bitmask.members:{topic->$it.name$(static_cast(rand()%2==1));}; separator="\n"$ + $bitmask.members:{ it | topic->$it.name$(static_cast(rand()%2==1));}; separator="\n"$ } int $if(bitmask.hasScope)$$bitmask.scope$::$endif$compare$bitmask.name$( $bitmask.name$* topic_a, $bitmask.name$* topic_b) { - $bitmask.members:{if(topic_a->$it.name$() != topic_b->$it.name$()) return 0;$endif$}; separator="\n"$ + $bitmask.members:{ it | if(topic_a->$it.name$() != topic_b->$it.name$()) return 0;}; separator="\n"$ return 1; } diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeader.stg b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeader.stg index 6a63f7ee..e7b46369 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeader.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeader.stg @@ -95,21 +95,4 @@ union_type(ctx, parent, union) ::= <<>> enum_type(ctx, parent, enum) ::= <<>> -bitmask_type(ctx, parent, bitmask) ::= << -$if(ctx.anyCdr)$ -size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const $bitmask.scopedname$& data, - size_t current_alignment); -$endif$ - -$if(ctx.cdr)$ -void serialize( - eprosima::fastcdr::Cdr& scdr, - const $bitmask.scopedname$& data); - -void deserialize( - eprosima::fastcdr::Cdr& dcdr, - $bitmask.scopedname$& data); -$endif$ ->> +bitmask_type(ctx, parent, bitmask) ::= <<>> diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg index a764fc85..a7521a5f 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg @@ -323,7 +323,8 @@ enum_type(ctx, parent, enum) ::= <<>> bitmask_type(ctx, parent, bitmask) ::= << $if(ctx.anyCdr)$ -size_t calculate_serialized_size( +template<> +eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, const $bitmask.scopedname$& data, size_t current_alignment) @@ -337,18 +338,22 @@ size_t calculate_serialized_size( $endif$ $if(ctx.cdr)$ -void serialize( +template<> +eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr& scdr, const $bitmask.scopedname$& data) { scdr << data.bitmask(); } -void deserialize( +template<> +eProsima_user_DllExport void deserialize( eprosima::fastcdr::Cdr& dcdr, $bitmask.scopedname$& data) { - dcdr \>> data.bitmask(); + std::bitset<$bitmask.bitBound$> bitmask; + dcdr \>> bitmask; + data.bitmask(bitmask); } $endif$ >> From 5b330040b9a5f413cc1625c00e982bf4afdb26a7 Mon Sep 17 00:00:00 2001 From: JLBuenoLopez-eProsima Date: Tue, 5 Sep 2023 14:57:26 +0200 Subject: [PATCH 6/6] Refs #19236: fix bitmask tests after rebase Signed-off-by: JLBuenoLopez-eProsima --- .../com/eprosima/fastcdr/idl/templates/TypesHeader.stg | 2 +- .../fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg index f6ae4b8f..060d9a62 100644 --- a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg +++ b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg @@ -708,7 +708,7 @@ eProsima_user_DllExport void $member.name$( eProsima_user_DllExport bool $member.name$() const; >> -member_default_init(member) ::= <<% +member_default_init(member) ::= <% $if(!member.typecode.forwarded)$ $if(member.annotationDefault)$ {$member.annotationDefaultValue$} diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg index a7521a5f..f0d4e81f 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypesCdrAuxHeaderImpl.stg @@ -327,13 +327,9 @@ template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, const $bitmask.scopedname$& data, - size_t current_alignment) + size_t& current_alignment) { - size_t initial_alignment = current_alignment; - - current_alignment += calculator.calculate_serialized_size(data.bitmask(), current_alignment); - - return current_alignment - initial_alignment; + return calculator.calculate_serialized_size(data.bitmask(), current_alignment); } $endif$