Components-based development in C
You can do component-based developed in Rhapsody® Developer for C because there is code generation support for interfaces and ports.
A class might realize an interface, that is, provide an implementation for the set of services it specifies (that is, operations and event receptions). You use a realization relationship to indicate that a class is realizing an interface. In addition, an interface might inherit another interface, meaning that it augments the set of interfaces the superinterface specifies. You can specify interfaces, realize them, and connect to objects through the interfaces.
Rhapsody Developer for C users can take advantage of service ports that allows the passing of operations and functions through ports, in addition to passing events. You can specify ports with provided and required interfaces. In addition, code generation supports standard UML ports in C and code generation of ports supports the initialization of links through ports.
In this type of development in Rhapsody Developer for C, interfaces are treated as a specification of services (that is, operations) and not as inheritance of data (attributes). Also, in this type of development in C, realization (as opposed to inheritance) is used to distinguish between realizing an interface and inheriting an interface/class.
Code generation supports realizing interfaces in C. Therefore interfaces and ports specified in a C model will be implemented by the code generator. Therefore code generation generates:
- Code for a C interface (a class with
pure virtual operations
)- Virtual tables with function pointers
- Relay code from the interface to the realizing class according to the virtual table
- The
realization code
for the realizing class- Aggregating the interface
- Initializing the virtual table
- Links between objects that instantiate associations to the interface