Skip to content

Commit

Permalink
Refs #3061. Fixed (de)serialization of bool.
Browse files Browse the repository at this point in the history
  • Loading branch information
MiguelCompany committed Jul 6, 2018
1 parent b4d0853 commit 845634c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ static bool __cdr_serialize(
return false;
}
cdr << str->data;
@[ elif field.type.type == 'bool']@
cdr << (ros_message->@(field.name) ? true : false);
@[ elif field.type.is_primitive_type()]@
cdr << ros_message->@(field.name);
@[ else]@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ cdr_serialize(
@[ end if]@
@[ end if]@
}
@[ elif field.type.type == 'bool']@
cdr << (ros_message.@(field.name) ? true : false);
@[ elif field.type.is_primitive_type()]@
cdr << ros_message.@(field.name);
@[ else]@
Expand Down Expand Up @@ -174,6 +176,12 @@ cdr_deserialize(
@[ end if]@
@[ end if]@
}
@[ elif field.type.type == 'bool']@
{
uint8_t tmp;
cdr >> tmp;
ros_message.@(field.name) = tmp ? true : false;
}
@[ elif field.type.is_primitive_type()]@
cdr >> ros_message.@(field.name);
@[ else]@
Expand Down

0 comments on commit 845634c

Please sign in to comment.