Main Content

systemcomposer.rptgen.finder.InterfaceFinder Class

Namespace: systemcomposer.rptgen.finder
Superclasses: mlreportgen.finder.Finder (MATLAB Report Generator)

Find interfaces

Since R2022b

Description

The systemcomposer.rptgen.finder.InterfaceFinder class searches for information about all the interfaces in a given System Composer™ architecture model.

Creation

finder = InterfaceFinder(Container) creates a finder that finds all interfaces in a given model that meet the specifications of the Filter property.

Note

This finder provides these options to get search results:

  • To return the search results as an array, use the find method. Add the results directly to a report or process the results in a for-loop.

  • To iterate through the results one at a time, use the hasNext and next methods in a while-loop.

Neither option has a performance advantage.

Properties

expand all

Architecture model filename without the .slx extension, specified as a string.

Example: f = InterfaceFinder("ArchModel")

Data Types: string

Where to find interfaces, specified as "Model" to find interfaces in the model or "Component" to find all interfaces on the ports of a given component.

Attributes:

GetAccess
public
SetAccess
public

Data Types: string

Filter to find interfaces, specified as "All" to find all interfaces associated with the model, "InterfaceName" to find a specific interface, or "ComponentName" to find all interfaces on the ports of a given component.

Attributes:

GetAccess
public
SetAccess
public

Data Types: string

Properties of objects to find, specified as a cell array of name-value arguments. The finder returns only objects that have the specified properties with the specified values.

Example: f.Properties = {'Gain','5'}

Data Types: char

Methods

expand all

Examples

collapse all

Use the DictionaryFinder, DictionaryResult, InterfaceFinder, and InterfaceResult classes to create a report that finds all dictionaries and interfaces in a given architecture model.

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

Open the scKeylessEntrySystem project.

prj = openProject("scKeylessEntrySystem");
model_name = "KeylessEntryArchitecture";
mdl = systemcomposer.loadModel(model_name);

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

dataReport = slreportgen.report.Report(OutputPath=model_name + "_ArchitectureDataReport", ...
    CompileModelBeforeReporting=false);
append(dataReport,TitlePage(Title="Architectural Data in " + model_name));
append(dataReport,TableOfContents);

Create a chapter to contain all sections related to dictionaries.

dictionaryChapter = Chapter(Title="Dictionaries");

Find all dictionaries linked to the architecture model.

dictionaryFinder = DictionaryFinder(model_name);

while hasNext(dictionaryFinder)
    dictionary = next(dictionaryFinder);
    dictionarySection = Section(Title="Dictionary: " + dictionary.Name);
    append(dictionarySection, dictionary);    

Find all interfaces in the dictionary.

    interfaces = dictionary.Interfaces;
    for i=1:length(interfaces)
        interfaceFinder = InterfaceFinder(model_name);
        interfaceFinder.Filter = interfaces(i);
        interface = find(interfaceFinder);

Create a section for each interface in the dictionary.

        interfaceSection = Section(Title="Interface: " + interface.InterfaceName);
        append(interfaceSection, interface);
        append(dictionarySection, interfaceSection);
    end

    append(dictionaryChapter,dictionarySection);
end

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

append(dataReport,dictionaryChapter);
close(dataReport);
rptview(dataReport);

Version History

Introduced in R2022b