Main Content

RTW.CImplementation

Specify implementation function for a block replacement entry

Since R2024a

    Description

    Use RTW.CImplementation objects to specify implementation functions for a block replacement entry. You can specify implementation functions for the initialize, update, output, and terminate functions.

    Creation

    Description

    implementation = RTW.CImplementation creates an RTW.CImplementation object.

    example

    Properties

    expand all

    Name of the header file that declares the implementation function, specified as a character vector or string scalar.

    Example: 'ImplementationHeaderFile',''

    Full path to the implementation header file, specified as a character vector or string scalar.

    Example: 'ImplementationHeaderPath',''

    Name of the implementation function, specified as a character vector or string scalar.

    Example: 'arm_fir_init'

    Name of the implementation source file, specified as a character vector or string scalar.

    Example: 'ImplementationSourceFile',''

    Full path to the implementation source file, specified as a character vector or string scalar.

    Example: 'ImplementationSourcePath',''

    Object Functions

    addArgumentAdd argument to RTW.CImplementation object
    setReturnAdd return argument to RTW.CImplementation object

    Examples

    collapse all

    Specify an implementation function to replace the initialize function of a Discrete FIR Filter block.

    Create a block replacement entry for the Discrete FIR Filter block.

    hLib = RTW.TflTable;
    
    entry = RTW.TflBlockEntry;
    entry.Key = 'DiscreteFir';
    entry.Priority = 1;
    

    Create the RTW.CImplementation object that represents the implementation function. Specify the name and header file for the function.

    impl = RTW.CImplementation;
    impl.Name = 'arm_fir_init';
    impl.HeaderFile = 'arm_math.h';
    

    Specify the arguments that implementation function takes.

    arg = getTflArgFromString(hLib, 'u1', 'uint16');
    addArgument(impl, arg);

    Add the implementation function to the block replacement entry as the replacement initialization function.

    addImplementation(entry, 'initialize', impl);

    Version History

    Introduced in R2024a