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 b1ae5196..4766e621 100644 --- a/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSource.stg +++ b/src/main/java/com/eprosima/fastcdr/idl/templates/TypesSource.stg @@ -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"$ @@ -193,15 +196,21 @@ $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"$ } @@ -209,7 +218,7 @@ $struct.scopedname$::$struct.name$( $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"$ @@ -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"$ @@ -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$; } @@ -244,7 +253,7 @@ $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=""$ } @@ -252,7 +261,7 @@ void $struct.scopedname$::serialize( 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"$ } diff --git a/src/main/java/com/eprosima/fastdds/idl/grammar/Context.java b/src/main/java/com/eprosima/fastdds/idl/grammar/Context.java index 9fb7458c..cdc3eaf3 100644 --- a/src/main/java/com/eprosima/fastdds/idl/grammar/Context.java +++ b/src/main/java/com/eprosima/fastdds/idl/grammar/Context.java @@ -319,7 +319,7 @@ public boolean isPrintoperation() public String getProduct() { - return "fastcdr"; + return "fastdds"; } public String getNamespace() diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectHeader.stg b/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectHeader.stg index d070b0af..cd6baba3 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectHeader.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectHeader.stg @@ -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"$ } >> diff --git a/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectSource.stg b/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectSource.stg index 9cfcc47d..f1fa0cc3 100644 --- a/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectSource.stg +++ b/src/main/java/com/eprosima/fastdds/idl/templates/TypeObjectSource.stg @@ -92,26 +92,26 @@ $endif$ register_annotation_types(annotation) ::= << -$annotation.enums : {$register_annotation_enum(it)$}; separator="\n"$ +$annotation.enums : { it | $register_annotation_enum(it)$}; separator="\n"$ -$annotation.typeDefs : {$register_annotation_typedef(it)$}; separator="\n"$ +$annotation.typeDefs : { it | $register_annotation_typedef(it)$}; separator="\n"$ >> register_annotation_enum(enum) ::= << -factory->add_type_object("$enum.name$", $if(object.hasScope)$$object.scope$::$endif$Get$enum.name$Identifier(true), - $if(object.hasScope)$$object.scope$::$endif$Get$enum.name$Object(true)); -factory->add_type_object("$enum.name$", $if(object.hasScope)$$object.scope$::$endif$Get$enum.name$Identifier(false), - $if(object.hasScope)$$object.scope$::$endif$Get$enum.name$Object(false)); +factory->add_type_object("$enum.name$", $if(enum.hasScope)$$enum.scope$::$endif$Get$enum.name$Identifier(true), + $if(enum.hasScope)$$enum.scope$::$endif$Get$enum.name$Object(true)); +factory->add_type_object("$enum.name$", $if(enum.hasScope)$$enum.scope$::$endif$Get$enum.name$Identifier(false), + $if(enum.hasScope)$$enum.scope$::$endif$Get$enum.name$Object(false)); >> register_annotation_typedef(typedef) ::= << factory->add_type_object("$typedef.name$", - $if(object.hasScope)$$object.scope$::$endif$Get$typedef.name$Identifier(true), - $if(object.hasScope)$$object.scope$::$endif$Get$typedef.name$Object(true)); + $if(typedef.hasScope)$$typedef.scope$::$endif$Get$typedef.name$Identifier(true), + $if(typedef.hasScope)$$typedef.scope$::$endif$Get$typedef.name$Object(true)); factory->add_type_object("$typedef.name$", - $if(object.hasScope)$$object.scope$::$endif$Get$typedef.name$Identifier(false), - $if(object.hasScope)$$object.scope$::$endif$Get$typedef.name$Object(false)); + $if(typedef.hasScope)$$typedef.scope$::$endif$Get$typedef.name$Identifier(false), + $if(typedef.hasScope)$$typedef.scope$::$endif$Get$typedef.name$Object(false)); >> module(ctx, parent, module, definition_list) ::= << @@ -249,9 +249,9 @@ 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"$ } // $annotation.name$ namespace >> @@ -611,17 +611,17 @@ const TypeObject* GetComplete$enum.name$Object() for(int i = 0; i < 4; ++i) { annParam.paramname_hash()[i] = message_hash.digest[i]; - } + \} AnnotationParameterValue paramValue; paramValue._d($annval.typecode.typeIdentifier$); paramValue.from_string("$annval.value$"); annParam.value(paramValue); ann.param_seq().push_back(annParam); -} +\} };separator="\n"$ $endif$ type_object->complete().enumerated_type().header().detail().ann_custom().push_back(ann); -} +\} }; separator="\n"$ $endif$ @@ -703,17 +703,17 @@ $object.annotationList:{ ann | for(int i = 0; i < 4; ++i) { annParam.paramname_hash()[i] = message_hash.digest[i]; - } + \} AnnotationParameterValue paramValue; paramValue._d($annval.typecode.typeIdentifier$); paramValue.from_string("$annval.value$"); annParam.value(paramValue); ann.param_seq().push_back(annParam); - } + \} };separator="\n"$ $endif$ cel_$object.name$.detail().ann_custom().push_back(ann); -} +\} }; separator="\n"$ $endif$ @@ -774,7 +774,7 @@ const TypeObject* GetMinimal$struct.name$Object() // TODO Inheritance //type_object->minimal().struct_type().header().base_type()._d(EK_MINIMAL); //type_object->minimal().struct_type().header().base_type().equivalence_hash()[0..13]; - $struct.inheritances:{$minimal_struct_inheritance(it)$}; separator="\n"$ + $struct.inheritances:{ it | $minimal_struct_inheritance(it)$}; separator="\n"$ TypeIdentifier identifier; identifier._d(EK_MINIMAL); @@ -828,7 +828,7 @@ const TypeObject* GetComplete$struct.name$Object() // Header type_object->complete().struct_type().header().detail().type_name("$struct.name$"); // TODO inheritance - $struct.inheritances:{$complete_struct_inheritance(it)$}; separator="\n"$ + $struct.inheritances:{ it | $complete_struct_inheritance(it)$}; separator="\n"$ $if(struct.annotationList)$ $struct.annotationList:{ ann | @@ -844,17 +844,17 @@ const TypeObject* GetComplete$struct.name$Object() for(int i = 0; i < 4; ++i) { annParam.paramname_hash()[i] = message_hash.digest[i]; - } + \} AnnotationParameterValue paramValue; paramValue._d($annval.typecode.typeIdentifier$); paramValue.from_string("$annval.value$"); annParam.value(paramValue); ann.param_seq().push_back(annParam); -} +\} };separator="\n"$ $endif$ type_object->complete().struct_type().header().detail().ann_custom().push_back(ann); -} +\} }; separator="\n"$ $endif$ @@ -959,17 +959,17 @@ $object.annotationList:{ ann | for(int i = 0; i < 4; ++i) { annParam.paramname_hash()[i] = message_hash.digest[i]; - } + \} AnnotationParameterValue paramValue; paramValue._d($annval.typecode.typeIdentifier$); paramValue.from_string("$annval.value$"); annParam.value(paramValue); ann.param_seq().push_back(annParam); - } + \} };separator="\n"$ $endif$ cst_$object.name$.detail().ann_custom().push_back(ann); -} +\} }; separator="\n"$ $endif$ @@ -1114,17 +1114,17 @@ const TypeObject* GetComplete$union.name$Object() for(int i = 0; i < 4; ++i) { annParam.paramname_hash()[i] = message_hash.digest[i]; - } + \} AnnotationParameterValue paramValue; paramValue._d($annval.typecode.typeIdentifier$); paramValue.from_string("$annval.value$"); annParam.value(paramValue); ann.param_seq().push_back(annParam); -} +\} };separator="\n"$ $endif$ type_object->complete().union_type().discriminator().ann_custom().push_back(ann); -} +\} }; separator="\n"$ $endif$ @@ -1148,17 +1148,17 @@ const TypeObject* GetComplete$union.name$Object() for(int i = 0; i < 4; ++i) { annParam.paramname_hash()[i] = message_hash.digest[i]; - } + \} AnnotationParameterValue paramValue; paramValue._d($annval.typecode.typeIdentifier$); paramValue.from_string("$annval.value$"); annParam.value(paramValue); ann.param_seq().push_back(annParam); -} +\} };separator="\n"$ $endif$ type_object->complete().union_type().header().detail().ann_custom().push_back(ann); -} +\} }; separator="\n"$ $endif$ @@ -1264,17 +1264,17 @@ $object.annotationList:{ ann | for(int i = 0; i < 4; ++i) { annParam.paramname_hash()[i] = message_hash.digest[i]; - } + \} AnnotationParameterValue paramValue; paramValue._d($annval.typecode.typeIdentifier$); paramValue.from_string("$annval.value$"); annParam.value(paramValue); ann.param_seq().push_back(annParam); - } + \} };separator="\n"$ $endif$ cst_$object.name$.detail().ann_custom().push_back(ann); -} +\} }; separator="\n"$ $endif$ @@ -1389,17 +1389,17 @@ const TypeObject* GetComplete$bitmask.name$Object() for(int i = 0; i < 4; ++i) { annParam.paramname_hash()[i] = message_hash.digest[i]; - } + \} AnnotationParameterValue paramValue; paramValue._d($annval.typecode.typeIdentifier$); paramValue.from_string("$annval.value$"); annParam.value(paramValue); ann.param_seq().push_back(annParam); -} +\} };separator="\n"$ $endif$ type_object->complete().bitmask_type().header().detail().ann_custom().push_back(ann); -} +\} }; separator="\n"$ $endif$ @@ -1503,18 +1503,18 @@ $object.annotationList:{ ann | for(int i = 0; i < 4; ++i) { annParam.paramname_hash()[i] = message_hash.digest[i]; - } + \} AnnotationParameterValue paramValue; paramValue._d($annval.typecode.typeIdentifier$); paramValue.from_string("$annval.value$"); annParam.value(paramValue); ann.param_seq().push_back(annParam); - } + \} };separator="\n"$ $endif$ cbf_$object.name$.detail().ann_custom().push_back(ann); - } -} + \} +\} }; separator="\n"$ $endif$ @@ -1564,7 +1564,7 @@ const TypeObject* GetMinimal$bitset.name$Object() $bitset.bitfields:{ member | $minimal_bitfield(ctx=ctx, object=member)$}; separator="\n"$ - $bitset.parents:{$minimal_bitset_inheritance(it)$}; separator="\n"$ + $bitset.parents:{ it | $minimal_bitset_inheritance(it)$}; separator="\n"$ TypeIdentifier identifier; identifier._d(EK_MINIMAL); @@ -1627,17 +1627,17 @@ const TypeObject* GetComplete$bitset.name$Object() for(int i = 0; i < 4; ++i) { annParam.paramname_hash()[i] = message_hash.digest[i]; - } + \} AnnotationParameterValue paramValue; paramValue._d($annval.typecode.typeIdentifier$); paramValue.from_string("$annval.value$"); annParam.value(paramValue); ann.param_seq().push_back(annParam); -} +\} };separator="\n"$ $endif$ type_object->complete().bitset_type().header().detail().ann_custom().push_back(ann); -} +\} }; separator="\n"$ $endif$ @@ -1645,7 +1645,7 @@ const TypeObject* GetComplete$bitset.name$Object() $bitset.bitfields:{ member | $complete_bitfield(ctx=ctx, object=member)$}; separator="\n"$ - $bitset.parents:{$complete_bitset_inheritance(it)$}; separator="\n"$ + $bitset.parents:{ it | $complete_bitset_inheritance(it)$}; separator="\n"$ TypeIdentifier identifier; identifier._d(EK_COMPLETE); @@ -1771,18 +1771,18 @@ $object.annotationList:{ ann | for(int i = 0; i < 4; ++i) { annParam.paramname_hash()[i] = message_hash.digest[i]; - } + \} AnnotationParameterValue paramValue; paramValue._d($annval.typecode.typeIdentifier$); paramValue.from_string("$annval.value$"); annParam.value(paramValue); ann.param_seq().push_back(annParam); - } + \} };separator="\n"$ $endif$ cbf_$object.name$.detail().ann_custom().push_back(ann); - } -} + \} +\} }; separator="\n"$ $endif$