📄 visualcp.txt
字号:
Generating C++ for Microsoft Visual C++ with MFC
The purpose of this paper is to describe how to generate Visual C++ with MFC code from class diagrams, state diagrams, and object interaction diagrams. These scripts are "getting started" scripts that must be updated for your development environment.
These scripts are "getting started" scripts that must be updated for your development environment.
1. Generating Microsoft Visual C++ from a class diagram. The following are the Visual C++ with MFC Code generation scripts.
These scripts assume long file names.
VC2HD0.SCT - Creates Visual C++ with MFC header file with CList - minimum code
VC2FU0.SCT - Creates Visual C++ with MFC header file with CList - minimum code
VC2HD1.SCT - Creates Visual C++ with MFC header file with CList - sufficient code
VC2FU1.SCT - Creates Visual C++ with MFC header file with CList - sufficient code
VC2HD2.SCT - Creates Visual C++ with MFC header file with CList - maximum code
VC2FU2.SCT - Creates Visual C++ with MFC header file with CList - maximum code
CPPOLEH.SCT - Creates OLE Automation Server Header file
CPPOLEC.SCT - Creates OLE Automation Server CPP file
Class Diagram: VC2CAR.OMT
Script Files: VC2HD0.SCT and VC2FU0.SCT; VC2HD1.SCT and VC2FU1.SCT; VC2HD2.SCT and VC2FU2.SCT
Main File: N/A
2. C++ Code Generation from State Diagrams
The following are the general steps to test out the C++ code generation scripts from state diagrams:
1. Create a directory for the state .omt files, script files, and C++ files, e.g. WCSTATE.
2. Copy the appropriate files into each directory, e.g. copy st*.*.
3. In With Class open a state diagram, e.g. ST1STATE.OMT.
4. Select "Utilities - Generate State Code/Report" to generate a text report. Enter a report file name, e.g. RPTSTATE.TXT. Select a state report script, e.g. RPTSTATE.SCT, DDSTATE.SCT, or TABSTATE.SCT. After report generation, select "File - Edit File" to examine the generated report.
5. Select "Utilities - Generate State Code/Report" to generate C++ code.
6. Enter the header file name, e.g. CONTROLL.H
7. Select the header code generation script, e.g. STAHEAD1.SCT.
8. Select "Edit - Edit File" and open CONTROLL.H for review.
9. Select "Utilities - Generate State Code/Report".
10. Enter the source file name, e.g. CONTROLL.CPP
11. Select the source code generation script, e.g. STAFUNC1.SCT.
12. Select "Edit - Edit File" and open CONTROLL.CPP for review.
13. In your C++ environment, create a project, e.g. STATE1.MAK and add the CONTROLL.CPP and ST1MAIN1.CPP.
14. Compile and run the program.
15. Go back to With Class and update the state diagram with new states, events, conditions, and actions and repeat the entire process.
3. Creating Message Sequence Tables from Object Interaction Diagrams
Object Interaction Diagram: CAROBJ.OMT
Script File: TABOBMSG.SCT
The following are the general steps to generate the message sequence table and then update C++ code with messages.
- Open the object interaction diagram, e.g. CAROBJ.OMT.
- Select "Utilities - Generate Object Code/Report".
- Enter a report name, e.g. TABMSG.TXT.
- Browse and select the message sequence table script, e.g. TABOBMSG.SCT to generate the message sequence table.
- Cut and paste messages from the message sequence table into your code.
- As required update the object interaction diagram and the message sequence script (TABOBMSG.SCT) and repeat the process.
4. Updated scripts are requested. Many thanks, Richard Felsinger, RCF Associates 960 Scottland Dr, Mt Pleasant, SC 29464 telephone 803-881-3648 e-mail 71162.755@compuserve.com
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -