Vuo  0.5.7
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
Node Methods: Stateful

Description

Setup, event handler, and teardown methods to be implemented by stateful node classes.

These functions are always called sequentially (not concurrently), so you don't need to make them mutually thread-safe.

Functions

struct nodeInstanceData * nodeInstanceInit (...)
 This function is called once for the node, either when the composition starts or when the node is added to a running composition.
 
void nodeInstanceTriggerStart (...)
 This function is called just after nodeInstanceInit() and each time the running composition is updated (e.g.
 
void nodeInstanceEvent (...)
 This function is called each time this node receives an event.
 
void nodeInstanceTriggerUpdate (...)
 This function is called each time an input port constant on this node is updated while the composition is running.
 
void nodeInstanceTriggerStop (...)
 This function is called each time the running composition is updated (e.g.
 
void nodeInstanceFini (...)
 This function is called once for the node, either when node is removed from the running composition or the composition stops.
 

Function Documentation

void nodeInstanceEvent (   ...)

This function is called each time this node receives an event.

Typically, it's responsible for performing whatever task the node does; it takes any input data and events, processes them, and sets or fires any output data and events. For node classes whose primary task is firing events through trigger ports, this function may not be as important.

This function is called once per event received by the node (even if the event is received through multiple input ports).

Parameter decorations must include:

Parameter decorations may include:

This function should not modify heap data provided via VuoInputData, and it should not keep references to heap data sent via VuoOutputData. See Developing Node Classes for more information.

void nodeInstanceFini (   ...)

This function is called once for the node, either when node is removed from the running composition or the composition stops.

It's responsible for closing any services opened in nodeInstanceInit() or elsewhere.

Parameter decorations must include:

struct nodeInstanceData* nodeInstanceInit (   ...)
read

This function is called once for the node, either when the composition starts or when the node is added to a running composition.

It's responsible for creating the instance data, and may open services (file, network port, ...).

If this function allocates memory on the heap for the instance data, it should register that memory. See Managing Memory.

Parameter decorations may include:

  • VuoInputData — This argument has the initial (constant or default) value of the input port, before it has received any events.
void nodeInstanceTriggerStart (   ...)

This function is called just after nodeInstanceInit() and each time the running composition is updated (e.g.

when a node is added). It's responsible for starting any threads, dispatch sources, or event loops that call VuoOutputTrigger functions.

This function is optional.

Parameter decorations must include:

Parameter decorations may include:

  • VuoInputData — This argument has the current value of the input port.
  • VuoOutputTrigger — Stateful nodes may store references to trigger functions in their instance data, in order to fire events at any time.
void nodeInstanceTriggerStop (   ...)

This function is called each time the running composition is updated (e.g.

when a node is added) and just before nodeInstanceFini(). It's responsible for stopping all threads, dispatch sources, and event loops started in nodeInstanceTriggerStart() or elsewhere.

Any VuoOutputTrigger functions stored in instance data become invalid after this function returns. No VuoOutputTrigger functions should fire from the time this function returns to the next time that nodeInstanceTriggerStart() is called.

This function is optional.

Parameter decorations must include:

void nodeInstanceTriggerUpdate (   ...)

This function is called each time an input port constant on this node is updated while the composition is running.

It's responsible for adjusting all VuoOutputTrigger callbacks to use the new input port values.

This function is optional.

Parameter decorations must include:

Parameter decorations may include:

  • VuoInputData — This argument has the current value of the input port.
  • VuoOutputTrigger — Stateful nodes may store references to trigger functions in their instance data, in order to fire events at any time.