主要内容

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

slreportgen.report.CCaller 类

命名空间: slreportgen.report

C Caller 模块报告器

自 R2022a 起

描述

使用 slreportgen.report.CCaller 类的对象来报告 Simulink® 模型中的 C Caller 模块。

默认情况下,CCaller 报告器对象报告:

  • C Caller 模块调用的 C 函数的名称

  • 描述参数和任何自定义封装参数

  • 与 C Caller 模块相关的端口属性

  • C Caller 模块调用的 C 代码

使用 CCaller 报告器属性来排除或修改报告的信息。

注意

要在报告中使用 CCaller 报告器,您必须使用 slreportgen.report.Report 类创建报告。

slreportgen.report.CCaller 类是 handle 类。

类属性

HandleCompatible
true

有关类属性的信息,请参阅类属性

创建对象

描述

cCallerReporter = slreportgen.report.CCaller 创建一个具有默认属性值的空的 C Caller 模块报告器。使用对象属性来指定报告选项。

注意

向报告中添加空的 CCaller 对象会导致错误。

cCallerReporter = slreportgen.report.CCaller(Object) 为给定的 C Caller 模块对象创建一个报告器,并将 Object 属性设置为 Object

将此报告器包含到您的报告中,以添加有关 C Caller 模块名称、可用函数和端口规范的信息。更新对象的属性以更改报告器的显示选项。

示例

cCallerReporter = slreportgen.report.CCaller(Name=Value) 使用名称-值参量设置属性。以任意顺序指定多个名称-值参量。

属性

全部展开

C Caller 模块报告,指定为字符向量或字符串标量,其中包含 C Caller 模块的名称、C Caller 模块句柄或 slreportgen.report.BlockResult 对象。

属性:

GetAccess
公共
SetAccess
公共

在报告中包含模块属性表,指定为 truefalse。该表显示除函数名称、可用函数和端口规范之外的所有模块对话框参数。如果所有其他对话框参数都为空,则不会显示该表。

要格式化此表及其所包含的属性,请编辑 ObjectPropertiesReporter 属性。

属性:

GetAccess
公共
SetAccess
公共

报告中包含其他可用函数的列表,指定为 truefalse。此列表显示 C Caller 模块可以调用的函数。

属性:

GetAccess
公共
SetAccess
公共

在报告中包含 C Caller 模块的 C 代码,指定为 truefalse

属性:

GetAccess
公共
SetAccess
公共

模块属性表的属性,指定为 slreportgen.report.SimulinkObjectProperties 对象。其默认值是一个空的 slreportgen.report.SimulinkObjectProperties 对象。指定要在 Properties 对象的 SimulinkObjectProperties 属性中显示的属性。如果 Properties 为空,报告器会自动确定要显示哪些属性。

属性:

GetAccess
公共
SetAccess
公共

将 C Caller 模块的端口属性格式化为报告,指定为 mlreportgen.report.BaseTable 对象。该属性的默认值是一个空的 mlreportgen.report.BaseTable 对象,其中 StyleName 属性设置为 "CCallerPortSpecificationTable"。通过修改默认 BaseTable 对象的属性来自定义表的外观。

属性:

GetAccess
公共
SetAccess
公共

函数名称标题的段落格式,指定为 mlreportgen.dom.Paragraph 对象。默认值是一个空的 mlreportgen.dom.Paragraph 对象,其中 StyleName 设置为 "CCallerFunctionNameTitle"

通过修改默认对象的属性或将其替换为另一个 Paragraph 对象来自定义标题的外观。

属性:

GetAccess
公共
SetAccess
公共

函数名称的段落格式,指定为 mlreportgen.dom.Paragraph 对象。默认值是一个空的 mlreportgen.dom.Paragraph 对象,其中 StyleName 设置为 "CCallerFunctionName"

通过修改默认对象的属性或将其替换为另一个 Paragraph 对象来自定义函数名称的外观。

属性:

GetAccess
公共
SetAccess
公共

