Cross-package initialization

IBM® Rational® Rhapsody® has properties that enable you to specify code that initializes package relations after package instances are initialized, but before these instances react to events. More generally, these properties enable you to specify any other initialization code for each package in the model. They enable you to initialize cross-package relations from any of the packages that participate in the relation or from a package that does not participate in the relation.

The properties that govern package initialization code are as follows:

The following example shows C++ code generated from the model when the InitializationScheme property is set to ByPackage.

The component code is as follows:

class DefaultComponent {
private :
   P1_OMInitializer initializer_P1;
   P2_OMInitializer initializer_P2;
};

The P1 package code is as follows:

P1_OMInitializer::P1_OMInitializer() {
      P1_initRelations();
         < P1 AdditionalInitializationCode value>
      P1_startBehavior();
}

The following example shows C++ component code generated when the InitializationScheme property is set to ByComponent:

DefaultComponent::DefaultComponent() {
   P1_initRelations();
   P2_initRelations();
      < P1 AdditionalInitializationCode value>
      < P2 AdditionalInitializationCode value>
   P1_startBehavior();
   P2_startBehavior();
}

Feedback