Main Content

systemcomposer.rptgen.finder.DictionaryFinder Class

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

Find dictionaries

Since R2022b

Description

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

Creation

finder = DictionaryFinder(Container) creates a finder that finds all dictionaries in an architecture model specified by the Type property to search for model dictionaries or reference dictionaries.

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 = DictionaryFinder("ArchModel")

Data Types: string

Filter to find data dictionaries, specified as one of these options:

  • "Model" – Find dictionaries in the model.

  • "Dictionary" – Find reference dictionaries.

  • "All" – Find all dictionaries both model and reference dictionaries.

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