Generating code

Between the code generator and the real-time Object Execution Framework (OXF), which is provided as a set of libraries, IBM® Engineering Systems Design Rhapsody® can implement most low-level design decisions for you.

About this task

These decisions include how to implement design elements such as associations, multiplicities of related objects, threads, and state machines.

  • Elaborative. You can use Rhapsody simply as a code browser, with all relations, state machine generation, and so on, disabled. No instance initializations or links are generated. You do everything manually.
  • Translative. You can draw a composite with components, links, and state machines, click a button, and get your application running while having to write only a minimum of code (you would have to write at least some actions in a statechart).

The Rhapsody code generator can be both elaborative and translative to varying degrees. Rhapsody does not force translation, but allows you to refine the code generation process to the wanted level. The product can run in either mode, or anywhere between these two extremes.

Note: Microsoft is the default working environment for Rhapsody . You can specify other "out‑of‑the‑box" environments in the environment settings for the configuration.

Dependency arrows indicate which files are generated and which files are included by the code generator and compiler. The thick borders around the code generator and compiler show the active classes.

Note: When generating code, consider the following guidelines:
  • A reactive class that inherits from a non-reactive class might cause a compilation warning in Instrumentation mode. You can ignore this warning.
  • If a class has a dependency on another class that is outside the scope of the component, the product does not automatically generate an #include statement for the external class. You must set the <lang>_CG::Class::SpecInclude property for the class of the dependent.

Before you generate code, you must set the active configuration. The code generator automatically runs the checker to check for inconsistencies that might cause problems in generating or compiling the code. Some of the checks performed by the checker detect potentially fatal conditions that might cause code generation to stop processing if not corrected before generating code.

  • Select Code > Generate(active configuration), or
  • Press Ctrl+F7

It is possible to generate code without intertask communication and event dispatching from Rhapsody , but this disables the animation and visual debugging features. You can mitigate this effect by wrapping your in-house intertask communication and event dispatching routines inside an operation that is defined inside the model. In this case, the visualization is of the operation as a representative of your "real" intertask communication and event dispatching.