Main Content

addDWorkArg

Add DWork argument for semaphore entry in code replacement table

Description

example

addDWorkArg(hEntry,arg) adds a specified DWork argument to the arguments for a semaphore entry in a code replacement table.

Examples

collapse all

This example shows how to use the addDWorkArg function to add a DWork argument named d1 to the arguments 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 hEntry is a handle to a code replacement table entry previously returned by instantiating a code replacement semaphore table entry class, using hEntry = RTW.TflCSemaphoreEntry.

Example: sem_entry

Argument, such as returned by arg = getTflDWorkFromString(name, datatype), added to the arguments for the code replacement table entry.

Example: 'hLib.getTflDWorkFromString('d1','void*')'

Introduced in R2011b