Method declarations

The method declarations section of the specification file includes declarations of methods (constructors and destructors) for packages, objects, relations, and events.

Package methods

Two methods (operations) are generated to initialize memory when an element is created and clean up memory when the element is destroyed.

For example, the following initializer and cleanup methods are generated for the Default package:


void Default_OMInitializer_Init();
void Default_OMInitializer_Cleanup();

Relation methods

IBM® Engineering Systems Design Rhapsody® generates a constructor to initialize relations between elements within a package. The relation initializer name has the format <package>_initRelations().

For example, the following method initializes relations between the objects in the Default package:


static void Default_initRelations();

Applying the keyword static to the method allows it to be accessed by other operations in the same file.

Event methods

Rhapsody generates the following constructors and destructors to deal with events:

  • RiC_Create_<event>() - Creates an event. This constructor returns a pointer to the newly created event.
  • RiC_Destroy_<event>() - Destroys an event. This destructor receives a pointer to the event that is destroyed.
  • <event>_Init() - Initializes memory when an event is created. The constructor points to the memory address to be allocated.
  • <event>_Cleanup() - Cleans up memory when an event is destroyed. The destructor points to the memory address to be deallocated.

For example, Rhapsody generates the following methods for evStart events:


evStart * RiC_Create_evStart();
void RiC_Destroy_evStart(evStart* const me);
void evStart_Init(evStart* const me);
void evStart_Cleanup(evStart* const me);