Using a class in multiple SW-Cs

One may not include contracts of multiple SW-Cs in a single source: this is a restriction by AUTOSAR. Because Rhapsody generates a source file for a class, this is a problem: the class may not use RTE APIs defined in multiple contracts.

In our Blinky example, we want to re-use the class LED in multiple SW-Cs. This class contains an RTE API Rte_Call_Digital_LED_Write() which is defined in the contracts Rte_SwcA.h, Rte_SwcB.h and Rte_SwcC.h

In Rhapsody we have created a Class Diagram LED Inheritance where classes LED_SwcA and LED_SwcB use a static inheritance relation from the class LED:

There are a few details you should be aware of: