Main Content

systemcomposer.rptgen.report.Function Class

Namespace: systemcomposer.rptgen.report
Superclasses: slreportgen.report.Reporter (Simulink Report Generator)

Function reporter

Since R2022b

Description

Create a reporter that reports on all functions in a System Composer™ software architecture model.

The systemcomposer.rptgen.report.Function class is a handle class.

Creation

reporter = Function("Source",result) creates a reporter that reports on a function using a systemcomposer.rptgen.finder.FunctionResult object.

Properties

expand all

Function result, specified as a systemcomposer.rptgen.finder.FunctionResult object.

Custom summary reporter, specified as a reporter object. The default value is the mlreportgen.report.BaseTable (MATLAB Report Generator) report object.

Source of the template for this reporter, specified in one of these ways:

  • Character vector or string scalar that specifies the path of the file that contains the template for this reporter

  • Reporter or report whose template this reporter uses or whose template library contains the template for this reporter

  • Document Object Model (DOM) document or document part whose template this reporter uses or whose template library contains the template for this reporter

The specified template must be the same type as the report to which you append this reporter. For example, for a Microsoft® Word report, TemplateSrc must be a Word reporter template. If the TemplateSrc property is empty, this reporter uses the default reporter template for the output type of the report.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Name of the template for this reporter, specified as a character vector or string scalar. The template for this reporter must be in the template library of the template specified by the TemplateSrc property of this reporter.

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string

Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the link target ID, or an mlreportgen.dom.LinkTarget (MATLAB Report Generator) object. A character vector or string scalar value converts to a LinkTarget object. The link target immediately precedes the content of this reporter in the output report.

Attributes:

GetAccess
public
SetAccess
public

Methods

expand all

Examples

collapse all

Use the ComponentFinder, ComponentResult, FunctionFinder, and FunctionResult classes to generate a report that finds all components and their functions in a given software architecture model..

import mlreportgen.report.*
import slreportgen.report.*
import systemcomposer.query.*
import systemcomposer.rptgen.finder.*

Open the ACCSoftwareComposition model.

model_name = "ACCSoftwareComposition";
mdl = systemcomposer.loadModel(model_name);

Create a report and append a title page and table of contents.

functionsReport = slreportgen.report.Report(OutputPath=model_name + "_FunctionsReport", ...
    CompileModelBeforeReporting=false);
append(functionsReport,TitlePage(Title="Components and their Functions in " + model_name));
append(functionsReport,TableOfContents);

Create a chapter to contain all sections related to components and their functions.

compChapter = Chapter("Components and their Functions");

Find all components in the architecture model.

componentFinder = ComponentFinder(model_name);
componentFinder.Query = AnyComponent;

Create a section for each component.

while hasNext(componentFinder)
    comp = next(componentFinder);
    compSection = Section(Title=comp.Name);
    compReporter = getReporter(comp);
    compReporter.IncludeSnapshot = 1;
    compReporter.IncludeProperties = 0;
    compReporter.IncludeFunctions = 0;
    append(compSection,compReporter);

Find all functions associated with the component.

    functionFinder = FunctionFinder(model_name);
    functionFinder.ComponentName = comp.Name;
    functionResult = find(functionFinder);
    append(compSection,functionResult);

    append(compChapter,compSection);
end

Append the chapter to the report and view the generated report.

append(functionsReport,compChapter);
close(functionsReport);
rptview(functionsReport);

Version History

Introduced in R2022b