BallAerospace / COSMOS

Ball Aerospace COSMOS
https://ballaerospace.github.io/cosmos-website/
Other
360 stars 127 forks source link

Ability in XTCE to specify enumeration parameter/argument values with label #755

Open lenlope opened 6 years ago

lenlope commented 6 years ago

In XTCE, whenever I use a parameterRef that references a parameter of type, EnumeratedParameterType, I'd like to be able to specify the value with the enum label instead of the integer value. This is so that if the enum values ever change, I don't have to update the values everywhere they are used. See example below:

Given an enum type:

<xtce:EnumeratedParameterType name="TestEnum">
    ...
    <xtce:EnumerationList>
    <xtce:Enumeration value="0" label="ZERO"/>
    <xtce:Enumeration value="1" label="ONE"/>
    <xtce:Enumeration value="2" label="TWO"/>
    </xtce:EnumerationList>
</xtce:EnumeratedParameterType>

Parameter declaration (desired): <xtce:Parameter name="Test" parameterTypeRef="TestEnum" initialValue="ZERO"/>

Parameter usage (desired);

<xtce:SequenceContainer name="TestContainer" abstract="true">
    ...
  <xtce:BaseContainer containerRef="TestBaseContainer">
    <xtce:RestrictionCriteria>
      <xtce:ComparisonList>
    <xtce:Comparison parameterRef="Test" value="ONE"/>
      </xtce:ComparisonList>
    </xtce:RestrictionCriteria>
  </xtce:BaseContainer>
</xtce:SequenceContainer>

I would like this to work similarly for command arguments, as well. Let me know if you also need an example of this.

ghost commented 6 years ago

Is this part of the XTCE standard? We don't use a lot of XTCE internally here at Ball so it isn't going to be high on our priority list. If you want to take a stab at implementing this all the XTCE code is contained in xtce_parser.rb. Please read our contributer information.

severn commented 5 years ago

Most of us support or try to support both for 1.1. For 1.2, I believe we fixed it to the name/label is specified instead of the value.

OnurGurdogan commented 3 years ago

Hi @lenlope ! I do not know if you found the answer but you may use the structure given below:

... --------------------------------------- ...