Documentation

Code interface packaging

Description

Select the packaging for the generated C or C++ code interface.

Category:Code Generation > Interface

环境s

Default:不nreusable functionifLanguage被设定为C;C++ classifLanguage被设定为C++

C++ class

Generate a C++ class interface to model code. The generated interface encapsulates required model data into C++ class attributes and model entry point functions into C++ class methods.

不nreusable function

Generate nonreusable code. Model data structures are statically allocated and accessed by model entry point functions directly in the model code.

Reusable function

生成可重复使用的多功能代码,如下:

  • For a GRT-based model, the generatedmodel。Csource file contains an allocation function that dynamically allocates model data for each instance of the model. For an ERT-based model, you can use theUse dynamic memory allocation for model initializationoption to control whether an allocation function is generated.

  • The generated code passes the real-time model data structure in, by reference, as an argument tomodel_step和the other model entry point functions.

  • The real-time model data structure is exported with themodel。Hheader file.

For an ERT-based model, you can use thePass root-level I/O as参数以控制根级输入和输出参数如何传递到可重复使用的模型入口点函数。它们可以包含在传递给函数的实时模型数据结构中,作为单个参数传递,也可以作为对输入结构和输出结构的引用传递。

Tips

  • Entry points are exported withmodel。H。要从手写代码调用入口点函数,请添加#include model.h代码指令。

  • 当您选择时Reusable function, the code generator generates a pointer to the real-time model object (model_m).

  • 当您选择时Reusable function, the code generator can generate code that compiles but is not reentrant. For example, if a signal, DWork structure, or parameter data has a storage class other than汽车, global data structures are generated.

Dependencies

  • The valueC++ classis available only if theLanguage参数设置为C++on theCode Generationpane.

  • SelectingReusable function或者C++ classenables多实体代码错误诊断

  • For an ERT target, selectingReusable functionenablesPass root-level I/O asUse dynamic memory allocation for model initialization

  • For an ERT target, selectingC++ classenables the following controls for customizing the model class interface:

    • Configure C++ Class Interfacebutton

    • Data Member Visibility/Access Controlsubpane

    • Model optionsGenerate destructorUse dynamic memory allocation for model block instantiation

  • For an ERT target, you can useReusable functionwith the staticert_main.cmodule, if you do the following:

    • Select the valuePart of model data structureforPass root-level I/O as

    • Select the optionUse dynamic memory allocation for model initialization

  • For an ERT target, you cannot useReusable functionif you are using:

    • Themodel_step功能原型控制能力

    • The subsystem parameter与单独数据的功能

    • A subsystem that

      • 多个端口共享源代码吗

      • Has a port that is used by multiple instances of the subsystem and has different sample times, data types, complexity, frame status, or dimensions across the instances

      • 输出标记为全局信号

      • For each instance contains identical blocks with different names or parameter settings

  • UsingReusable function不会更改为功能通行子系统生成的代码。

命令行信息

范围:CodeInterfacepackaging
Type:character vector
Value:'C++ class'|“不可修复的功能”|“可重复使用的功能”
Default:“不可修复的功能”ifTargetLang被设定为'C';'C++ class'ifTargetLang被设定为'C++'

Recommended Settings

Application 环境
Debugging 没有影响
Traceability 没有影响
Efficiency Reusable function或者C++ class
Safety precaution 没有影响

See Also

相关话题

Was this topic helpful?