Skip to content

Commit

Permalink
Improve equality operator for unions (#409)
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo González Moreno <[email protected]>
  • Loading branch information
richiware authored Oct 3, 2024
1 parent 471b331 commit c85b6d7
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/main/java/com/eprosima/fastcdr/idl/templates/TypesHeader.stg
Original file line number Diff line number Diff line change
Expand Up @@ -402,16 +402,25 @@ public:
{
bool ret_value {false};

if (m__d == x.m__d &&
selected_member_ == x.selected_member_)
if (x.selected_member_ == selected_member_)
{
switch (selected_member_)
if (0x0FFFFFFFu != selected_member_)
{
$union.members:{ member |
case $member.id$:
ret_value = (m_$member.name$ == x.m_$member.name$);
break;
}; separator="\n"$
if (x.m__d == m__d)
{
switch (selected_member_)
{
$union.members:{ member |
case $member.id$:
ret_value = (x.m_$member.name$ == m_$member.name$);
break;
}; separator="\n"$
}
}
}
else
{
ret_value = true;
}
}

Expand Down

0 comments on commit c85b6d7

Please sign in to comment.