Main Content

addDWorkArg

Add DWork argument for entry in code replacement table

Description

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

example

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, by using hEntry = RTW.TflCSemaphoreEntry, or a block replacement entry class, by using hEntry = RTW.TflBlockEntry.

Example: sem_entry

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

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

Example: 'createDWorkArg(blockEntry,'Pointer','Name','crlDWorkArg)'

Version History

Introduced in R2011b