Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Topic
Prev Next

C Conventions

Enterprise Architect supports round trip engineering of C, where these conventions are used:

Stereotype

Stereotype

Applies To

See also

enumeration

Inner Class

Corresponds To: An enumerated type.

struct

Inner Class

Corresponds To: A 'struct' type.

Attribute

A keyword struct in variable definition.

typedef

Inner Class

Corresponds To: A 'typedef' statement, where the parent is the original type name.

union

Inner Class

Corresponds To: A union type.

Attribute

A keyword union in variable definition.

Tagged Values

Tag

Applies To

See also

anonymous

Class also containing the Tagged Value typedef

Corresponds To: The name of this Class being defined only by the typedef statement.

bitfield

Attribute

Corresponds To: The size, in bits, allowed for storage of this attribute.

bodyLocation

Operation

Corresponds To: The location the method body is generated to; expected values are header, classDec or classBody.

typedef

Class with stereotype other than 'typedef'

Corresponds To: This Class being defined in a 'typedef' statement.

typeSynonyms

Class

Corresponds To: The 'typedef' name and/or fields of this type.

C Code Generation for UML Model

UML

C Code

See also

A Class

A pair of C files (.h + .c)

Notes: File name is the same as Class name

Operation (public & protected)

Function declaration in .h file and definition in .c file

Notes:

Operation (private)

Function definition in .c file only

Notes:

Operation (static)

Function definition in .c file only

Notes: Static functions will only appear in the .c file regardless of their scope.

Attribute (public & protected)

Variable definition in .h file

Notes:

Attribute (private)

Variable definition in .c file

Notes:

Inner Class (without stereotype)

(N/A)

Notes: 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.

Create and Manage Attributes

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.

Attribute Tagged Values

Notes

  • Separate conventions apply to Object Oriented programming in C

Learn more