SET OF Type
12-1
The SET OF type allows the definition of either an arbitrary or fixed number of items of the same type, where order is not important. The definition includes only the type of the SET item, and does not name the component, for example:
PokerHand ::= SET OF Cards
In NCL, SET OF items are referenced by index only, within their parent structure. In the example above, the following index values are used to reference the set items of a component named card of type PokerHand:
card.{1} card.{2} ... card.{n}
External Form -- Input and Output
All structures have an external form that is the same as their local form.
Local Form and Behavior
The local form of a SET OF type is the data stream consisting of each set component, where each component has its leading tag and length (as determined by the parent component) and data in the local form for its type.
Named Values
Named values are not applicable to the SET OF type.
Constraints
An upper limit can be placed on the number of items that the set can contain by use of the SIZE keyword. For example:
Pokerhand ::= SET SIZE(5) OF Cards
It is also possible to specify a SIZE range but the lower bound is ignored. For example, the following is equivalent to the above:
Pokerhand ::= SET SIZE(2..5) OF Cards