Main Content

setReturn

Add return argument to RTW.CImplementation object

Since R2024a

    Description

    setReturn(implementation,arg) adds the return argument to the RTW.CImplementation object that represents the implementation function specification implementation.

    example

    Examples

    collapse all

    Specify a void return for an implementation function for the Discrete FIR Filter block.

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

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

    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';
    

    Add an input argument to the implementation object.

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

    Specify a void return for the implementation object.

    arg = hLib.getTflArgFromString('void','void');
    arg.IOType = 'RTW_IO_OUTPUT';
    setReturn(impl,arg); 
    

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

    addImplementation(entry, 'initialize', impl);

    Input Arguments

    collapse all

    Implementation function, specified as an RTW.CImplementation object.

    Implementation function return argument, specified as a handle such as the argument handle returned by the function getTflArgFromString.

    Example: getTflArgFromString('void','void');

    Version History

    Introduced in R2024a