Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.
C Conventions
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.
|
|
typedef |
Inner Class |
A typedef statement, where the parent is the original type name.
|
union |
Inner Class |
A union type.
|
Attribute |
A keyword union in variable definition.
|
Tagged Values
Tag |
Applies To |
Corresponds To |
---|---|---|
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.
|
typedef |
Class with stereotype other than typedef
|
This Class being defined in a typedef statement. |
typeSynonyms |
Class |
The typedef name and/or fields of this type.
|
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
|
|
Operation (static) |
Function definition in .c file only |
Static functions will only appear in the .c file regardless of their scope.
|
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 |
Capture #define value to be generated in C code
For example, #define PI 3.14.
Step |
Process |
See also |
---|---|---|
1 |
Add an attribute to the Class, with Name = PI and Initial Value = 3.14.
|
|
2 |
In the properties panel of the Attributes page, update the Static and Const fields.
|
|
3 |
On the Tagged Values tab of the Attributes page, add a tag called define with the value true.
|
Notes
· | Separate conventions apply to Object Oriented programming in C |
Learn more