Original http://blog.csdn.net/ztz0223/article/details/7603041
I have already talked about some modeling operations in IBM RSA (IBM Rational Software Architect) V8 (v8.04). For details, refer to the following link:
One of ibm rsa (IBM Rational Software Architect) V8 learning, installing ibm rsa (IBM Rational Software Architect) V8 learning 2 new project ibm rsa (IBM Rational Software Architect) v8 3 C ++ class diagram ibm rsa (IBM Rational Software Architect) V8 modeling 4 C ++ class diagram converted into C ++ code ibm rsa (IBM Rational Software Architect) v. C ++ inheritance Design For V8 modeling Learning The entireArticleThe class graph modeling of C ++ is almost the same. The three features of object-oriented are similar: encapsulation, inheritance, and polymorphism. Class graphs are actually descriptive encapsulation, as mentioned in the previous section, if there is polymorphism, we will describe one of the gof Design Patterns in the future. Today we will talk about a very important feature of C ++-a template with a namespace ). Template Modeling is the simplest. Let's get started: 1. Continue with the previous project. A class inheritance diagram has been created before, as shown below: The bar on the graph is displayed, and the yellow rectangle area is the package mentioned in RSA, which is called namespace in C ++. 2. Create a new package named template_space, modify the constructor to the cpp_namespace type, and enter the namespace name or template_space in "advanced" of "attribute, if you do not do this step, your namespace Code There will be no name, that is, an anonymous namespace: 3. Select the package (namespace), right-click the class graph, and name it "temp_class_diag". 4. After adding the class graph, in the resource manager, the corresponding namespace and class diagram are available below the package: 5. Add a class named class_temp: 6 in the class diagram and change the class to the cpp_property type, place the cursor over the class class_temp, right click --> "add UML" --> "template parameters", as follows: 7. Select a class, change the name to XX, and add variables to the class, m_xx_temp: select the variable type as template XX: 8. Save the project and generate the C ++ code. The corresponding C ++ code is OK. The Code is as follows:
[CPP] View plaincopy
-
- # Ifndef class_temp1_h
-
- # Define class_temp1_h
-
- // Begin section for file class_temp1.h
- // Todo: add definitions that you want preserved
-
- // End section for file class_temp1.h
-
-
-
-
-
- Namespace template_space
-
- {
-
-
-
-
- // @ Generated "UML to C ++ (COM. IBM. xtools. Transform. uml2.cpp. cpptransformation )"
-
- Template <class XX>
-
- Class class_temp
- {
-
-
- // Begin section for: class_temp1
-
- // Todo: Add attributes that you want preserved
-
- // End section for: class_temp1
-
-
- PRIVATE:
-
-
-
- // @ Generated "UML to C ++ (COM. IBM. xtools. Transform. uml2.cpp. cpptransformation )"
- XX m_xx_temp;
-
-
-
-
-
-
- };// End class class_temp
-
-
-
- }// End namespace
-
-
-
- # Endif
It's a weekend. Haha, it's exhausted. In fact, I am very lazy. I am not afraid that I will forget it. I will not write this. Many of them have been developed by myself and I have been pondering it for a long time, books related to ibm rsa are of Version 7 or earlier versions, and C + is rarely mentioned. + Related operations. Please refer to the source for reprinting! Last sentence: everything is so beautiful, haha.