The node type typedef is used to define node metadata that can be referenced from nodes declared in trees of other information types.
This enables one definition to be shared between multiple nodes in other trees.
Nodes of the type typedef must have the following mandatory metadata:
For more information, see the Common Rule Set: Mandatory Metadata.
Besides the mandatory metadata mentioned above, the following optional metadata may be used:
For more information, please see the Common Rule Set: Optional Metadata.
The following rules define how typedef nodes shall be used.
In the example a vspec file describing a tree of the VehicleData information type contains a node that refers to a typedef node containing an enum definition. The node in the referring tree:
Vehicle.X.Y:
type: sensor
datatype: Types.Enum.Example
description: A sensor node in the Vehicle tree.
The node in the referred (typedef) tree:
Types.Enum.Example:
description: Enum example type definition.
type: typedef
datatype: uint8
enum:
A: 0
B: 1
C: 2
D: 3
The resulting node after exporting the vspec declarations to YAML:
Vehicle.X.Y:
type: sensor
datatype: uint8
enum:
A: 0
B: 1
C: 2
D: 3
description: A sensor node in the Vehicle tree.