Main Content

C++ Data and Function Interfaces

Control the C++ class generated from a Simulink model

To generate efficient C++ code that easily plugs into your existing software architecture, configure a C++ class interface. When you generate a C++ class interface from a model, the model appears as a class, data elements appear as class members, and model functions appear as class methods. Configuring a C++ class interface, interactively or programmatically, allows you to configure:

  • Class information — Class name and namespace

  • Class member information — Class member data visibility and access method

  • Class method information — Class method names and arguments

You can use these customizations to quickly adjust the generated interface from rate-based and export-function models to meet your application integration requirements.

Tools

Code Mappings – C++ EditorConfigure how model elements and functions appear in generated C++ code (Since R2021a)

Objects

coder.mapping.api.CodeMappingCPPModel data and interface configuration for C++ code generation (Since R2021a)

Functions

expand all

coder.mapping.api.getGet code mappings for model (Since R2020b)
coder.mapping.utils.createCreate code mappings object for configuring data and function interface for C and C++ code generation (Since R2020b)
findGet model elements for the category of model code mappings (Since R2021a)
getClassNameGet class name of model (Since R2021a)
setClassNameSet class name of model (Since R2021a)
getClassNamespaceGet class namespace for a model (Since R2021a)
setClassNamespaceSet class namespace of model (Since R2021a)
getDataGet code mapping configuration for model data (Since R2021a)
setDataConfigure model data for C++ code generation (Since R2021a)
getFunctionGet code configuration from code mappings for model function (Since R2021a)
setFunctionSet code mapping information for model function (Since R2021a)

Topics

Featured Examples