NI Requirements Gateway 2018 Help
»View Product Info
The Code C type browses a specified directory for .c, .h and .cpp files and parses the functions defined in the .c and .cpp files for C and C++ style comments that use the correct syntax for references.
The Code C type captures the following traceability information from a source file.
- Section—A directory, C source file, or function.
- Reference—// Implements reqid or /* Implements reqid */. The Code C type analyzes the comments associated with a file and the functions in the file, and associates traceability information with the file or with a function in the file using the following criteria:
- If the comment or a block of comments immediately precedes a function, with no intervening blank lines, the comment is associated with the function.
- If the comment or a block of comments immediately precedes a function but one or more blank lines exist between the comment and the function, the comment is associated with the file.
- If the comment or a block of comments exists within the function, the comment is associated with the function.
Configuring a Code C Document
The Code C type defines the following document settings you configure for a Code C document on the Details tab of the Project pane of the Configuration dialog box.
- File or Directory—A directory that contains source files.
- Variable—Defines the following document variables:
- Category—Assigns an analysis category to the C document. Select a category from the Value pull-down menu. Use the Overall Quality pane of the Management view to review the use of analysis categories in a project.
- Prompt when files change—Specifies whether Requirements Gateway prompts you to reload the project when you modify the source file. Use the Value column option to enable this variable.
- Includes function body—Captures the full body text of a function from a C source file and includes the body text in the intermediate file so that you can track changes to traceability information stored within the function text. Use the Value column option to enable this variable.
Creating a Code C Reference from Requirements Gateway
To add a reference in a C document, insert the correct syntax for a Code C reference into the source file. In Requirements Gateway, right-click an upstream requirement covered by a downstream Code C document and select Copy For»Code C Comment from the context menu to copy // Implements reqid to the clipboard. You can then paste the reference in a source file.
Special Considerations when Creating a Custom Code C Type
When you create a custom Code C type, you may need to customize the following type definition settings on the Analysis tab or Advanced Options tab of the Types pane of the Configuration dialog box.
- Filters—Specifies the file types to analyze.
- Include subdirectories—Enable this option to search for files in the subdirectories of the selected directory you specify.