Prev | Next |
Behavioral Model Code Generation
Enterprise Architect’s multi-featured system engineering capability can be used to generate code for software, system and hardware description languages directly from behavioral models, such as StateMachine, Sequence (Interaction) and Activity diagrams. The supported languages include C(OO), C++, C#, Java, VB.Net, VHDL, Verilog and SystemC.
Software code can be generated from StateMachine, Sequence and Activity diagrams, and hardware description languages from StateMachine diagrams (using the Legacy StateMachine templates).
Access
Ribbon |
Develop > Source Code > Generate |
Behavioral Model Specifics
Behavioral model code generation is supported for the three key types of behavioral model; however, each behavioral model-type has its own characteristics based on the element-type involved. These topics provide guidance and references for the core element-types used.
Type |
Description |
See also |
---|---|---|
Activity |
An Overview of the key Action-types and details on using these in code generation. |
Code Generation - Activity Diagrams |
Interaction |
Details covering using Messages and Fragments for code generation of Interaction (Sequence) diagrams. |
Code Generation - Interaction Diagrams |
StateMachines |
Details covering the options for defining the code to be generated using States, including behaviors - Entry/Exit/Do, and Transitions in a StateMachine. |
Legacy StateMachine Templates |
Structure
Behavioral model code generation primarily requires that all behavioral constructs are be contained within a Class (as a child of that Class).
If any behavioral constructs refer to external elements outside the current Package, you must add an Import connector from the current Package to the Package containing the external elements. For more detail see the Import connector-type in the Package Diagram Help topic.
Generate code from behavioral diagrams using the EAExample project
Step |
Action |
See also |
---|---|---|
1 |
Open the EAExample.eap file by selecting the 'Start > Help > Help > Open the Example Model' ribbon option. |
|
2 |
From the Browser window, select any of these Packages: Software Language Examples:
Generate the Account and Order classes
Generate the DataProcessor Class
Generate the IO Class
Generate the IO Class
Generate the IO Class Hardware Language Examples:
Generate the PlayBack Class
Generate the PlayBack Class
Generate the PlayBack Class |
|
3 |
When completed:
You should see methods generated in the code. |
Notes
- Software code generation from behavioral models is available in the Unified and Ultimate Editions of Enterprise Architect
- Hardware code generation from StateMachine models is available in the Unified and Ultimate Editions of Enterprise Architect
- For C(OO), on the 'C Specifications' page of the 'Manage Model Options' dialog, set the 'Object Oriented Support' option to True.
See the C Options - Model Help topic. - Code synchronization is not supported for behavioral code.