Skip to content

Commit

Permalink
Refs #18687. Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo González Moreno <[email protected]>
  • Loading branch information
richiware committed Jul 27, 2023
1 parent db6da3f commit 0db2977
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 65 deletions.
31 changes: 20 additions & 11 deletions src/main/java/com/eprosima/fastcdr/idl/templates/TypesSource.stg
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,11 @@ $endif$
>>

struct_type(ctx, parent, struct, extensions) ::= <<
$struct.scopedname$::$struct.name$()$if(struct.inheritances)$
: $struct.inheritances : { inheritance | $struct_inherit_default_init(inheritance)$ }; separator=",\n"$ $endif$
$struct.scopedname$::$struct.name$()
$if(struct.inheritances)$
: $struct.inheritances : { inheritance | $struct_inherit_default_init(inheritance)$ }; separator=",\n"$
$endif$

{
$struct.members:{ member |$member_default_init(ctx=ctx, member=member, loopvar=ctx.newLoopVarName)$}; separator="\n"$

Expand All @@ -193,23 +196,29 @@ $struct.scopedname$::~$struct.name$()
}

$struct.scopedname$::$struct.name$(
const $struct.name$& x)$if(struct.inheritances)$
: $struct.inheritances : { inheritance | $struct_inherit_copy_init(inheritance)$ }; separator=",\n"$ $endif$
const $struct.name$& x)
$if(struct.inheritances)$
: $struct.inheritances : { inheritance | $struct_inherit_copy_init(inheritance)$ }; separator=",\n"$
$endif$

{
$struct.members:{ member | $member_copy(ctx=ctx, member=member)$}; separator="\n"$
}

$struct.scopedname$::$struct.name$(
$struct.name$&& x) noexcept $if(struct.inheritances)$
: $struct.inheritances : { inheritance | $struct_inherit_move_init(inheritance)$}; separator=",\n"$ $endif$
$struct.name$&& x) noexcept
$if(struct.inheritances)$
: $struct.inheritances : { inheritance | $struct_inherit_move_init(inheritance)$}; separator=",\n"$
$endif$

{
$struct.members:{ member | $member_move(member=member)$}; separator="\n"$
}

$struct.scopedname$& $struct.scopedname$::operator =(
const $struct.name$& x)
{
$if(struct.inheritances)$ $struct.inheritances : { inheritance | $inheritance.scopedname$::operator =(x);}; separator="\n"$ $endif$
$if(struct.inheritances)$ $struct.inheritances : { inheritance | $inheritance.scopedname$::operator =(x);}; separator="\n"$ $endif$

$struct.members:{ member | $member_copy(ctx=ctx, member=member)$}; separator="\n"$

Expand All @@ -219,7 +228,7 @@ $struct.scopedname$& $struct.scopedname$::operator =(
$struct.scopedname$& $struct.scopedname$::operator =(
$struct.name$&& x) noexcept
{
$if(struct.inheritances)$ $struct.inheritances : { inheritance | $inheritance.scopedname$::operator =(std::move(x));}; separator="\n"$ $endif$
$if(struct.inheritances)$ $struct.inheritances : { inheritance | $inheritance.scopedname$::operator =(std::move(x));}; separator="\n"$ $endif$

$struct.members:{ member | $member_move(member=member)$}; separator="\n"$

Expand All @@ -229,7 +238,7 @@ $struct.scopedname$& $struct.scopedname$::operator =(
bool $struct.scopedname$::operator ==(
const $struct.name$& x) const
{
$if(struct.inheritances)$ $struct.inheritances : { inheritance | if ($inheritance.scopedname$::operator !=(x)) return false;}; separator="\n"$ $endif$
$if(struct.inheritances)$ $struct.inheritances : { inheritance | if ($inheritance.scopedname$::operator !=(x)) return false;}; separator="\n"$ $endif$

return $if(struct.members)$($struct.members:{ member | m_$member.name$ == x.m_$member.name$}; separator=" && "$)$else$true$endif$;
}
Expand All @@ -244,15 +253,15 @@ $if(ctx.fastcdr)$
void $struct.scopedname$::serialize(
eprosima::fastcdr::FastCdr &scdr) const
{
$if(struct.inheritances)$ $struct.inheritances : { inheritance | $inheritance.scopedname$::serialize(scdr);}; separator="\n"$ $endif$
$if(struct.inheritances)$ $struct.inheritances : { inheritance | $inheritance.scopedname$::serialize(scdr);}; separator="\n"$ $endif$

$struct.members : { member |$if(!member.annotationNonSerialized)$$object_serialization(ctx=ctx, object=member)$$endif$}; separator=""$
}

void $struct.scopedname$::deserialize(
eprosima::fastcdr::FastCdr& dcdr)
{
$if(struct.inheritances)$ $struct.inheritances : { inheritance | $inheritance.scopedname$::deserialize(dcdr);}; separator="\n"$ $endif$
$if(struct.inheritances)$ $struct.inheritances : { inheritance | $inheritance.scopedname$::deserialize(dcdr);}; separator="\n"$ $endif$

$struct.members : { member |$if(!member.annotationNonSerialized)$$object_deserialization(ctx=ctx, object=member)$$endif$}; separator="\n"$
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public boolean isPrintoperation()

public String getProduct()
{
return "fastcdr";
return "fastdds";
}

public String getNamespace()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ eProsima_user_DllExport const TypeObject* GetComplete$annotation.name$Object();

namespace $annotation.name$
{
$annotation.enums : {$enum_type(ctx=ctx, parent=annotation, enum=it)$}; separator="\n"$
$annotation.enums : { it | $enum_type(ctx=ctx, parent=annotation, enum=it)$}; separator="\n"$

$annotation.typeDefs : {$typedef_decl(ctx=ctx, parent=annotation, typedefs=it)$}; separator="\n"$
$annotation.typeDefs : { it | $typedef_decl(ctx=ctx, parent=annotation, typedefs=it)$}; separator="\n"$
}

>>
Expand Down
Loading

0 comments on commit 0db2977

Please sign in to comment.