11 - Object orientation
11.1 - Package
Object orientation in SDL-RT allows to define classes of processes and blocks. Classes definitions are gathered in an SDL-RT package. To be able to use classes defined in a package, an SDL-RT system should explicitly import the package with USE keyword in an additional heading symbol at system level.
A package is a separated entity that contains agents or classes of agents. It is referenced by its name.
It can contain:
11.2 - Block class
Defining a block class allows to use the same block several times in the SDL-RT system. The SDL-RT block does not support any other object oriented features. A block class symbol is a block symbol with a double frame. It has no channels connected to it.
A block class can be instantiated in a block or system. The syntax in the block symbol is:
<block instance name>:<block class name>
Messages come in and go out of a block class through gates. In the block class diagram gates are represented out of the block class frame. When a block class is instantiated the gates are connected to the surrounding SDL-RT architecture. The messages listed in the gates are to be consistent with the messages listed in the connected channels.
11.3 - Process class
Defining a process class allows to:
- have several instances of the same process in different places of the SDL-RT architecture,
- inherit from a process super-class,
- specialize transitions and states.
A process class symbol is a process symbol with a double frame. It is has no channels connected to it.
A process class can be instantiated in a block or a system. The syntax in the process symbol is:
<process instance name>:<process class name>
Messages come in and go out of a process class through gates. In the process class diagram, gates are represented out of the process class frame. When a process class is instantiated the gates are connected to the surrounding SDL-RT architecture. The messages listed in the gates are to be consistent with the messages listed in the connected channels. The names of the gates appear in the process symbol with a black circle representing the connection point.
SDL-RT transitions, gates and data are the elements that can be redefined when specializing. In the sub class the super class to inherit from is defined with the INHERITS keyword in an additional heading symbol. There are several ways to specialize a process class depending on what is defined in the super class.
- If the element is new in the sub class, it is simply added to the super class definition,
- If the element exists in the super class, the new element definition overwrites the one of the super class,
- A class can be defined as abstract with the ABSTRACT keyword. It means the class can not be instantiated as is; it needs to be specialized. A class can define abstract transitions or abstract gates. It means the abstract transition or gate exists but that it is not defined. Such a class is obviously abstract and needs to be defined as such.
Here comes an example mixing all object oriented concepts and the resulting object: