Vuo  1.2.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Macros

Description

Parameter decorations to be used by node classes.

Each parameter of nodeEvent(), nodeInstanceEvent(), and other node class functions refers to one of the node's ports or the node's instance data. This is indicated by its decoration.

Macros

#define VuoInstanceData(type)
 Use this to decorate parameters referring to a stateful node's instance data.
 
#define VuoInputData(type,...)
 Use this to decorate parameters referring to the data part of a data-and-event input port.
 
#define VuoInputEvent(...)
 Use this to decorate parameters referring to an event-only input port or the event part of a data-and-event input port.
 
#define VuoOutputData(type,...)
 Use this to decorate parameters referring to the data part of a data-and-event output port.
 
#define VuoOutputEvent(...)
 Use this to decorate parameters referring to an event-only output port or the event part of a data-and-event output port.
 
#define VuoOutputTrigger(name, type,...)
 Use this to decorate parameters referring to a trigger output port.
 

Macro Definition Documentation

#define VuoInputData (   type,
  ... 
)

Use this to decorate parameters referring to the data part of a data-and-event input port.

The parameter's name becomes the port name.

When this parameter's function is called, the argument passed will be a value of type type that holds the input port's data.

If type is heap data (a pointer), the parameter's function should not modify the heap data. See Developing Node Classes for more information.

Parameters
typeThe port type. See Built-in Types.
...Optionally, a JSON object specification containing additional details about the data. Supported JSON keys include:
  • "default" — The default constant value for the port. It should have the format accepted by the port type's MyType_makeFromJson() function.
  • "defaults" — For generic ports, the default constant values for data types to which the port can be specialized. The value for this JSON key should be a JSON object in which each key is a specialized port type name and each value has the format accepted by that port type's MyType_makeFromJson() function.
  • "name" (string) — Overrides the default heuristics for creating the port's displayed name in rendered compositions. This is usually not necessary.
  • "includeValues" (array of strings) — Enum types by default display all _allowedValues() in a menu. When this detail is present, only the values listed will be displayed in the menu. The values should be string keys — the output of _getJson().
Additional keys may be recognized by the port type's input editor (see Developing an Input Editor).
Example:
void nodeEvent(VuoInputData(VuoInteger,{"default":60,"suggestedMin":0,"suggestedMax":127}) noteNumber);
#define VuoInputEvent (   ...)

Use this to decorate parameters referring to an event-only input port or the event part of a data-and-event input port.

When this parameter's function is called, the argument passed will be a bool that is true if the port received an event.

For an event-only port, the parameter's name becomes the port name.

Parameters
...Optionally, a JSON object specification containing additional details about the event. Supported JSON keys are:
  • "data" (string) — For data-and-event ports, the variable name for the VuoInputData parameter that provides the data part of the port.
  • "eventBlocking" (string) — The port's policy for blocking events. Defaults to "none".
    • "none" — An event received by this input port is never blocked. It always flows to all non-trigger output ports.
    • "door" — An event received by this input port may or may not be blocked. It may or may not flow to any non-trigger output port.
    • "wall" — An event received by this input port is always blocked. It never flows to any output port.
  • "hasPortAction" (boolean) — Overrides the default heuristics for determining whether the port has a port action (does something special when it receives an event). This is usually not necessary.
  • "name" (string) — For event-only ports, overrides the default heuristics for creating the port's displayed name in rendered compositions. This is usually not necessary.
Example:
void nodeEvent(VuoInputData(VuoInteger,"0") seconds, VuoInputEvent({"data":"seconds","eventBlocking":"wall"}) secondsEvent);
Example:
void nodeEvent(VuoInputEvent() start);
#define VuoInstanceData (   type)

Use this to decorate parameters referring to a stateful node's instance data.

When this parameter's function is called, the argument passed will be a pointer to the instance data created by nodeInstanceEvent().

Parameters
typeThe instance data's C type.
Example:
void nodeInstanceEvent(VuoInstanceData(struct nodeInstanceData) ctx);
#define VuoOutputData (   type,
  ... 
)

Use this to decorate parameters referring to the data part of a data-and-event output port.

When this parameter's function is called, the argument passed will be a value of type type* that points to the output port's data. Set this data to set the output port's value.

The parameter's name becomes the port name.

If type is heap data (a pointer), the node should not modify the heap data after the node function returns. See Developing Node Classes for more information.

Parameters
typeThe port type. See Built-in Types.
...Optionally, a JSON object specification containing additional details about the data. Supported JSON keys are:
  • "name" (string) — Overrides the default heuristics for creating the port's displayed name in rendered compositions. This is usually not necessary.
Example:
void nodeEvent(VuoOutputData(VuoInteger) seconds);
#define VuoOutputEvent (   ...)

Use this to decorate parameters referring to an event-only output port or the event part of a data-and-event output port.

When this parameter's function is called, the argument passed will be a bool*. Set this to true if an event should be sent through the output port. However, if any input port with the "eventBlocking" option "none" received an event, then an event will be sent through the output port regardless of this parameter's value.

For an event-only port, the parameter's name becomes the port name.

Parameters
...Optionally, a JSON object specification containing additional details about the event. Supported JSON keys are:
  • "data" (string) — For data-and-event ports, the variable name for the VuoOutputData parameter that provides the data part of the port.
  • "name" (string) — For event-only ports, overrides the default heuristics for creating the port's displayed name in rendered compositions. This is usually not necessary.
Example:
void nodeEvent(VuoOutputData(VuoInteger) seconds, VuoOutputEvent({"data":"seconds"}) secondsEvent);
Example:
void nodeEvent(VuoOutputEvent() started);
#define VuoOutputTrigger (   name,
  type,
  ... 
)

Use this to decorate parameters referring to a trigger output port.

When this parameter's function is called, the argument passed will be a callback function. Call the function to fire an event through the trigger port.

Parameters
nameThe name of the trigger port.
typeThe port type, or void for an event-only trigger port. See Built-in Types.
...Optionally, a JSON object specification containing additional details about the event. Supported JSON keys are:
  • "eventThrottling" (string) — How the trigger should handle events when triggers are firing events faster than the composition can process them. Defaults to "enqueue".
    • "enqueue" — An event fired by this port will eventually reach downstream nodes, waiting if necessary for previous events to flow through the composition.
    • "drop" — An event fired by this port will be dropped (not transmitted to any nodes downstream of the trigger port) if it would otherwise have to wait for previous events to flow through the composition.
  • "name" (string) — Overrides the default heuristics for creating the port's displayed name in rendered compositions. This is usually not necessary.
Example:
void nodeEvent(VuoOutputTrigger(started,void))
{
// Fire an event without any data.
started();
}
Example:
void nodeEvent(VuoOutputTrigger(didSomething,VuoInteger))
{
// Fire an event with stack data.
didSomething(5);
}
Example:
void nodeEvent(VuoOutputTrigger(didSomething,VuoText))
{
// Fire an event with heap data.
VuoText t = VuoText_make("hello");
didSomething(t);
}