Enterprise Architect supports round trip engineering of C, where the following conventions are used:
Stereotype
Stereotype |
Applies to |
Corresponds To |
Enumeration |
Inner class |
An enum type. |
struct |
Inner class |
A struct type. |
|
attribute |
A keyword struct in variable definition. |
union |
Inner class |
A union type. |
|
attribute |
A keyword union in variable definition. |
typedef |
Inner class |
A typedef statement, where the parent is the original type name. |
Tagged Values
Tag |
Applies to |
Corresponds To |
typedef |
Class with stereotype other than typedef |
This class being defined in a typedef statement. |
anonymous |
Class also containing the Tagged Value typedef |
The name of this class being defined only by the typedef statement. |
bodyLocation |
Operation |
The location the method body is generated to. Expected values are header, classDec or classBody. |
C Code Generation for UML Model
UML |
C Code |
Notes |
A class |
A pair of C files (.h + .c) |
File name is the same as class name |
Operation (public & protected) |
Function declaration in .h file and definition in .c file |
|
Operation (private) |
Function definition in .c file only |
|
Attribute (public & protected) |
Variable definition in .h file |
|
Attribute (private) |
Variable definition in .c file |
|
Inner class (without stereotype) |
(N/A) |
This inner class would be ignored |
See Also