Vuo  2.3.2
Classes | Functions
VuoRuntimeContext.hh File Reference

Description

VuoRuntimeContext interface.

Definition in file VuoRuntimeContext.hh.

Go to the source code of this file.

Classes

struct  PortContext
 Runtime information about a port. More...
 
struct  NodeContext
 Runtime information about a node. More...
 

Functions

struct PortContextvuoCreatePortContext (void *data, bool isTrigger, const char *triggerQueueName)
 Creates a port context, initializing its fields to default values. More...
 
struct NodeContextvuoCreateNodeContext (bool hasInstanceData, bool isComposition, size_t outputEventCount)
 Creates a node context, initializing its fields to default values. More...
 
void vuoFreePortContext (struct PortContext *portContext)
 Frees the port context and its fields. More...
 
void vuoFreeNodeContext (struct NodeContext *nodeContext)
 Frees the port context and its fields. More...
 
void vuoSetPortContextEvent (struct PortContext *portContext, bool event)
 Sets the port context's event field. More...
 
void vuoSetPortContextData (struct PortContext *portContext, void *data)
 Sets the port context's data field. More...
 
void vuoSetPortContextTriggerFunction (struct PortContext *portContext, void *triggerFunction)
 Sets the port context's triggerFunction field. More...
 
bool vuoGetPortContextEvent (struct PortContext *portContext)
 Gets the port context's event field. More...
 
void * vuoGetPortContextData (struct PortContext *portContext)
 Gets the port context's data field. More...
 
dispatch_queue_t vuoGetPortContextTriggerQueue (struct PortContext *portContext)
 Gets the port context's triggerQueue field. More...
 
dispatch_semaphore_t vuoGetPortContextTriggerSemaphore (struct PortContext *portContext)
 Gets the port context's triggerSemaphore field. More...
 
void * vuoGetPortContextTriggerFunction (struct PortContext *portContext)
 Gets the port context's triggerFunction field. More...
 
void vuoRetainPortContextData (struct PortContext *portContext)
 Prevents the port context's data field from being freed by vuoFreePortContext(). More...
 
void vuoSetNodeContextPortContexts (struct NodeContext *nodeContext, struct PortContext **portContexts, unsigned long portContextCount)
 Sets the node context's portContexts and portContextCount fields. More...
 
void vuoSetNodeContextInstanceData (struct NodeContext *nodeContext, void *instanceData)
 Sets the node context's instanceData field, freeing the previous value. More...
 
void vuoSetNodeContextClaimingEventId (struct NodeContext *nodeContext, unsigned long claimingEventId)
 Sets the node context's claimingEventId field. More...
 
void vuoSetNodeContextOutputEvent (struct NodeContext *nodeContext, size_t index, bool event)
 Sets the array element at the given index of the node context's outputEvents field. More...
 
struct PortContextvuoGetNodeContextPortContext (struct NodeContext *nodeContext, size_t index)
 Gets the array element at the given index of the node context's portContexts field. More...
 
void * vuoGetNodeContextInstanceData (struct NodeContext *nodeContext)
 Gets the node context's instanceData field. More...
 
unsigned long vuoGetNodeContextClaimingEventId (struct NodeContext *nodeContext)
 Gets the node context's claimingEventId field. More...
 
dispatch_group_t vuoGetNodeContextExecutingGroup (struct NodeContext *nodeContext)
 Gets the node context's executingGroup field. More...
 
bool vuoGetNodeContextOutputEvent (struct NodeContext *nodeContext, size_t index)
 Gets the array element at the given index of the node context's outputEvents field. More...
 
void vuoResetNodeContextEvents (struct NodeContext *nodeContext)
 Sets the event field to false for all of the port contexts in this node context. More...
 
void vuoStartedExecutingEvent (struct NodeContext *nodeContext, unsigned long eventId)
 Sets the node context's executingEventIds field to a list containing the given value, clearing out any old values. More...
 
void vuoSpunOffExecutingEvent (struct NodeContext *nodeContext, unsigned long eventId)
 Adds the given value to the list in the node context's executingEventIds field. More...
 
bool vuoFinishedExecutingEvent (struct NodeContext *nodeContext, unsigned long eventId)
 Removes the given value from the list in the node context's executingEventIds field if present. More...
 
