6 c ++ class template design for ibm rsa (IBM Rational Software Architect) V8

Source: Internet
Author: User

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
  1. # Ifndef class_temp1_h
  2. # Define class_temp1_h
  3. // Begin section for file class_temp1.h
  4. // Todo: add definitions that you want preserved
  5. // End section for file class_temp1.h
  6. Namespace template_space
  7. {
  8. // @ Generated "UML to C ++ (COM. IBM. xtools. Transform. uml2.cpp. cpptransformation )"
  9. Template <class XX>
  10. Class class_temp
  11. {
  12. // Begin section for: class_temp1
  13. // Todo: Add attributes that you want preserved
  14. // End section for: class_temp1
  15. PRIVATE:
  16. // @ Generated "UML to C ++ (COM. IBM. xtools. Transform. uml2.cpp. cpptransformation )"
  17. XX m_xx_temp;
  18. };// End class class_temp
  19. }// End namespace
  20. # 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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.