可用函数列表标题的段落格式,指定为 mlreportgen.dom.Paragraph 对象。默认值是一个空的 mlreportgen.dom.Paragraph 对象,其中 StyleName 设置为 "CCallerAvailableFunctionsTitle"

通过修改默认对象的属性或将其替换为另一个 Paragraph 对象来自定义标题的外观。

属性:

GetAccess
公共
SetAccess
公共

可用函数列表,指定为 mlreportgen.dom.UnorderedListmlreportgen.dom.OrderedList 对象。

默认值是 mlreportgen.dom.UnorderedList 对象。通过修改默认对象的属性或将其替换为不包含任何子项的另一个对象来自定义列表的外观。

属性:

GetAccess
公共
SetAccess
公共

C Caller 模块的 C 代码标题的段落格式,指定为 mlreportgen.dom.Paragraph 对象。默认值是一个空的 mlreportgen.dom.Paragraph 对象,其属性 StyleName 设置为 "CCallerCodeTitle"

通过修改默认对象的属性或将其替换为另一个 Paragraph 对象来自定义标题的外观。此属性中添加到 Paragraph 对象的任何内容都会出现在报告中的代码标题之前。

属性:

GetAccess
公共
SetAccess
公共

格式化报告器中包含的 C 代码,指定为 mlreportgen.dom.Preformatted 对象。

该属性的默认值是一个空的 mlreportgen.dom.Preformatted 对象,其 StyleName 属性设置为 CCallerCode。通过修改默认对象的属性来自定义代码的外观。

属性:

GetAccess
公共
SetAccess
公共

此报告器的模板来源,以下列方式之一指定:

  • 字符向量或字符串标量,指定包含此报告器模板的文件的路径

  • 此报告器使用的模板或其模板库中包含此报告器模板的报告器或报告

  • 文档对象模型 (DOM) 文档或文档部分,该报告器使用其模板或其模板库包含该报告器的模板

指定的模板必须与您附加此报告器的报告类型相同。例如,对于 Microsoft® Word 报告,TemplateSrc 必须是 Word 报告模板。如果 TemplateSrc 属性为空,则此报告器将使用默认报告器模板作为报告的输出类型。

属性:

GetAccess
公共
SetAccess
公共
NonCopyable
true

此报告器的模板名称,指定为字符向量或字符串标量。此报告器的模板必须位于此报告器 TemplateSrc 属性所指定模板的模板库中。

属性:

GetAccess
公共
SetAccess
公共

数据类型: char | string

此报告器的超链接目标,指定为指定链接目标 ID 的字符向量或字符串标量,或 mlreportgen.dom.LinkTarget 对象。字符向量或字符串标量值转换为 LinkTarget 对象。链接目标紧接在输出报告中此报告器的内容之前。

属性:

GetAccess
公共
SetAccess
公共

方法

全部展开

示例

全部折叠

此示例显示如何将有关 Simulink® 模型中的 C Caller 模块的信息添加到报告中。

创建 PDF 报告并加载所需模型。

import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*

rpt = slreportgen.report.Report("CCallerReport","pdf");
rpt.CompileModelBeforeReporting = false;
model_name = 'ExampleModelSLR';
load_system(model_name);

% Create a chapter for the C Caller block information
add(rpt,TitlePage(Title=sprintf('C Caller Blocks in %s', model_name),Author=""));
add(rpt, TableOfContents);

创建一个 SystemDiagramFinder 对象来返回模型中每个 C Caller 模块的图。

diagFinder = SystemDiagramFinder(model_name);

遍历查找器对象的结果并找到相关的 C Caller 模块。

while hasNext(diagFinder)
    diagram = next(diagFinder);
    chapter = Chapter(Title=diagram.Name);
    add(chapter, diagram);

    finder = BlockFinder(diagram.Object);
    finder.BlockTypes = "CCaller";
    results = find(finder);
    
    for result = results 
        rptr = CCaller(result);     
        rptr.IncludeAvailableFunctions = true;
        add(chapter,rptr);
    end
    add(rpt, chapter);
end
close(rpt);
close_system(model_name);
rptview(rpt);

版本历史记录

在 R2022a 中推出