Vuo
1.2.6
|
A trigger output port.
Public Member Functions | |
VuoCompilerTriggerPort (VuoPort *basePort) | |
Creates a trigger port based on portClass . | |
Value * | generateCreatePortContext (Module *module, BasicBlock *block) |
Generates code to create a heap-allocated PortContext, with the triggerQueue and triggerSemaphore initialized. | |
Function * | generateSynchronousSubmissionToDispatchQueue (Module *module, BasicBlock *block, Value *nodeContextValue, string workerFunctionName, Value *workerFunctionArg=NULL) |
Generates code to submit a task to this trigger's dispatch queue. | |
Function * | getWorkerFunction (Module *module, string functionName, bool isExternal=false) |
Returns a function of type dispatch_function_t . | |
void | generateSignalForSemaphore (Module *module, BasicBlock *block, Value *nodeContextValue) |
Generates code to signal the trigger's semaphore. | |
Value * | generateLoadFunction (Module *module, BasicBlock *block, Value *nodeContextValue) |
Generates code to get the function pointer for the trigger scheduler function. | |
void | generateStoreFunction (Module *module, BasicBlock *block, Value *nodeContextValue, Value *functionValue) |
Generates code to set the function pointer for the trigger scheduler function. | |
Value * | generateLoadPreviousData (Module *module, BasicBlock *block, Value *nodeContextValue) |
Generates code to get the data most recently fired from the trigger. | |
void | generateFreeContext (Module *module, BasicBlock *block, Function *workerFunction) |
Generates code to deallocate the context and its contents created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction. | |
Value * | generateCompositionStateValue (Module *module, BasicBlock *block, Function *workerFunction) |
Generates code to get the composition state from the context created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction. | |
Value * | generateDataValue (Module *module, BasicBlock *block, Function *workerFunction) |
Generates code to get the trigger data value from the context created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction. | |
Value * | generateEventIdValue (Module *module, BasicBlock *block, Function *workerFunction) |
Generates code to get the event ID from the context created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction. | |
Value * | generateDataValueUpdate (Module *module, BasicBlock *block, Function *workerFunction, Value *nodeContextValue) |
Generates code to update the trigger's data value (if any) with the worker function argument. | |
void | generateDataValueDiscardFromWorker (Module *module, BasicBlock *block, Function *workerFunction) |
Generates code to discard the data value in the worker function argument without updating the trigger's data value. | |
Type * | getDataType (void) |
Returns the type of data associated with the trigger, or NULL if the trigger is event-only. | |
VuoCompilerTriggerPortClass * | getClass (void) |
Returns the trigger port class of this trigger port. | |
Public Member Functions inherited from VuoCompilerPort | |
bool | hasConnectedCable (void) const |
Returns a boolean indicating whether this port has any attached cables. | |
bool | hasConnectedDataCable (void) const |
Returns a boolean indicating whether this port has any attached data+event cables. | |
VuoType * | getDataVuoType (void) |
Returns this port's data type, or null if this port is event-only. | |
void | setDataVuoType (VuoType *dataType) |
Sets the data type for this port, overriding the type from the port class. | |
void | setNodeIdentifier (string nodeIdentifier) |
Sets an identifier that will be part of the string returned by getIdentifier(). | |
virtual string | getIdentifier (void) |
Returns a unique, consistent identifier for this port. | |
void | setIndexInPortContexts (int indexInPortContexts) |
Sets the index of this node within the array of port contexts within the node context. | |
int | getIndexInPortContexts (void) |
Returns the index of this node within the array of port contexts within the node context. | |
void | setConstantStringCache (VuoCompilerConstantStringCache *constantStrings) |
Sets the cache used to generate constant string values. | |
Value * | getDataVariable (Module *module, BasicBlock *block, Value *nodeContextValue) |
Returns the address of the data field within this port's context. | |
Value * | generateGetPortContext (Module *module, BasicBlock *block, Value *nodeContextValue) |
Returns this port's context. | |
Public Member Functions inherited from VuoCompilerNodeArgument | |
virtual | ~VuoCompilerNodeArgument (void) |
Destructor. | |
Public Member Functions inherited from VuoBaseDetail< VuoPort > | |
VuoBaseDetail (string description, VuoPort *base) | |
Creates a VuoNode detail class. | |
VuoPort * | getBase (void) const |
Returns the VuoNode detail class instance's base class instance. | |
void | setBase (VuoPort *base) |
Sets the VuoNode detail class instance's base class instance. | |
Static Public Member Functions | |
static void | generateScheduleWorker (Module *module, Function *function, BasicBlock *block, Value *compositionStateValue, Value *eventIdValue, Value *portContextValue, VuoType *dataType, int minThreadsNeeded, int maxThreadsNeeded, int chainCount, Function *workerFunction) |
Generates code that schedules the worker function for this trigger to execute on the trigger's dispatch queue. | |
static Value * | generateNonBlockingWaitForSemaphore (Module *module, BasicBlock *block, Value *portContextValue) |
Generates code to try to claim the trigger's semaphore. | |
static void | generateDataValueDiscardFromScheduler (Module *module, Function *function, BasicBlock *block, VuoType *dataType) |
Generates code to discard the scheduler function argument without updating the trigger's data value. | |
Additional Inherited Members | |
Protected Member Functions inherited from VuoCompilerPort | |
VuoCompilerPort (VuoPort *basePort) | |
Creates a compiler detail from a given basePort . | |
Protected Attributes inherited from VuoCompilerPort | |
VuoCompilerConstantStringCache * | constantStrings |
Cache used to generate constant string values. | |
VuoCompilerTriggerPort::VuoCompilerTriggerPort | ( | VuoPort * | basePort | ) |
Creates a trigger port based on portClass
.
Value * VuoCompilerTriggerPort::generateCompositionStateValue | ( | Module * | module, |
BasicBlock * | block, | ||
Function * | workerFunction | ||
) |
Generates code to get the composition state from the context created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction.
|
virtual |
Generates code to create a heap-allocated PortContext, with the triggerQueue
and triggerSemaphore
initialized.
PortContext *
. Implements VuoCompilerPort.
Value * VuoCompilerTriggerPort::generateDataValue | ( | Module * | module, |
BasicBlock * | block, | ||
Function * | workerFunction | ||
) |
Generates code to get the trigger data value from the context created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction.
|
static |
Generates code to discard the scheduler function argument without updating the trigger's data value.
void VuoCompilerTriggerPort::generateDataValueDiscardFromWorker | ( | Module * | module, |
BasicBlock * | block, | ||
Function * | workerFunction | ||
) |
Generates code to discard the data value in the worker function argument without updating the trigger's data value.
Value * VuoCompilerTriggerPort::generateDataValueUpdate | ( | Module * | module, |
BasicBlock * | block, | ||
Function * | workerFunction, | ||
Value * | nodeContextValue | ||
) |
Generates code to update the trigger's data value (if any) with the worker function argument.
Value * VuoCompilerTriggerPort::generateEventIdValue | ( | Module * | module, |
BasicBlock * | block, | ||
Function * | workerFunction | ||
) |
Generates code to get the event ID from the context created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction.
void VuoCompilerTriggerPort::generateFreeContext | ( | Module * | module, |
BasicBlock * | block, | ||
Function * | workerFunction | ||
) |
Generates code to deallocate the context and its contents created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction.
Value * VuoCompilerTriggerPort::generateLoadFunction | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | nodeContextValue | ||
) |
Generates code to get the function pointer for the trigger scheduler function.
Value * VuoCompilerTriggerPort::generateLoadPreviousData | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | nodeContextValue | ||
) |
Generates code to get the data most recently fired from the trigger.
|
static |
Generates code to try to claim the trigger's semaphore.
Returns the value returned by dispatch_semaphore_wait
, which can be checked to determine if the semaphore was claimed.
|
static |
Generates code that schedules the worker function for this trigger to execute on the trigger's dispatch queue.
The caller is responsible for filling in the body of workerFunction.
If this trigger carries data, the argument to function is stored in a context value that is passed to workerFunction.
void VuoCompilerTriggerPort::generateSignalForSemaphore | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | nodeContextValue | ||
) |
Generates code to signal the trigger's semaphore.
void VuoCompilerTriggerPort::generateStoreFunction | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | nodeContextValue, | ||
Value * | functionValue | ||
) |
Generates code to set the function pointer for the trigger scheduler function.
Function * VuoCompilerTriggerPort::generateSynchronousSubmissionToDispatchQueue | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | nodeContextValue, | ||
string | workerFunctionName, | ||
Value * | workerFunctionArg = NULL |
||
) |
Generates code to submit a task to this trigger's dispatch queue.
Returns the worker function, which will be called by the dispatch queue to execute the task. The caller is responsible for filling in the body of the worker function.
VuoCompilerTriggerPortClass * VuoCompilerTriggerPort::getClass | ( | void | ) |
Returns the trigger port class of this trigger port.
Type * VuoCompilerTriggerPort::getDataType | ( | void | ) |
Returns the type of data associated with the trigger, or NULL if the trigger is event-only.
Function * VuoCompilerTriggerPort::getWorkerFunction | ( | Module * | module, |
string | functionName, | ||
bool | isExternal = false |
||
) |
Returns a function of type dispatch_function_t
.