ENUMERATED Type in NCL Programming
The ENUMERATED type is used to constrain a component to a defined set of values. Each defined value is named using a name identifier similar to a component name. Associated with each name is a unique integer value (which can be signed), for example:
12-1
The ENUMERATED type is used to constrain a component to a defined set of values. Each defined value is named using a name identifier similar to a component name. Associated with each name is a unique integer value (which can be signed), for example:
Color ::=ENUMERATED { red(0),blue(1),yellow(2), green(3),black(7) }
- External Form -- Input
- The external form must be one of the names listed in the ENUMERATED type. The enumerated values are not allowed (that is, red is valid, 0 is not).
- External Form -- Output
- Same as input.
- Local Form and Behavior
- Internally, the ENUMERATED value is kept in the same manner, and is subject to the same local form constraints, as an INTEGER of the binary local form.