Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Papyrus-RT/Developer/Design/0.8/Codegen High Level Overview"

(Created page with "==Overview== The code generator will be implemented in XTend as a set of model to model transformations. The input model is an instance of a UML model with the UML-RT profile...")
 
Line 3: Line 3:
 
The code generator will be implemented in XTend as a set of model to model transformations. The input model is an instance of a UML model with the UML-RT profile applied. The output model is an instance of a C++ language model. There will be a set of specialized intermediate models where needed. The C++ language model write itself to source code files which can then be compiled.
 
The code generator will be implemented in XTend as a set of model to model transformations. The input model is an instance of a UML model with the UML-RT profile applied. The output model is an instance of a C++ language model. There will be a set of specialized intermediate models where needed. The C++ language model write itself to source code files which can then be compiled.
  
''Insert codegen-arch-01.png''
+
[[File:Codegen-arch-Overview.png]]
  
 
The code generator will provide a mechanism for overriding and customizing certain parts of the transformation algorithm.
 
The code generator will provide a mechanism for overriding and customizing certain parts of the transformation algorithm.
Line 23: Line 23:
 
For example, consider generation of connectors. If an input model has a connection that passes through a relay port then the code pattern will likely specify that the relay port be removed so that the end ports are directly connected. In this case we may choose to create a Port and Connector intermediate model as shown here.
 
For example, consider generation of connectors. If an input model has a connection that passes through a relay port then the code pattern will likely specify that the relay port be removed so that the end ports are directly connected. In this case we may choose to create a Port and Connector intermediate model as shown here.
  
''Insert codegen-arch-02.png''
+
[[File:Codegen-arch-01.png]]
  
 
===Customizing the Code Generator===
 
===Customizing the Code Generator===

Revision as of 10:21, 18 August 2015

Overview

The code generator will be implemented in XTend as a set of model to model transformations. The input model is an instance of a UML model with the UML-RT profile applied. The output model is an instance of a C++ language model. There will be a set of specialized intermediate models where needed. The C++ language model write itself to source code files which can then be compiled.

Codegen-arch-Overview.png

The code generator will provide a mechanism for overriding and customizing certain parts of the transformation algorithm.

Input Model and Toolset API

The code generator will be implemented as a set of plugins that run within Eclipse. Papyrus-RT will invoke the code generator with a function call, passing in the model elements to be generated.

More detail is provided in the Code Generator API

Intermediate Models

Intermediate models are a partial representation of a specific portion of the input model. The goal of an intermediate model is to allow a separation of concerns between the input model structure and generation of the source code.

Intermediate models are an optional component in generator. If portions of the input model can be directly converted to the output model then there is no need to create an intermediate model for that aspect of generation.

Connectors Example

For example, consider generation of connectors. If an input model has a connection that passes through a relay port then the code pattern will likely specify that the relay port be removed so that the end ports are directly connected. In this case we may choose to create a Port and Connector intermediate model as shown here.

Codegen-arch-01.png

Customizing the Code Generator

Intermediate models will also be useful when end users customize the code generation pattern. We should eventually create a customization debugger where the end users can visualize the intermediate model in order to observe the impact of their changes.

Output Model

The output model is the end of the model transformation pipeline. Other intermediate models are stages in the ultimate goal, which is to produce source code. The output model contains the logic to create source code files from the model elements.

The output model is useful for all source code languages, but it is especially useful for languages that generate the same information in multiple places. In C++ for example, member function signatures are generated in the header file and the implementation file. The end-user creates a single model element and the language model contains the logic for creating multiple files with the same content.

Build Avoidance

The output model will implement file generation in a way that only modifies files when there is new content. This will allow make to use the timestamp of the file to avoid compilation when the content has not changed.

Back to the top