unsigned long vuoGetOneExecutingEvent (struct NodeContext *nodeContext)
 Returns the first list item in the node context's executingEventIds field. More...
 

Class Documentation

◆ PortContext

struct PortContext
Class Members
void * data A pointer to the port's data, or null if this port is event-only.
bool dataRetained A rudimentary retain system for data. If retained, data won't be freed when the port context is.
bool event Whether this port has just received an event.
void * triggerFunction A function pointer for the trigger scheduler function, or null if this is not a trigger port.
dispatch_queue_t triggerQueue A queue for synchronizing fired events, or null if this is not a trigger port.
dispatch_semaphore_t triggerSemaphore A semaphore for checking if events should be dropped, or null if this is not a trigger port.

◆ NodeContext

struct NodeContext
Class Members
unsigned long claimingEventId The ID of the event that currently has exclusive claim on the node.
void * executingEventIds A vector<unsigned long> containing the ID of the event that most recently came in through the composition's published inputs and any events spun off from it.
void * executingEventIdsSync A std::mutex that synchronizes access to executingEventIds.
dispatch_group_t executingGroup A dispatch group used by the subcomposition's event function to wait for nodes to finish executing.
void * instanceData A pointer to the node's instance data, or null if this node is stateless.
void * nodeConditionVariable A std::condition_variable that notifies threads waiting on nodeMutex.
void * nodeMutex A std::mutex that synchronizes access to claimingEventId.
bool * outputEvents An array used by the subcomposition's event function to track events to published output ports, or null if this is not a subcomposition.
unsigned long portContextCount The number of elements in portContexts.
struct PortContext ** portContexts An array of contexts for input and output ports, or null if this node is a subcomposition.

Function Documentation

◆ vuoCreateNodeContext()

struct NodeContext* vuoCreateNodeContext ( bool  hasInstanceData,
bool  isComposition,
size_t  outputEventCount 
)

Creates a node context, initializing its fields to default values.

Definition at line 43 of file VuoRuntimeContext.cc.

◆ vuoCreatePortContext()

struct PortContext* vuoCreatePortContext ( void *  data,
bool  isTrigger,
const char *  triggerQueueName 
)

Creates a port context, initializing its fields to default values.

Definition at line 18 of file VuoRuntimeContext.cc.

◆ vuoFinishedExecutingEvent()

bool vuoFinishedExecutingEvent ( struct NodeContext nodeContext,
unsigned long  eventId 
)

Removes the given value from the list in the node context's executingEventIds field if present.

Returns true if it was present and was the last item in the list.

Definition at line 296 of file VuoRuntimeContext.cc.

◆ vuoFreeNodeContext()

void vuoFreeNodeContext ( struct NodeContext nodeContext)

Frees the port context and its fields.

Definition at line 96 of file VuoRuntimeContext.cc.

◆ vuoFreePortContext()

void vuoFreePortContext ( struct PortContext portContext)

Frees the port context and its fields.

Definition at line 82 of file VuoRuntimeContext.cc.

◆ vuoGetNodeContextClaimingEventId()

unsigned long vuoGetNodeContextClaimingEventId ( struct NodeContext nodeContext)

Gets the node context's claimingEventId field.

Definition at line 238 of file VuoRuntimeContext.cc.

◆ vuoGetNodeContextExecutingGroup()

dispatch_group_t vuoGetNodeContextExecutingGroup ( struct NodeContext nodeContext)

Gets the node context's executingGroup field.

Definition at line 246 of file VuoRuntimeContext.cc.

◆ vuoGetNodeContextInstanceData()

void* vuoGetNodeContextInstanceData ( struct NodeContext nodeContext)

Gets the node context's instanceData field.

Definition at line 230 of file VuoRuntimeContext.cc.

◆ vuoGetNodeContextOutputEvent()

bool vuoGetNodeContextOutputEvent ( struct NodeContext nodeContext,
size_t  index 
)

Gets the array element at the given index of the node context's outputEvents field.

Definition at line 254 of file VuoRuntimeContext.cc.

◆ vuoGetNodeContextPortContext()

struct PortContext* vuoGetNodeContextPortContext ( struct NodeContext nodeContext,
size_t  index 
)

Gets the array element at the given index of the node context's portContexts field.

Definition at line 222 of file VuoRuntimeContext.cc.

◆ vuoGetOneExecutingEvent()

