EVerest / cbexigen

cbExiGen - The V2GTP EXI codec generator for cbV2G
Apache License 2.0
32 stars 18 forks source link

choice generation bug #80

Open Mike-M0 opened 3 months ago

Mike-M0 commented 3 months ago

Describe the bug

From my understanding: For any element which is marked as "choice" in xsd, the generated c structure should look like: typedef struct mainType { union { typeA elementA; typeB elementB; ... }; int elementA_isUsed:1; int elementB_isUsed:1; ... }; currently all elements are added to the structure directly instead.

This is very inefficient in memory usage and can easily lead to en/decoding errors.

To Reproduce

This happens for all din, iso-2 and -20 types. In multiple structures, e.g. in ParameterSetType -> ParameterType, where the parameter could be one of type per standard: bool, byte, short, int, physical, or string, but never multiple at once.

Anything else?

The general functionality of union seems to be there. The PGPData a union is generated, but in completely wrong way which overwrites itself.