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) ::= <<>>