Creating composite types

You can create composite types that are modeled using structural features instead of verbatim, language-specific text. In addition, the product includes classes wherever types are used to increase the maintainability of models: if you change the name of a class, the change is propagated automatically throughout all the references to it.

Procedure

  1. Right-click a package or the Types category, then select Add New > Type.
  2. Edit the default name for the type.
  3. Open the Features window for the new type. The Type window opens.
  4. If wanted, specify a stereotype for the type.
  5. Specify the kind of data type using the Kind list. The possible values are as follows:
    1. Enumeration specifies the new type is an enumerated type. Specify the enumerated values on the Literals tab. For more information, see Creating enumerated types.
    2. Language specifies the new type is a language-specific construct. This is the default value. For more information, see Creating language types.
    3. Structure specifies the new type is a structure, which is a data record. For more information, see Creating structures.
    4. Typedef specifies the new type is a typedef. For more information, see Creating Typedefs.
    5. Union specifies the new type is a union, which is an overlay definition of a data record. For more information, see Creating unions.

Results

See the appropriate data type to continue the creation process.

The following table shows the mapping of composite types to the different languages.

Table 1. Mapping of composite types to the different languages
Type Kind Ada C and C++ Java
Language As in previous versions As in previous versions As in previous versions
Structure Not supported struct The generated struct is a simple C-style struct that contains only public data members. N/A
Union Not supported union N/A
Enumeration Enumeration types enum N/A
Typedef Subtypes (in simple cases) or subtype typedef N/A

The generated struct is a simple C-style struct that contains only public data members.

Code generation analyzes the types to automatically generate:

  • Dependencies in the code (#include)
  • Type descriptions
  • Field descriptions

    Each field in a structure and union has an attribute annotation.