Generating optimized code for relations and flow ports

The MicroC profile is designed to let you develop applications for target systems with minimal resources.

The profile includes a number of options for generating less demanding code. Specifically, the profile lets you specify that Rational Rhapsody generates smaller and less complex code for relations and flow ports in your model, relative to the code ordinarily generated Rational Rhapsody in the C language.

Generating optimized code for relations (direct relations)

To have Rational Rhapsody generate optimized code for the relations in your model, set the value of the C_CG::Configuration::DirectRelations property to Checked.

Note: Optimized code is only generated for one-to-one relations.

Generating optimized code for flow ports (direct flow ports)

To have the product generate optimized code for the flow ports in your model, set the value of the C_CG::Configuration::DirectFlowPorts property to Checked.

Ordinarily, the use of flow ports requires you to define attributes with the same name as the flow ports. When using the optimized code feature, this is only necessary for input flow ports. You are not required to declare matching attributes for output flow ports.

Note: Optimized code is only generated for atomic, non-broadcast flow ports with a multiplicity of 1.

The following two properties can be used to customize some of the names used in the code generated for direct flow ports:

How direct relation code differs from code ordinarily generated in Rational Rhapsody in the C language

The code generated for direct relations is optimized by eliminating the complex setter functions that are ordinarily generated in Rational Rhapsody in the C language. The purpose of these setter functions is to allow run-time changes in terms of the objects connected by the relations. Since the MicroC profile is intended for static systems, it is assumed that the relation is initialized once and does not need to be modified, thus eliminating the need for these setter functions.

The MicroC profile also includes the following optimizations that are geared to static systems:
  • Direct Flow ports
  • Direct Relations
  • ROMable Application
  • Initial Value for Instance Attribute

If you are using direct relations with the compile-time initialization option, the product includes const in the relevant declarations.

How direct flow port code differs from code ordinarily generated in Rational Rhapsody in the C language

The code generated for direct flow ports is characterized by the following:


Feedback