Creating files
Files owned by a component are compiled together to build the component. You can specify which model elements are generated in each file, the file names, and the directory paths. You can also create a file in the browser and drag-and-drop it into a component diagram.
About this task
A file must be nested within a component or a folder.
Note: A file cannot contain another element.
Procedure
- Right-click a Component in the browser and select Add New > File. The File window opens.
- Begin to define this new file by typing the Name you want to replace the system generated name. Click Apply to save the name and keep the window open. The new file name displays in the diagram and in the browser, under the component with which it is associated. Note: A file must be an element of a component or a folder. If the component diagram is under the project node, it is not yet associated with a component. First create a component, then nest the file by drawing it inside the component. If the diagram is already nested under an existing component, you can draw the file in the "free space" of the diagram editor.
- Change the remaining fields to define the file as you want.
- Path specifies where a file is to be generated in relation to the configuration directory. If this field is blank, the file is generated in the configuration directory.
- File Type specifies the type of file that is to be generated. A specification file contains the specifications of all elements; an implementation file contains their implementations. They are specified by their suffixes, as follows:
Table 1. Suffixes for implementation and specification files by language File type C++ C Java Implementation .cpp
.c
.java
Specification .h
.h
N/A Choose one of the following values:
- Logical creates both implementation and specification files.
- Specification generates only a specification file. Both specifications and implementations of all elements assigned to this file are generated into this file.
- Implementation generates only an implementation file. Both specifications and implementations of all elements assigned to this file are generated into this file.
- Other where one file is generated with the name and extension specified in the Name field. Both specifications and implementations of all elements assigned to this file are generated into the file.
- Elements lists the elements mapped to a file. Elements that are not explicitly mapped to files are generated in the default files that Rhapsody® would normally generate for these elements in the configuration directory.
- Environment Settings where the product enters the settings from your environment. The fields are as follows:
- Environment where this read-only field specifies which environment (Microsoft, Solaris2, and so on) is selected for the active configuration. You cannot change the environment for an individual file.
- Build Set where this read-only field specifies the build setting (Debug or Release mode) for the active configuration. You cannot change the build setting for an individual file.
- Compiler Switches specifies the compiler switches for the configuration. Compiler switches default to those switches used for the configuration, but you can override them for an individual file.
- Link Switches specifies the link switches used to link the active configuration. You cannot change link switches for an individual file.
- Description describes the element. This field can include a hyperlink. See Using project units for more information.
- Click OK.