Enumeration Definitions in RAD Modules
The enum
element has a single mandatory attribute, name
. The name
is used when referring to the enumeration from other derived type or interface definitions. An enum
contains one or more value
elements, one for each user-defined enumerated value. A value
element has a mandatory name
attribute that gives the enumerated value a symbolic name. The symbolic name is not used elsewhere in the API definition, only in the server and various client environments. The symbolic name that is exposed in these environments are environment-dependent. An environment offering an explicit interface to RAD must provide an interface that accepts the exact string values defined by the value
elements' name
attributes.
Some language environments support associating scalar values with enumerated type values, for example C. To provide richer support for these environments, ADR supports this concept as well. By default, an enumerated value has an associated scalar value 1 greater than the preceding enumerated value's associated scalar value. The first enumerated value is assigned a scalar value of 0. Any enumerated value element may override this policy by defining a value
attribute with the desired value. A value
attribute must not specify a scalar value already assigned, implicitly or explicitly, to an earlier value in the enumeration and value
elements contain no other elements.
Example 2-2 Defining Enumerations for a RAD Module
<enum name="Colors"> <value name="RED" /> <!-- scalar value: 0 --> <value name="ORANGE" /> <!-- scalar value: 1 --> <value name="YELLOW" /> <!-- scalar value: 2 --> <value name="GREEN" /> <!-- scalar value: 3 --> <value name="BLUE" /> <!-- scalar value: 4 --> <value name="VIOLET" value="6" /> <!-- indigo is EOL --> </enum>