Skip to content

Constant field getter static constexpr cpp #591

Closed
@kdoherty2

Description

@kdoherty2

Using SBE Tool v1.7.9:

Because the field is not constexpr we cannot use this methods in template metaprogramming, and instead we have created python scripts to post process and fix the generated code

Given the following schema: (escaped < below)
<types>
<enum name="EnumSBESample" encodingType="uint8" semanticType="EnumSBESample">
<validValue name="a">0</validValue>
<validValue name="b">1</validValue>
</enum>
</types>

<sbe:message name="MsgSBESample" id="1023" semanticType="MsgSBESample">
<field name="fieldConstant" id="1" type="EnumSBESample" presence="constant" semanticType="EnumSBESample" valueRef="EnumSBESample.a" />
</sbe:message>

Consider generating
static SBE_CONSTEXPR EnumSBESample::Value fieldConstant() SBE_NOEXCEPT

{ return EnumSBESample::Value::a; }

Instead of
EnumSBESample::Value fieldConstant() const SBE_NOEXCEPT

{ return EnumSBESample::Value::a; }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions