主要内容

本页采用了机器翻译。点击此处可查看最新英文版本。

systemcomposer.rptgen.finder.DictionaryResult 类

命名空间: systemcomposer.rptgen.finder
超类: mlreportgen.finder.Result (MATLAB Report Generator)

字典的搜索结果

自 R2022b 起

描述

在 System Composer™ 架构模型中搜索字典信息的结果对象。

systemcomposer.rptgen.finder.DictionaryResult 类是 handle 类。

创建对象

result = DictionaryResult 为您通过 systemcomposer.rptgen.finder.DictionaryFinder 对象查找到的字典创建搜索结果对象。

注意

systemcomposer.rptgen.finder.DictionaryFinder 类的 find 方法会为找到的每个字典创建一个搜索结果对象。您不需要自己创建该对象。

属性

全部展开

结果元素的通用唯一标识符 (UUID),以字符串形式返回。

数据类型: string

字典名称,以字符串形式返回。

数据类型: string

字典类型,模型字典返回 "Model",引用字典返回 "Dictionary"

数据类型: string

字典中的接口,以字符串数组形式返回。

数据类型: string

与结果相关联的标记,指定为字符串。您可以使用此属性为结果附加额外信息。您可以将此属性设置为任何符合您需求的值。

数据类型: string

示例

全部折叠

使用 DictionaryFinderDictionaryResultInterfaceFinderInterfaceResult 类创建报告,查找给定架构模型中的所有字典和接口。

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

打开 scKeylessEntrySystem 工程。

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

创建一个报告,并追加标题页和目录。

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

创建一个章节,包含与字典有关的所有部分。

dictionaryChapter = Chapter(Title="Dictionaries");

查找与架构模型相关联的所有字典。

dictionaryFinder = DictionaryFinder(model_name);

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

在字典中查找所有接口。

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

为字典中的每个接口创建一个章节。

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

    append(dictionaryChapter,dictionarySection);
end

将章节附加到报告中,并查看生成的报告。

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

版本历史记录

在 R2022b 中推出