![]() |
![]() |
![]() |
![]() |
![]() |
Creating a Process Type from a Process
What You Will Learn
- To change a process diagram to a process type
- To refer to and instantiate a process type
- To interconnect the process type with a block and other processes (types), using gates
- To define transitions as virtual
Changing into a Process Type
To facilitate the introduction of new features, we will start by generalizing the process Game, by changing it to a process type, that you later on will be in a position to specialize or redefine.
- Open the process Game and change the diagram type from process to process type, simply by selecting the diagram heading symbol and editing the text in it to say "Process Type Game".
- From the SDL Editor's File menu, save the diagram Process Type Game on a new file, e.g. new_game.spt using the Save As command. Edit the file name in the file selection dialog and click OK. (The existing *.spt files are copies of the complete system that comes with the examples in the SDL Suite.)
- Raise the Organizer window.
- You may notice that the reference symbol has been changed to -Process Type Game, and marked as having no reference in the parent diagram. Also, the old process Game is marked as unconnected. Do not bother about that for the moment - it will be replaced by an instantiation symbol, which will be explained later.
- Open the diagram block GameBlock. Change it so that the process reference Game is changed to an instantiation of the process type Game. The syntax is: "Game(0,1):Game" (You are allowed to add newlines to have the text fit into the symbol.)
- As soon as you deselect the symbol, one text rectangle appears for each connection point to the signal routes. Name the connections points for instance G2 and G5:
- Also add a process type reference symbol with the name Game. The block diagram should now look like this:
Inserting Gates and Virtual Transitions
You will now finish the process type Game. You are recommended to do this by following the editing instructions described below. If you prefer, you can instead connect to the finished version of the diagram (see Connecting to the Finished Diagram), but you should in any case read through the text below.
Editing the Process Type Diagram
- Go back to the process type Game in the SDL Editor. The connection to the signal routes must be defined using gate symbols, named in accordance to the connection points you just defined.
- Gate symbols are to be connected to the frame symbol. If you want to connect gates to the left or top of the frame, you must first select the frame and drag it down and/or right.
- For each of the gates G2 and G5, add a gate symbol and fill in the name and the signal list.
- The gate symbol is the one who looks like an arrow. Remember that the Status Bar displays the type of a symbol when you point to or select it in the symbol menu.
- To direct a gate to the frame, you must add a gate, then -Redirect it. (Gates can also be made bidirectional.)
- You may use the New Window command to bring both the -Process Type Game and the Block GameBlock into view at the same time, then Copy and Paste the text between the diagrams.
- You may also take advantage of the Signal Dictionary window, and Insert the signals from the block GameBlock (Up).
- Also make the start transition as well as the input of the signals Probe and Bump virtual by adding the text "VIRTUAL" before the name of the signal.
The changes to the resulting diagram should now look something like this:
Connecting to the Finished Diagram
The finished Game process type diagram is also available as the file game.spt. If you instead of drawing the diagram wish to use this file, do as follows:
- In the SDL Editor, close the Game process type diagram.
- In the Organizer, select the diagram Process Type Game, and then select Connect from the Edit menu.
- Select the option To an existing file. Change the filename to game.spt, or select this file by using the folder button.
- Click Connect and check the new file connection in the Organizer.
The Organizer Structure
- Note the presence of an instantiation symbol, looking like a normal symbol, but with the generic "X:Y" (meaning -instance:type) notation in it. The instantiation symbol denotes that the type is actually instantiated somewhere in the diagram.
- Instantiation symbols in the Organizer cannot be used for navigating into the system hierarchy with a double click, since they do not refer to diagrams. (You can use them from within the SDL Editor with the support from the Type Viewer tool, which you will practice on later in this tutorial).
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |