Optimizing code using direct relations

You can use the MicroC profile to generate optimized code for relations.

About this task

When this optimization is used, Rhapsody® does not generate setters and getters for relations, these being unnecessary in static systems.The generation of this optimized code for relations is controlled by the following properties which are part of the MicroC profile:

  • C_CG::Configuration::DirectRelations is a Boolean property that turns the use of direct relations on/off
  • C_CG::Configuration::RelationInitializingMode determines whether the relations are initialized at run time or compile-time

    Note that the value of the RelationInitializingMode property affects code generation only if the InitializingMode property is set to ByCategory. Otherwise, the code generated is determined by the value of the InitializingMode property.

By default, the use of direct relations is enabled when using the MicroC profile.

This optimization for relation code can only be used for relations where each end has multiplicity of no more than 1. For relations where multiplicity greater than 1 is used, Rhapsody generates its standard code for relations (not the optimized code) regardless of the values of the relevant properties.