TOC PREV NEXT INDEX
Version 2.2
Logo

8 - Object orientation


8.1 - 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.

Example:

8.2 - Process class

Defining a process class allows to:

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.

Since a class is not supposed to know the surrounding architecture, message outputs should not use the TO_NAME concept. Instead TO_ID, VIA, or TO_ENV should be used.

Example:

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.

8.2.1 Adding a transition

If the transition is new in the sub class, it is simply added to the super class definition.

8.2.2 Overload a transition

If the element exists in the super class, the new element definition overwrites the one of the super class,.

8.2.3 Abstract transition

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.

8.2.4 Reference to the super class

When specializing a class it is important to be able to refer to the super class transition and next state. A typical example is the start transition of a sub class that needs to execute the super class initialization:

Please note the input signature must be the same in the super class and in the sub class including the variable names. For example if the super class transition is MyMsg(a) where a is an int, the sub class transition must be MyMsg(a) as well. It can not be MyMsg(b) even if b is also an int.

8.2.5 Example

Here comes an example mixing some object oriented concepts and the resulting object:

8.3 - Class diagram

The SDL-RT class diagram is conform to UML 1.3 class diagram. Normalised stereotypes with specific graphical symbols are defined to link with SDL graphical representation. All symbols are briefly explained in the paragraphs below. Detailed information can be found in the OMG UML v1.3 specification.

8.3.1 Class

A class is the descriptor for a set of objects with similar structure, behavior, and relationships.

A stereotype is an extension of the UML vocabulary allowing to create specific types of classes. If present, the stereotype is placed above the class name within guillemets. Alternatively to this purely textual notation, special symbols may be used in place of the class symbol.

Classes are divided in active classes and passive classes. An instance of an active class owns a thread of control and may initiate control activity. An instance of a passive class holds data, but does not initiate control. In the class diagram, agents are represented by active classes. Agent type is defined by the class stereotype. Known stereotypes are: system, block, block class, process, and process class. Active classes do not have any attribute. Operations defined for an active class are incoming or outgoing asynchronous messages. The syntax is:

<message way> <message name> [(<parameter type>)] [{via <gate name>}]

<message way> can be one of the characters:

Pre-defined graphical symbols for stereotyped classes are described below:

8.3.2 Specialisation

Specialisation defines a 'is a kind of' relationship between two classes. The most general class is called the superclass and the specialised class is called the subclass.

The relationship from the subclass to the superclass is called generalisation.

8.3.3 Association

An association is a relationship between two classes. It enables objects to communicate with each other. The meaning of an association is defined by its name or the role names of the associated classes. Cardinality indicates how many objects are connected at the end of the association.

Instances of a class are identified by the associated class via its role name.

In the example above an isntance of Switch identifies the instances of Telephone it is connected to via the name terminal.

8.3.4 Aggregation

Aggregation defines a 'is a part of' relationship between two classes.

Objects identify each other as described for regular associations (Cf. "Association" on page 75).

8.3.5 Composition

Composition is a strict form of aggregation, in which the parts are existence dependent on the container.

Objects identify each other as described for regular associations (Cf. "Association" on page 75).

8.4 - Package

A package is a separated entity that contains classes, agents or classes of agents. It is referenced by its name.

It can contain:

8.4.1 Usage in an agent

Agent classes definitions can be gathered in a 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.

8.4.2 Usage in a class diagram

Classes defined in a package can be referenced in 2 ways:



http://www.sdl-rt.org
info@sdl-rt.org
TOC PREV NEXT INDEX