Question & Answer
Question
How do you use Template Class Specialization in IBM Rational Rhapsody?
Cause
Support for Template Class Specialization is supported in Rational Rhapsody release 7.1 and higher.
Answer
To use Template Class Specialization you can do the following:
- Create a class template with parameter Class T.
For examplemyTemplate
- Create a second class template.
Leave the name as default for now, For Exampleclass_1.
You cannot rename it tomyTemplate at this stage without Rhapsody displaying a "
duplicate name" error.
- Open the features windows of the
class_1 template.
- Select your
myTemplate<T> template in the drop down list in the lower window of the parameters tab.
Note that Rhapsody has now changed theclass_1 template name to "
myTemplate".
- Select the template parameter "T" in the features window of the specialization, (in the upper panel) and remove it.
- Enter a specialized value in the lower value field to specialize the template. Hit apply.
The specialized template will appear in the same source file as your original template.
You can now add specialized methods and attributes for the
myTemplate template specialization by: - Right clicking the template class
- Selecting
Add.
[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"7.2;7.3;7.4;7.5;7.6;8.0;8.1;8.2","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]
Historical Number
10477
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg21323750