Skip to content

Commit

Permalink
pass more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mikir committed Feb 1, 2024
1 parent 2e9b086 commit c2e2fb2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
14 changes: 6 additions & 8 deletions compiler/extensions/cpp/freemarker/Structure.cpp.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -564,16 +564,15 @@ void ${name}::read(::zserio::BitStreamReader& in<#if parameterArgs(true)?has_con
<#if field.isExtended>
if (::zserio::alignTo(UINT8_C(8), in.getBitPosition()) < in.getBufferBitSize())
{
<@compound_read_field field, name, 2, false/>
++m_numExtendedFields;
in.alignTo(UINT32_C(8));
<@compound_read_field field, name, 2, false/>
}
<#if field.typeInfo.isSimple>
else
{
${field.cppName} = {};
${field.cppName} = <#if !field.typeInfo.isSimple><@field_member_type_name field/>(</#if><#rt>
<#lt><@field_default_constructor_arguments field/><#if !field.typeInfo.isSimple>)</#if>;
}
</#if>
<#else>
<@compound_read_field field, name, 1, false/>
</#if>
Expand Down Expand Up @@ -607,16 +606,15 @@ void ${name}::read(${name}::ZserioPackingContext& context, ::zserio::BitStreamRe
<#if field.isExtended>
if (::zserio::alignTo(UINT8_C(8), in.getBitPosition()) < in.getBufferBitSize())
{
<@compound_read_field field, name, 2, true/>
++m_numExtendedFields;
in.alignTo(UINT32_C(8));
<@compound_read_field field, name, 2, true/>
}
<#if field.typeInfo.isSimple>
else
{
${field.cppName} = {};
${field.cppName} = <#if !field.typeInfo.isSimple><@field_member_type_name field/>(</#if><#rt>
<#lt><@field_default_constructor_arguments field/><#if !field.typeInfo.isSimple>)</#if>;
}
</#if>
<#else>
<@compound_read_field field, name, 1, true/>
</#if>
Expand Down
2 changes: 1 addition & 1 deletion compiler/extensions/cpp/freemarker/Union.cpp.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ void ${name}::read(${name}::ZserioPackingContext& context, ::zserio::BitStreamRe
</#if>
</#list>
<#if fieldList?has_content>
m_choiceTag = static_cast<${name}::ChoiceTag>(/*static_cast<int32_t>*/(in.readVarSize()));
m_choiceTag = static_cast<${name}::ChoiceTag>(/*static_cast<int32_t>*/(context.getChoiceTag().read<${choiceTagArrayTraits}>(in)));

switch (m_choiceTag)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,14 +870,18 @@ else if (compound != null)
}
else if (callExpr != null)
{
//todo: AnyHolder.emplace
expr = "m_objectChoice.emplace<" + fieldCppTypeName() + ">(";
if (array == null)
expr += "::zserio::NoInit, ";
expr += "allocator)";
expr += "." + callExpr + ";";

expr = "m_objectChoice.set(" + fieldCppTypeName() + "(";
/*expr = "m_objectChoice.set(" + fieldCppTypeName() + "(";
if (array == null)
expr += "::zserio::NoInit, ";
expr += "allocator));";
expr += String.format(" m_objectChoice.get<%s>().%s;",
fieldCppTypeName(), callExpr);
fieldCppTypeName(), callExpr);*/
return expr;
}
}
Expand Down

0 comments on commit c2e2fb2

Please sign in to comment.