Main Content

getTflDWorkFromString

Create code replacement DWork argument for semaphore entry based on specified name and data type

Description

example

arg = getTflDWorkFromString(hTable,name,datatype) creates a code replacement DWork argument, based on a specified name and data type, for a semaphore entry in a code replacement table.

Examples

collapse all

This example shows how to use the getTflDworkFromString to create a void* argument named d1. Then, the example adds the argument as a DWork argument for a semaphore entry in a code replacement table.

hLib = RTW.TflTable;

% specify semaphore init function.  
hEnt = RTW.TflCSemaphoreEntry;
hEnt.setTflCSemaphoreEntryParameters( ... 
  'Key',                      'RTW_SEM_INIT', ... 
  'Priority',                 30, ... 
  'ImplementationName',       'mySemCreate', ... 
  'ImplementationHeaderFile', 'mySem.h', ... 
  'ImplementationSourceFile', 'mySem.c', ... 
  'ImplementationHeaderPath', LibPath, ... 
  'ImplementationSourcePath', LibPath, ... 
  'GenCallback',              'RTW.copyFileToBuildDir', ... 
  'SideEffects',              true); 

% specify conceptual operands and result 
arg = hLib.getTflArgFromString('y1', 'void'); 
arg.IOType = 'RTW_IO_OUTPUT'; 
hEnt.addConceptualArg(arg); 
arg = hLib.getTflArgFromString('u1', 'void'); 
hEnt.addConceptualArg(arg); 

% specify replacement function signature 
arg=hLib.getTflArgFromString('y1','void'); 
hEnt.Implementation.setReturn(arg); 
arg.IOType = 'RTW_IO_OUTPUT'; 

% DWork Arg
arg = hLib.getTflDWorkFromString('d1','void*');
hEnt.addDWorkArg(arg);
addEntry(hLib, hEnt);

Input Arguments

collapse all

The hTable is a handle to a code replacement table previously returned by hTable = RTW.TflTable.

Example: hLib

Example: 'd1'

You must specify 'void*'.

Example: 'void*'

Output Arguments

collapse all

The arg is a handle to the created code replacement argument, which can be specified to the addDWorkArg function.

Introduced in R2013a