Main Content

RTW.CImplementation

Specify an 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

    example

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

    Properties

    expand all

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

    Example: 'ImplementationHeaderFile',''

    Data Types: string

    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 string.

    Example: 'arm_fir_init'

    Data Types: string

    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 an argument to an RTW.CImplementation object
    setReturnAdd a return argument to an 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