Presentation is loading. Please wait.

Presentation is loading. Please wait.

Rhapsody in C++ Tool Training "Essential" © I-Logix 1999-2003 v4.1 01/01/2003 E1-1 Essential Rhapsody in C++ Part One Basic Rhapsody.

Similar presentations


Presentation on theme: "Rhapsody in C++ Tool Training "Essential" © I-Logix 1999-2003 v4.1 01/01/2003 E1-1 Essential Rhapsody in C++ Part One Basic Rhapsody."— Presentation transcript:

1 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-1 Essential Rhapsody in C++ Part One Basic Rhapsody

2 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-2 Part One: Basic Rhapsody Setting up Rhapsody in C++ Example : Hello world Example : Count down Properties Example : Dishwasher

3 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-3 Setting Up Rhapsody Install Visual C (or alternatively Visual Studio.NET or Borland bcc55) Install Rhapsody in C++ V4.1 Install license (License.dat) Create a work directory ex: “C:\Work”

4 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-4 Before We Start Rhapsody uses C++ which is CASE sensitive. Most of the errors that occur during the training are generally due to entering text incorrectly. During this training, all classes will start with an upper case ex: “Training”. Often during the training course, students take differing lengths of time for completing the exercises. For those students who finish early, there is often an “Extended Exercise”.

5 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-5 C++ Refresher The following concepts (possibly unfamiliar to C users) will be used during the training: –Constructor –Constructor initializer –Operator overloading –Destructor –New & Delete –Inheritance –Virtual operations

6 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-6 Part One : Example 1 Basic Rhapsody Hello World

7 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-7 Creating a Project Start up Rhapsody in C++ (development edition) Within Rhapsody, use the icon or file->new to create a new project called Hello in directory c:\work Click Yes to create project.

8 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-8 The Browser The browser showing everything in the model is automatically started on opening a project. An Object Model Diagram has also been created and displayed. Browser Object Model Diagram

9 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-9 Drawing a Class In this Object Model Diagram, use the class icon to draw a class named Display. There are two ways of deleting a class. It can be deleted from just the view “Remove from View” or deleted from the entire model “Delete from Model”.

10 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-10 Adding a constructor Expand the browser to see the class that we have just added. Right-click on this class and “Add New ►Constructor” We don’t need any arguments for our constructor so just click OK.

11 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-11 The Features Window Right-click on the constructor and display the Features.

12 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-12 Adding some code Select the Implementation tab and enter the following: std::cout << "Hello World" << std::endl;

13 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-13 Renaming a Component In order to generate code, we must first create a component. Expand the Components in the browser and rename the existing component called DefaultComponent to Test Note that this component will generate an executable.

14 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-14 The Test Component Now expand the Configurations and rename the DefaultConfig to Release

15 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-15 Initial Instance Select the Initialization tab, expand the Default package and select the Display class. This will now create an initial instance of the Display class We will explain the difference between Explicit and Derived later.

16 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-16 Settings We need to select an environment so that Rhapsody knows how to create an appropriate make file. Since we have Microsoft Visual C++ as our compiler, we’ll use the default setting which is Microsoft. We’ll explain later the other settings such as instrumentation

17 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-17 Renaming our OMD Expand the Object Model Diagrams in the browser and use the features dialog to rename the diagram from Model1 to Overview.

18 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-18 Generating Code We’re now ready to generate code. First close the Features window (click OK) Save the model then Generate/Make/Run Answer Yes to the question:

19 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-19 Hello World You should see the following: Stop the executable by either closing the console window or by using the command If during compilation, there is a problem, then simply double-click on the error to go directly to the diagram or the part of the browser where the error occurred.

20 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-20 The generated files The generated files will be in the directory C:\Work\Hello\Test\Release executable main make file Display class

21 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-21 Editing the Code We can edit the generated files from within Rhapsody. Select the class Display in the browser, right-click and select Edit Class

22 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-22 Modifying the Code We can modify the generated code In the Display.cpp file change: std::cout << “Hello World” << std::endl; to: –std::cout << “Constructed” << std::endl; Transfer the focus to another window to roundtrip the modifications back into the model. Note that the model has been automatically updated. In general the roundtripping works pretty well, but beware not everything can be roundtripped!

23 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-23 Why doesn’t the constructor show up on the OMD? It doesn’t show up simply because we added it from the browser To display it on our diagram we can select the class on the Overview OMD, right-click and select Display Options … Select to display All or explicitly select the operation and it will appear.

24 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-24 Displaying the Main and Make The Main and Make files can be displayed from within Rhapsody by simply right-clicking on the configuration and selecting edit :

25 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-25 Project Files Generated files for the Test component AutoSave The model ReverseEngineering Log (appeared when we roundtripped) Event History List (Will be used later when we animate) Rhapsody Work Space Visual Basic Macros

26 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-26 Part One : Example 2 Basic Rhapsody Count Down

27 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-27 Copying a Project Select File -> Save As Press to select the Work folder Press to create a new folder Rename “new folder” to “CountDown” Select the new folder “CountDown” Save the project as CountDown.rpy The new CountDown project is opened in Rhapsody with the previous project workspace preserved Each time there is an auto-save, Rhapsody will only save just what has changed since the last auto-save.

28 Rhapsody in C++ Tool Training "Essential" © I-Logix v4.1 01/01/2003 E1-28 המשך בתרגיל 3 תשמור את תקיה של countdown עד אז! שמירה ברשת: –תעתיק את התקיה הראשית של הפרויקט החדש לרשת. תפתח הפרויקט ברשת לוודא שהקבצים לא השתבשו. –ליתר ביטחון תשמור את הפרויקט במדיה נשלפת כמו disk on key. –אם אין לך disk on key, ליתר ביטחון תעשה את הפרויקט החדש קובץ zip וכדומה ותעתיר אותו לרשת –בשום פנים ואופן אל תעבוד בפרויקט ברשת. תעתיק אותו לדיסק המקומי, ורק בסוף תשמור אותו ברשת.


Download ppt "Rhapsody in C++ Tool Training "Essential" © I-Logix 1999-2003 v4.1 01/01/2003 E1-1 Essential Rhapsody in C++ Part One Basic Rhapsody."

Similar presentations


Ads by Google