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
- Right-click a package
or the Types category, then select .
- Edit the default name for the type.
- Open the Features window for the new type.
The Type window opens.
- If wanted, specify a stereotype for the
type.
- Specify the kind of data type using the Kind list.
The possible values are as follows:
- Enumeration specifies the new
type is an enumerated type. Specify the enumerated values on the Literals tab.
For more information, see Creating enumerated types.
- Language specifies the new type
is a language-specific construct. This is the default value. For more
information, see Creating language types.
- Structure specifies the new type
is a structure, which is a data record. For more information, see Creating structures.
- Typedef specifies the new type
is a typedef. For more information, see Creating Typedefs.
- 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.