Main Content

coder.descriptor.FunctionInterface Class

Namespace: coder.descriptor

Return information about entry-point functions

Description

The function interfaces are the entry-point functions in the generated code. The coder.descriptor.FunctionInterface object describes various properties for a specified function interface. The different types of function interfaces are:

  • Allocation: Contains memory allocation code based on the target of the model. See model_initialize.

  • Initialize: Contains initialization code for the model and is called once at the start of your application code. See model_initialize.

  • Output: Contains the output code for the blocks in the model. See model_step.

  • Update: Contains the update code for the blocks in the model. See model_step.

  • Terminate: Contains the termination code for the model and is called as part of a system shutdown. See model_terminate.

Creation

functionInterface = getFunctionInterfaces(codeDescObj, functionInterfaceName) creates a coder.descriptor.FunctionInterface object. codeDescObj is the coder.codedescriptor.CodeDescriptor object created for the model by using the getCodeDescriptor function.

Input Arguments

expand all

Name of the specified function interface.

Example: 'Output'

Data Types: string

Properties

expand all

Description of the function prototype, including the function return value, name, arguments, header, and source file, specified as a coder.descriptor.Prototype object.

Attributes:

GetAccess
public
SetAccess
public

Return arguments from the function, specified as a coder.descriptor.DataInterface object. When the function returns no data, this field is empty.

Attributes:

GetAccess
public
SetAccess
public

Variant conditions in the model that interact with the function interface, specified as a coder.descriptor.VariantInfo object.

Attributes:

GetAccess
public
SetAccess
public

Function owner of the class that the function belongs to, specified as a coder.descriptor.TypedRegion object. For C code generation, this property is empty.

Attributes:

GetAccess
public
SetAccess
public

Function access rate in the target environment, specified as a coder.descriptor.TimingInterface object.

Attributes:

GetAccess
public
SetAccess
public

Input arguments to the function, specified as a coder.descriptor.DataInterfaceList object. When there is no data passed as an argument to the function, this property is empty.

Attributes:

GetAccess
public

Examples

collapse all

  1. Open the model.

    openExample(‘CustomCodeComments’)
  2. Build the model.

    slbuild('CustomCodeComments')

  3. Create a coder.codedescriptor.CodeDescriptor object for the required model.

    codeDescObj = coder.getCodeDescriptor('rtwdemo_comments')
    

  4. Return a list of all function interface types in the generated code.

    functionInterfaceTypes = getFunctionInterfaceTypes(codeDescObj)
        {'Initialize'}
        {'Output'    }
  5. Return properties of a specified function interface in the generated code.

    functionInterface = getFunctionInterfaces(codeDescObj, 'Output')
            Prototype: [1×1 coder.descriptor.types.Prototype]
         ActualReturn: [0×0 coder.descriptor.DataInterface]
          VariantInfo: [0×0 coder.descriptor.VariantInfo]
               Timing: [1×1 coder.descriptor.TimingInterface]
           ActualArgs: [1x0 coder.descriptor.DataInterface List]

Version History

Introduced in R2018a