UML 2.1 to C

From AcceleoWiki

Jump to: navigation, search
Module UML 2.1 to C
Image:ModuleIncubation.png
Status: Incubation
Licence: EPL
Target: C
Metamodel: UML 2.1
Inital contributor: CEA
Obeo
Contact: Gonzague Reydet



This project aims to generate C applications from UML 2.1 models.

Contents

Guidelines

  • Embedded field
  • Easy to use
  • Simple C code generation (no C Object)
  • Standard UML input model (no complex UML profile)

Features

  • Header files generated from model elements:
    • Classes
    • Datatype
    • Enumeration
  • Source files generated from model classes
  • Generated files respect the package structure
  • Comments generated from comment model elements
  • Function declaration and definition
  • Global variables
  • Visibility management for function declarations and global variables
    • In header file, if public
    • In source file, if private
  • Multiplicity management for variables and parameters
  • Import management
  • Structure and enumeration generation

Installation

The installation process is described on the installing a module web page.

Contribute!

How to use the generator?

Create a Module Launcher Chain

In a project (C project), containing the input UML model, clic on "New > Other..." and select "Module Launcher" on the Acceleo folder:
Image:1-ModuleLauncherCreation.png

Then, select the UML 2.1 to C generation module:
Image:2-CGenerationModuleSelection.png

Then, give a name to your new chain:
Image:3-CChainName.png

Finally, enter the 3 parameters required by this generation module:

  • The error log file
  • The output source folder
  • The input UML model

Image:4-CModuleParameters.png

Launch the generation

To launch the generation process, right click on the chain, then "Launch":
Image:5-CLaunchGeneration.png

Upon the generation process completed, the generated sources should appear on the specified output folder.

Optional parameters

Several parameters can be set to personalize the generation:

Property name Description Default value
gen.comment.date Enable/disable the date/time generation in code heading comments true
tuple.array.length Set the default array length for attributes with unlimited multiplicity (*) 20
tuple.string.length Set the default String length for string attributes without default value 20

To precise such parameters to the generation module, add a property file (with .properties extension) next to the chain you created to launch the generation. For example, you can create a file UML2C.properties with the following content:

# Remove the generation date in the generated file heading
gen.comment.date=true

# Default array length for attributes with unlimited multiplicity (*)
tuple.array.length=200
# Default String length for String attributes without default value
tuple.string.length=75
Personal tools