esa / CCSDS_MO_StubGenerator

Generates technology bindings for CCSDS MAL service specifications
Other
4 stars 9 forks source link

malbinary encoding of an enumeration #10

Closed lacourte closed 9 years ago

lacourte commented 9 years ago

The question relates to the use of the numerical value in the encoding, instead of the ordinal value. Code concerned is in GeneratorLangs.java, line 1830 and forward, local variable maxValue. I have performed a simple test with the following enumeration :

    <smc:enumeration name="TestEnumeration" shortFormPart="1" comment="">
        <smc:item value="SMALL" nvalue="1" comment="Small value."/>
        <smc:item value="LARGE" nvalue="100000" comment="Small ordinal but large numerical."/>
    </smc:enumeration>

The code generated by the Java generator is the following :

public void encode(org.ccsds.moims.mo.mal.MALEncoder encoder) throws org.ccsds.moims.mo.mal.MALException { encoder.encodeUInteger(new org.ccsds.moims.mo.mal.structures.UInteger(ordinal.longValue())); } It looks like the ordinal value is effectively used in encoding, but it is encoded as a UInteger.