unsigned long vuoGetOneExecutingEvent ( struct NodeContext nodeContext)

Returns the first list item in the node context's executingEventIds field.

This is useful for when you know the list contains exactly one item.

Definition at line 314 of file VuoRuntimeContext.cc.

◆ vuoGetPortContextData()

void* vuoGetPortContextData ( struct PortContext portContext)

Gets the port context's data field.

Definition at line 148 of file VuoRuntimeContext.cc.

◆ vuoGetPortContextEvent()

bool vuoGetPortContextEvent ( struct PortContext portContext)

Gets the port context's event field.

Definition at line 140 of file VuoRuntimeContext.cc.

◆ vuoGetPortContextTriggerFunction()

void* vuoGetPortContextTriggerFunction ( struct PortContext portContext)

Gets the port context's triggerFunction field.

Definition at line 172 of file VuoRuntimeContext.cc.

◆ vuoGetPortContextTriggerQueue()

dispatch_queue_t vuoGetPortContextTriggerQueue ( struct PortContext portContext)

Gets the port context's triggerQueue field.

Definition at line 156 of file VuoRuntimeContext.cc.

◆ vuoGetPortContextTriggerSemaphore()

dispatch_semaphore_t vuoGetPortContextTriggerSemaphore ( struct PortContext portContext)

Gets the port context's triggerSemaphore field.

Definition at line 164 of file VuoRuntimeContext.cc.

◆ vuoResetNodeContextEvents()

void vuoResetNodeContextEvents ( struct NodeContext nodeContext)

Sets the event field to false for all of the port contexts in this node context.

Definition at line 262 of file VuoRuntimeContext.cc.

◆ vuoRetainPortContextData()

void vuoRetainPortContextData ( struct PortContext portContext)

Prevents the port context's data field from being freed by vuoFreePortContext().

Definition at line 180 of file VuoRuntimeContext.cc.

◆ vuoSetNodeContextClaimingEventId()

void vuoSetNodeContextClaimingEventId ( struct NodeContext nodeContext,
unsigned long  claimingEventId 
)

Sets the node context's claimingEventId field.

Definition at line 206 of file VuoRuntimeContext.cc.

◆ vuoSetNodeContextInstanceData()

void vuoSetNodeContextInstanceData ( struct NodeContext nodeContext,
void *  instanceData 
)

Sets the node context's instanceData field, freeing the previous value.

Definition at line 197 of file VuoRuntimeContext.cc.

◆ vuoSetNodeContextOutputEvent()

void vuoSetNodeContextOutputEvent ( struct NodeContext nodeContext,
size_t  index,
bool  event 
)

Sets the array element at the given index of the node context's outputEvents field.

Definition at line 214 of file VuoRuntimeContext.cc.

◆ vuoSetNodeContextPortContexts()

void vuoSetNodeContextPortContexts ( struct NodeContext nodeContext,
struct PortContext **  portContexts,
unsigned long  portContextCount 
)

Sets the node context's portContexts and portContextCount fields.

Definition at line 188 of file VuoRuntimeContext.cc.

◆ vuoSetPortContextData()

void vuoSetPortContextData ( struct PortContext portContext,
void *  data 
)

Sets the port context's data field.

Definition at line 124 of file VuoRuntimeContext.cc.

◆ vuoSetPortContextEvent()

void vuoSetPortContextEvent ( struct PortContext portContext,
bool  event 
)

Sets the port context's event field.

Definition at line 116 of file VuoRuntimeContext.cc.

◆ vuoSetPortContextTriggerFunction()

void vuoSetPortContextTriggerFunction ( struct PortContext portContext,
void *  triggerFunction 
)

Sets the port context's triggerFunction field.

Definition at line 132 of file VuoRuntimeContext.cc.

◆ vuoSpunOffExecutingEvent()

void vuoSpunOffExecutingEvent ( struct NodeContext nodeContext,
unsigned long  eventId 
)

Adds the given value to the list in the node context's executingEventIds field.

Definition at line 283 of file VuoRuntimeContext.cc.

◆ vuoStartedExecutingEvent()

void vuoStartedExecutingEvent ( struct NodeContext nodeContext,
unsigned long  eventId 
)

Sets the node context's executingEventIds field to a list containing the given value, clearing out any old values.

Definition at line 271 of file VuoRuntimeContext.cc.