Main Content

setNameSpace

Set namespace for C++ function entry in code replacement table

Description

example

setNameSpace(hEntry,nameSpace) specifies the namespace for a C++ function entry in a code replacement table.

During code generation, if the function entry is matched, the software emits the namespace in the generated function code (for example, std::sin(tfl_cpp_U.In1)).

If you created the function entry by using hEntry = RTW.TflCFunctionEntry or hEntry = MyCustomFunctionEntry (did not use registerCPPFunctionEntry), before calling the setNameSpace function, enable C++ support for the function entry by calling the enableCPP function.

Examples

collapse all

This example shows how to use the setNameSpace function to set the namespace for the sin implementation function to std.

fcn_entry = RTW.TflCFunctionEntry;
fcn_entry.setTflCFunctionEntryParameters( ...
                               'Key',                      'sin', ...
                               'Priority',                 100, ...
                               'ImplementationName',       'sin', ...
                               'ImplementationHeaderFile', 'cmath' );
fcn_entry.enableCPP();
fcn_entry.setNameSpace('std');

Input Arguments

collapse all

The hEntry is a handle to a code replacement function entry previously returned by one of the following:

  • hEntry = RTW.TflCFunctionEntry

  • hEntry = MyCustomFunctionEntry, where MyCustomFunctionEntry is a class derived from RTW.TflCFunctionEntry

  • A call to the registerCPPFunctionEntry function

Example: fcn_entry

Example: 'std'

Introduced in R2010a