Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Code Generation Interface
The code generator presents a function-based interface to the toolset. The function parameter list contains the elements to be generated.
public static IStatus generate( List<EObject> elements );
The generator is incremental. The toolset is expected to provide a list of only the elements that have directly changed since the generator was last invoked. The code generator implements the code pattern and therefore is the component that is able to compute the full set of elements that could be affected by any one change.
The rest of this document describes the model elements that can be passed to the generator and the effect of each.
This list of elements in UML-RT stereotyped models has been collected from the document "A UML-RT Profile for the Papyrus Tool". A later section prunes this complete list to the set that is accepted by the generator.
The generator iterates over the list of provided elements. For each valid element it will generate any applicable code. Depending on the type of element it may also visit related elements. Each visited element will be processed in the same way (generate applicable code and visit related elements).
The following table lists the elements that can be passed to the #generate function and describes the generator's response for each.
|visit entire model
|This is to be used for new models or for cases where the toolset has lost tracking of changes. The alternative is to have the toolset walk the entire model passing the contained elements separately. The generator will then be revisiting alot of the same relationships. Allowing the toolset to pass just the higher level element allows the overall operation to be more efficient.
|visit entire package
|See notes for Model.
|generates protocol-specific code
|The generator expects the <> stereotype'ed package
|generates capsule-specific code, visits ports and derived capsules
|The Capsule should be the generation element for structural changes. The structural elements will affect code generated for the capsule as well as all derived capsules.
|generates code for entire state machine
|The code pattern for the state machine is likely to be tightly coupled. A single change in part of the state machine is likely to impact generation of many other elements of the state machine.
|NOTE: The list of generatable elements will evolve during development. The reason this list is specified is to provide better incremental codegen performance. A small change in the model should cause a small amount of work for the code generator. Any change to the set of generatable elements should always be decided based on how it affects performance of incremental generation.