Download presentation
Presentation is loading. Please wait.
1
Subsystem & C++ Code Generation
class boy { private: int age; public: study(); } Code gen Page 1
2
Generation Overview Subsystem & View
Rose creates a Subsystem and View for every selected package The View defaults to the login ID Imports are created for each View based on dependencies specified between packages C++ Code Rose generates C++ code based on the information contained in The model specifications The code generation properties Code will be added to the generated code Added code is placed into protected code regions so it is preserved from one iteration to the next Rose will use the component assignment in determining the files used to contain the generated source code Page 2
3
Code Generated for Classes Assigned to Components
AddEmployee Addmplye.cpp definition for AddEmployeeTransaction AddHourlyEmpTransaction Addmplye.h declaration for Page 5
4
Generation Step-By-Step
Set the directory name Generate Subsystems and Views Select the classes for code generation Generate the code Fix any errors Add any needed additional code Compile, link, and test the edited files Save the model Page 12
5
Step 1: Set the Directory Name
The directory name specified is the directory in which all subdirectories and files for a project are generated User-specified (Use this one) The user-specified name must be a valid, existing file system directory name The name may be a relative or an absolute pathname AUTO GENERATE (default value) The current working directory is the project directory Created by Rose if the model property to create missing directories is set to true Blank The root directory is the project directory Page 13
6
Directory (Model Property)
To change the directory name from the default value 1. Make sure all components in the model are de-selected. 2. Select the Tools:Properties:Edit Properties menu option or press F4. 3. Double-click on the Directory field to place the property in edit mode. 4. Click to begin typing and enter the desired directory name. Note: If the CreateMissingDirectories property is set to true all missing directories will be created automatically by Rose. If the property is set to false, any user entered directory must be created manually before the code is generated by Rose. Page 14
7
Step 2: Generate Subsystems and Views
Rose will create a Subsystem (and View) for every selected Package in the model Imports between Views will be created corresponding to the dependencies between Packages CAUTION: Modal dialog boxes may get hidden, freezing Rose
8
Creating Subsystems & Views
9
Creating New View
10
Step 3: Select the Classes
Code will be generated as part of Step 2. However, if there were errors, or if iteratively generating code, then: Rose can generate code for A single class A group of classes All classes in a logical package A group of packages All components in a physical package A group of subsystems Page 15
11
Step 4: Generate the Code
Rose will generate code for all selected components The Code Generation Status dialog box updates code generation status Rose will stop code generation if the number of errors reaches the error limit specified in the Model Property Set The default number of errors is set to 30 To generate code 1. Select the Tools:Generated C++ Code menu option. OR 1. Press Ctrl G. Page 16
12
Error Limit (Model Property)
To change the error limit 1. Make sure all components in the model are de-selected. 2. Select the Tools:Properties:Edit Properties menu option or press F4. 3. Double-click on the ErrorLimit field to place the property in edit mode. 4. Click to begin typing and enter the desired error limit. Page 17
13
Step 5: Fix Any Errors Rose writes all errors to a log window
Errors are posted to the log window even if it is not displayed Common code generation errors and warnings Error: Missing attribute data type Void is assumed Warning: Unspecified multiplicity/cardinality indicators 1 is assumed Warning: Missing operation return type Page 18
14
Step 6: Add Implementation Code
The implementation file contains skeletal member function definitions for Rose generated and user-defined member functions Code for the implementation of the member function should be placed within the protected code region void AddHourlyEmpTransaction::setRate(float inpRate) { //## begin AddHourlyEmpTransaction::setRate% body preserve=yes Implementation code is added here //## end AddHourlyEmpTransaction::setRate% body } Page 19
15
Step 7: Compile, Link, and Test Code
Code generated by Rose may be complied and linked with commercial C++ compilers If there are errors They may be fixed in Rose and the code can be re-generated They may be fixed in the code itself and the Analyzer may be used to update the Rose model Page 20
16
Step 8: Save the Model The Rose model should be saved to incorporate and preserve any additional information created during code generation
17
Exercise: Define architecture
Show the structure of your architecture by making your model look like this:
18
Check package People If it doesn抰 already, the people package should look like:
19
Create the architecture and initial code
Tools:Properties:Edit Properties for Project, change the Directory value Select all the packages Click Tools:C++:Subsystems, Views, and Code Generation Click ok or yes as the various dialog boxes appear Dismiss the red boxes as the word done appears in their title When this is done Rose will have had Apex: Create subsystems and views for each of the 3 packages Create the code in the proper subsystems and views Version control the code Check the code out
20
Compile the Generated Code
Save the model in People.ss/<user>.wrk Look in the log at any errors, but do nothing Attempt to compile the people package select the package people Click tools:compile:code Click OK Notice the error that appears in the blue error window, Could not open include file 搖niversityArtifacts/courseOffering.h Select it and click the visit button Let抯 see if we have visibility to the universityArtifacts subsystem Check imports by clicking control:show:imports NO IMPORTS!!!
21
Fix imports Think about the model, People should have visibility to UniversityArtifacts, not the other way around! Close the last 3 windows that Apex showed you (Imports, editor, error summary) Make your model look like this! People UniversityArtifacts Interfaces
22
Try again Select all the packages
Click tools:C++:Subsystems, Views, and Code Generation Click ok or yes as the various dialog boxes appear Ignore any errors in the log and try to compile the people package again select the package people Click tools:compile:code Click OK Notice there are still errors, select the first error Error: ...people.ss/<user>.wrk and click the visit button DO NOT DISMISS THE ERROR BOX, YOU NEED IT IN A COUPLE OF SLIDES
23
Continue trying... Click control:show:imports
Notice it does not import the people subsystem! We don抰 want to import the people subsystem. The code generated by the model is WRONG! In the model right-mouse each of the associations in turn and de-select the navigable menu item Notice the line association becomes an arrow (one-way association)! To make our lives easier, change the multiplicity on both ends of the associations to ?
24
Continue trying... Return to the error window and scroll down and visit the next error. The attributes need to have types other than VOID, make them int in the model Select the People & UniversityArtifacts packages and click tools:C++:Code Generation, we don抰 need to refresh the architecture, just the generated code. There should be no errors Attempt to compile the People package select the package Click tools:compile:code Click OK IT SHOULD NOW COMPILE WITH ONLY WARNINGS!
25
Visualization example
sandra carrico: The first time this doesn抰 work, the second time it does, but it core dumps rose first. Get me a better example please Visualization example Edit the file registrationUser.h In the registrationUser class add a new public attribute called emergencyContact with type int click navigate:other part from registrationUser.cc, click code Click Rose:Visualize Watch the analyzer work until it brings the model up in your Rose session Open the people package Select the registrationUser class and right click ShowAllAttributes The new attribute is there!
26
Round-Trip Open the old model Click file:update
Find your reverse engineered model in: People.ss/<user>.wrk/.Rational/Rose Models/<?.red Click ok
27
Exercise: Code Generation
1. Select the Course class in the UniversityArtifacts category 2. Generate the University Subsystem 3. Generate the Course code 4. Check the log for errors 5. Fix any errors 6. Re-generate the code 7. Repeat steps 5 and 6 until the code is generated successfully Page 21
28
Exercise: Code Generation
29
Exercise: Code Generation
7. Add the following code to the available() member function return (True); 8. Add the following method to the Course class (using Rose) void removeStudent(StudentInfo); 9. Re-generate the code Verify that the added method for the available method is still there Verify that the new method is added to the .h and .cpp files Will this code compile? Why or why not ? Page 23
30
Exercise: Discussion What did you notice about the code generated by Rose ? Page 24
31
Code Generation Questions
How can I make a destructor virtual? How can I inline a member function? name of the generated get/set methods? How can I change the How can I change the containers used by Rose ? How can I 搕urn off?the automatic generation of member functions? How can I make a member function virtual ? Can I make a member function a constant function? Code Generation Edit Properties provide these capabilities (and more) ! Page 25
32
What Are Code Generation Properties ?
Code generation properties provide language specific information that is not expressed in the notation (UML) or in the component specifications Property sets exist for The model Classes, roles, dependency relationships, attributes, and operations Subsystems, component specifications, and component bodies Rose provides a default property set for each type of component in a Rose model Do NOT delete this property set The C++ Generator provides a default property set for each kind of model component, and attaches the appropriate default property set to each component when it is created. Page 26
33
Default Property Sets The default property set provided by Rose may be changed Changes made to the set apply to all components that use the default property set Changes made to individual items only apply to the selected component New property sets may be created using the Clone option Property sets may be deleted using the Delete option The Attach Set button provides the capability to use a different property set for a component or group of components To edit a property set 1. Click to select the desired component. 2. Select the Tools:Properties:Edit Properties menu option or press F4. To create a new property set 3. Click the Clone Set button. 4. Click to begin typing and enter the name of the new property set. 5. Click the OK button to close the Clone Property Set dialog box. 6. Click the OK button to close the Edit <component> Properties dialog box. To delete a property set 3. Position the cursor over the arrow in the Set Name field, click to display the available sets, and click to select the desired property set. 4. Click the Delete Set button (if the set is attached to a component in the model, a confirmation dialog box is displayed before the set is deleted.) Page 27
34
The Model Property Set The model property set contains information that deals with the model File Information Root directory into which generated code files are placed, extensions for header and implementation files, create missing directories Compiler specific alternatives Allow templates and/or protected inheritance Default code information Data type to use as the return value for Boolean functions, default container classes Controlling the behavior of the C++ code generator Error limit, stop processing on error To display the model property set 1. Make sure all components in the model are de-selected. 2. Select the Tools:Properties:Edit Properties menu option or press F4. To attach a model property set 1. Position the cursor over the arrow in the Set Name field. 2. Click the arrow to display the available model property sets. 3. Click to select the desired model property set. 4. Click the Attach Set button. 5. Click the OK button to close the Edit Model Properties dialog box. Page 28
35
The Class Property Set The class property set contains information that controls the code generated for classes Code name Name for the class in the generated code Implementation type Implement the class as elemental data type instead of a C++ class (typedef generated) Standard operations Constructors, destructor, assignment, equality, relational, storage, subscript, dereference, indirection, stream To display the class property set 1. Select a class or group of classes. 2. Select the Tools:Properties:Edit Properties menu option or press F4 to make the Edit Class Properties dialog box visible. To attach a class property set 1. Position the cursor over the arrow in the Name field. 2. Click the arrow to display the class names (classes displayed are those classes selected before the Edit Class Properties dialog box is displayed). 3. Click to select a class or to select all classes choose <All selected>. 4. Position the cursor over the arrow in the Set Name field. 5. Click the arrow to display the available class property sets. 6. Click to select the desired class property set. 7. Click the Attach Set button. 8. Click the OK button to close the Edit Class Properties dialog box. Page 29
36
The Attribute Property Set
The attribute property set contains information that controls the code generated for attributes Data members Generation of a data member, name of the data member (if different than in the model), data member visibility Get and set operations Generation of get/set member functions, visibility, kind, inline the get/set member functions, get function is constant, get/set by reference, set returns a value To display the attribute property set 1. Double-click on a class to display the Class Specification dialog box. 2. Click to select an attribute or group of attributes in the Attributes field. 3. Select the Tools:Properties:Edit Properties menu option or press F4 to make the Edit Attribute Properties dialog box visible. To attach an attribute property set 1. Position the cursor over the arrow in the Name field. 2. Click the arrow to display the attribute names (attributes displayed are those attributes selected before the Edit Attribute Properties dialog box is displayed). 3. Click to select an attribute or to select all attributes choose <All selected>. 4. Position the cursor over the arrow in the Set Name field. 5. Click the arrow to display the available attribute property sets. 6. Click to select the desired attribute property set. 7. Click the Attach Set button. 8. Click the OK button to close the Edit Attribute Properties dialog box. Page 30
37
Attribute Get/Set Member Functions
Visibility of the generated get/set member functions is not a code generation property It is set via the Access field in the Attribute Specification The default is private Visibility of the data member is a code generation property Data member visibility field The default is implementation (private in C++) Page 31
38
Attribute Specification
name attribute get/set methods have public access Page 32
39
Generated Code public: name attribute has public get/set methods
//## Get and Set Operations for Class Attributes (generated) //## Attribute: name const char* getName() const; void setName(char*const value); private: //## Attribute: empID const long getEmpID() const; //## Attribute: phoneNumber const char* get_phoneNumber() const; void set_phoneNumber(char*const value); name attribute has public get/set methods other attributes have private get/set methods Page 33
40
The Operation Property Set
The operation property set contains information that controls the code generated for operations Entry and Exit code Code or comments inserted into the implementation of the body of the operation Operation implementation specifics Operation is constant, operation kind, operation name, inline the operation To display the operation property set 1. Double-click on a class to display the Class Specification dialog box. 2. Click to select an operation or group of operations in the Operations field. 3. Select the Tools:Properties:Edit Properties menu option or press F4 to make the Edit Operations Properties dialog box visible. To attach an operation property set 1. Position the cursor over the arrow in the Name field. 2. Click the arrow to display the operation names (operations displayed are those operations selected before the Edit Operation Properties dialog box is displayed). 3. Click to select an operation or to select all operations choose <All selected>. 4. Position the cursor over the arrow in the Set Name field. 5. Click the arrow to display the available operation property sets. 6. Click to select the desired operation property set. 7. Click the Attach Set button. 8. Click the OK button to close the Edit Operation Properties dialog box. Page 34
41
The Role Property Set The role property set contains information that controls the generation of code for associations and aggregations Data members Name if the relationship is not named, generate data member, data member name, data member visibility, class, association class, qualified class, container class name Get and set operations Generate get/set methods, get/set kind, get/set name, inline get/set, get is constant, get/set by reference, set returns value Header file inclusion Use a forward reference or a #include To display the role property set 1. Double-click on a class to display the Class Specification dialog box. 2. Click to select an association role or group of roles in the Relationships field. 3. Select the Tools:Properties:Edit Properties menu option or press F4 to make the Edit Role Properties dialog box visible. To attach a role property set 1. Position the cursor over the arrow in the Name field. 2. Click the arrow to display the role names (roles displayed are those roles selected before the Edit Role Properties dialog box is displayed). 3. Click to select a role or to select all roles choose <All selected>. 4. Position the cursor over the arrow in the Set Name field. 5. Click the arrow to display the available role property sets. 6. Click to select the desired role property set. 7. Click the Attach Set button. 8. Click the OK button to close the Edit Role Properties dialog box. Page 35
42
The Uses Property Set The uses property set contains information that controls the code generated for dependency (uses) relationships Header file inclusion Use a forward reference or a #include To display the uses property set 1. Double-click on a class to display the Class Specification dialog box. 2. Click to select a uses relationship or group of uses relationships in the Relationships field. 3. Select the Tools:Properties:Edit Properties menu option or press F4 to make the Edit UsesProperties dialog box visible. To attach a uses property set 1. Position the cursor over the arrow in the Name field. 2. Click the arrow to display the uses relationship names (uses relationships displayed are those relationships selected before the Edit UsesProperties dialog box is displayed). 3. Click to select a uses relationship or to select all uses relationships choose <All selected>. 4. Position the cursor over the arrow in the Set Name field. 5. Click the arrow to display the available uses property sets. 6. Click to select the desired uses property set. 7. Click the Attach Set button. 8. Click the OK button to close the Edit Uses Properties dialog box. Page 36
43
The Subsystem Property Set
The subsystem property set contains information controlling the placement of code generated for subsystems File Information Root directory into which generated code files are placed To display the subsystem property set 1. Click to select a subsystem group of subsystems. 2. Select the Tools:Properties:Edit Properties menu option or press F4 to make the Edit Subsystem Properties dialog box visible. To attach a subsystem property set 1. Position the cursor over the arrow in the Name field. 2. Click the arrow to display the subsystem names (subsystems displayed are those subsystems selected before the Edit Subsystem Properties dialog box is displayed). 3. Click to select a subsystem or to select all subsystems choose <All selected>. 4. Position the cursor over the arrow in the Set Name field. 5. Click the arrow to display the available subsystem property sets. 6. Click to select the desired subsystem property set. 7. Click the Attach Set button. 8. Click the OK button to close the Edit Subsystem Properties dialog box. Page 38
44
The Module-Spec Property Set
The module-spec property set contains information that controls the code generated for module specifications Generate code flag True if code is to be generated for the module Module comments Configuration management identification, copyright information Code information File name, preprocessor directive symbol, additional #include files, name to be used for generated #include files, inlining style To display the component-spec property set 1. Click to select a component specification or a group of component specifications. 2. Select the Tools:Properties:Edit Properties menu option or press F4 to make the Edit component-Spec Properties dialog box visible. To attach a component-spec property set 1. Position the cursor over the arrow in the Name field. 2. Click the arrow to display the component specification names (component specifications displayed are those component specifications selected before the Edit component-Spec Properties dialog box is displayed). 3. Click to select a component specification or to select all component specifications choose <All selected>. 4. Position the cursor over the arrow in the Set Name field. 5. Click the arrow to display the available component-spec property sets. 6. Click to select the desired component-spec property set. 7. Click the Attach Set button. 8. Click the OK button to close the Edit component-Spec Properties dialog box. Page 39
45
The Module-Body Property Set
The module-body property set contains information that controls the code generated for module specifications Generate code flag True if code is to be generated for the module Module comments Configuration management identification, copyright information Code information File name, preprocessor directive symbol, additional #include files, name to be used for generated #include files, inlining style To display the component-body property set 1. Click to select a component body or a group of component bodies. 2. Select the Tools:Properties:Edit Properties menu option or press F4 to make the Edit component-Body Properties dialog box visible. To attach a component-body property set 1. Position the cursor over the arrow in the Name field. 2. Click the arrow to display the component body names (component bodies displayed are those component bodies selected before the Edit Component-Body Properties dialog box is displayed). 3. Click to select a component body or to select all component bodies choose <All selected>. 4. Position the cursor over the arrow in the Set Name field. 5. Click the arrow to display the available component-body property sets. 6. Click to select the desired component-body property set. 7. Click the Attach Set button. 8. Click the OK button to close the Edit Component-Body Properties dialog box. Page 40
46
Managing Property Sets
The default property sets may be changed to incorporate desired properties for all elements in the project New property sets may be created using existing property set as a starting point Changes to a property set may be restricted to only selected elements Page 41
47
Changing a default Property Set
name of get/set methods changed To change a default property set 1. Select an element that is attached to the default property set. 2. Select the Tools:Properties:Edit Properties menu choice or press F4. 3. Double-click on the property to be changed to place the property in edit mode. 4. Enter or select the new property. 5. Repeat steps 3 and 4 for each property to be changed. 6. Click the OK button to close the Edit Class Properties dialog box. Page 42
48
Creating a New Property Set
virtual property set operation kind set to virtual To create a new property set 1. Select to an element of the desired type (class, attribute etc.) 2. Select the Tools:Properties:Edit Properties menu choice or press F4. 3. Click to select the starting property set (set to be cloned). 4. Click the Clone button. 5. Enter the name of the new property set and click the OK button. 6. Make any desired changes to the new property set. 7. Click the OK button to close the Edit Class Properties dialog box. NOTE: The new property set must be attached to each element that needs to use it. Page 43
49
Applying Property Set Changes to Selected Elements
default property set destructor kind set to virtual applies ONLY to the Order class To change properties for selected elements 1. Click to select the desired element (class, attribute, etc.). 2. Select the Tools:Properties:Edit Properties menu choice or press F4. 3. Click to select the checkbox for the property to be changed. 4. Double-click on the property to be changed to place the property in edit mode. 5. Enter or select the new property. 6. Repeat steps 3 through 5 for each property to be changed. 6. Click the OK button to close the Edit Class Properties dialog box. Page 44
50
Exercise <skip>: Property Sets for Class Diagrams
1. Change the default model property set Direct all code to go to ~<yourlogin>/rose 2. Create the following new class property sets NoSpecial Only generate constructors and destructor member functions VirtualDestructor Generate a virtual destructor Page 48
51
Exercise <skip>: Property Sets for Class Diagrams
Change the default attribute property set Declare set and get functions in the form setName where name is the name of the data member getName where name is the name of the data member Create the following new attribute property set NoGet Do not generate get member function Declare set member function in the form setName where name is the name of the data member Hint 1. The case of the name derived from $attribute (attribute name) can be controlled ${attribute:l} -- all characters are converted to lower case ${attribute:u} -- all characters are converted to upper case ${attribute:f} -- case of the first character is inverted ${attribute:i} -- the case of all characters in the attribute name is inverted 2. Change the default property set before you make the NoGet property set. Page 49
52
Exercise <skip>: Property Sets for Class Diagrams
Create the following new operation property sets Virtual The operation is virtual Abstract The operation is abstract Change the default role property set Declare set and get functions in the form setName where name is the name of the data member getName where name is the name of the data member Hints 1. The first character of the get/set member functions does NOT have to be capitalized since the target is a class which already starts with a capital letter. Page 50
53
Exercise <skip>: Property Sets for Class Diagrams
Create the following new role property sets ForwardReference Generate a forward reference not a #include ProtectedData Generate a protected data member as the implementation of the association Create the following new uses property sets Page 51
54
<skip> Code Generation Instructions
Use the property sets created and the default property set to generate the code according to the following rules Update the property sets for individual components as necessary Model information Put all code in the following directory ~<yourLogin>/rose OrderItem class No special instructions Page 52
55
<skip> Code Generation Instructions
Customer class Do not generate a get function for the discount attribute Declare set function in the form setName where name is the name of the data member Make the member function placeOrder() virtual Use a #include for the relationship between Customer and Order Hints 1. NoGet attribute property set does not create a get member function. 2. The default attribute property set was changed to generate get/set functions in the form setName where name is the name of the attribute. 3. Virtual operation property set has the operation kind set to virtual. 4. ForwardReference uses property set generates a forward reference instead of a #include. Page 53
56
<skip> Code Generation Instructions
DBOrder class Only generate constructor, copy constructor, and destructor Generate a private set function for the attribute dateLastAccessed Do not generate a get function for the attribute dateLastAccessed Declare set function in the form setName where name is the name of the data member Use a forward reference for the relationship between DBOrder and Order class Hints 1. NoSpecial class property set only generates constructors and a destructor. 2. Access of a set function is set in the Attribute Specification 3. NoGet attribute property set does not create a get function. 4. The default attribute property set was changed to generate get/set functions in the form setName where name is the name of the attribute. 5. ForwardReference uses property set generates a forward reference instead of a #include. Page 54
57
<skip> Code Generation Instructions
Order class The member function cost() is abstract (pure virtual) Only generate constructor, copy constructor, and destructor Make the destructor virtual The data member urgency has protected get/set member functions Declare get and set functions in the form getName and setName where name is the name of the data member The data member urgency is protected The relationship between Order and OrderItem is protected Use a forward reference for the relationship between Order and Customer Hints 1. Abstract operation property set creates pure virtual functions. 2. NoSpecial class property set only generates constructors and a destructor. 3. Make the destructor in the NoSpecial class property set virtual ONLY for this class. 4. Access for get/set member functions is set in the Attribute Specification. 5. default attribute specification creates get/set member functions in the form setName and getName. 6. Change the default attribute property set to create a protected data member ONLY for the urgency attribute. 7. ProtectedData role property set creates a protected data member. 8. ForwardReference role property set generates a forward reference instead of a #include. Page 55
58
<skip> Code Generation Instructions
Generate the code If there are warnings and/or errors Fix the cause of the warnings and/or errors Re-generate the code Continue until the code is generated successfully Page 56
59
Exercise <skip>: Component Diagrams
Use the component diagrams for the Orders, Customers, and DatabaseInterface subsystems that were created earlier The diagrams are shown on the next three slides Page 57
60
Component Diagram <skip> : Orders / Main ### <lines>
AllOrders OrderItem Page 58
61
Component Diagram <skip>: Customers / Main
AllCustomers Page 59
62
Component Diagram <skip> : InventoryDatabase / Main
DBOrder Hint 1. The InventoryDatabase subsystem is a subsystem inside the DatabaseInterface subsystem. Page 60
63
Exercise <skip>: Property Sets for Component Diagrams
Change the default subsystem property set Direct all code to go to ~<your login>/rose Change the default component-spec and component-body property sets Add copyright information Copyright yourName Page 61
64
<skip> Code Generation Instructions
Generate the code for the subsystems If there are warnings and/or errors Fix the cause of the warnings and/or errors Re-generate the code Hints 1. Depress the Shift key and click to select the subsystems. Select the Tools, Generate C++ Code menu option. Page 62
65
<skip> Code Generation Questions
What files were generated? What directory were they placed in? What classes were defined in each of the files? Where did the copyright information get placed? How can classes by defined for each of the files? Page 63
66
Exercise <skip>: Category to Subsystem Mapping
Perform the following mappings Orders category to the Orders subsystem OrdersDatabase category to the InventoryDatabase subsystem Customers category to the Customers subsystem Hints 1. The Category specification is used to map categories to subsystems. Click to select the category and then select the Browse:Specification menu option. Page 64
67
Exercise <skip>: Class to Component Mapping
Perform the following mappings DBOrder class to DBOrder components OrderItem class to OrderItem components Order, StandingOrder, OverrideOrder, and SpecialOrder classes to AllOrders components Customer class to AllCustomers components Hints 1. The Class specification is used to map classes to components (category to subsystem mapping MUST occur first!) 2. The StandingOrder, OverrideOrder and SpecialOrders classes are shown in the OrderHierarchy diagram for the Orders category. Page 65
68
<skip> Code Generation Instructions
Generate the code for the subsystems If there are warnings and/or errors Fix the cause of the warnings and/or errors Re-generate the code Page 66
69
<skip> Code Generation Questions
What classes were defined in each of the files? How can the mapping be changed? What has to be added to the file allrders.h to make it compile ? How should the additions be made ? Hint 1. For the third question, look at data types, return types and container types. Page 67
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.