![]() |
![]() |
![]() |
![]() |
![]() |
Reusing Packages
When developing the version of the DemonGame that has all features, you create a package AdvancedFeatures that contains the additional features and that will reuse the package BasicFeatures.
What You will Learn
The Package AdvancedFeatures
- Create the package AdvancedFeatures in a similar fashion as the package BasicFeatures (see Figure 168).
The package AdvancedFeatures must do the following:
- Use the package BasicFeatures.
- Add the declarations of the new signals.
- Add references to the process types JackpotGame, etc.
- Add a reference to a block type AdvancedGameBlock (which inherits the block type BasicGameBlock and in turn refers to a redefined process type Main).
- Save the package diagram on the file advancedfeatures.sun
Block Type AdvancedGameBlock
The diagram contains a reference to a REDEFINED process type Main, and a dashed instantiation symbol Main.
- The block type AdvancedGameBlock is already provided on the file -advancedgameblock.sbt. Copy that file from the directory $-telelogic/sdt/examples/demongame/sdl92/packages (on UNIX), or C:\IBM\Rational\SDL_TTCN_Suite6.3\sdt\examples\demongame\sdl92\packages (in Windows), and use the Organizer to connect the diagram to the file.
Redefined Process Type Main
The REDEFINED process type Main inherits implicitly from the -VIRTUAL process type Main in the package BasicFeatures, and adds the code to receive the signals that command the new features.
- The REDEFINED process type Main is also provided on the file advancedmain.spt in the directory
$-telelogic/sdt/examples/demongame/sdl92/packages (on UNIX), or C:\IBM\Rational\SDL_TTCN_Suite6.3\sdt\examples\demongame\sdl92\packages (in Windows). Copy the file and use the Organizer to connect the diagram to the file.Creating the System AdvancedDemonGame
Creating the system is now fairly simple.
- Add a New SDL system in the Organizer. Say you name the system AdvancedDemonGame and save it as demongameadvanced.ssy
- With the SDL Editor, Copy the contents of the system -BasicDemonGame and Paste them into the new system.
- Have the system USE AdvancedFeatures in addition to -BasicFeatures.
- Change the reference from the block type BasicGameBlock to -AdvancedGameBlock.
- Update the signal list C1 with the new signals JackpotGame, etc. The system is now complete. Analyze it and simulate it if you find it meaningful.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |