Vuo  2.3.2
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
VuoRunner Class Reference

Description

This class runs and controls a composition that has been compiled and linked by VuoCompiler.

The Vuo SDK provides examples of using this class under example/runner.

Conventions for host applications

If your application runs Image Generator, Image Filter, or Image Transition protocol compositions, it should typically use VuoRunner like this:

When you call firePublishedInputPortEvent(), the list of published input ports that you pass should contain exactly those published input ports whose values have changed since the previous event.

Constructing a runner

The composition can run in the same process as the VuoRunner or in a separate process, depending on how the VuoRunner is constructed.

To construct a VuoRunner, use one of the factory methods:

Starting and stopping a composition

To start a composition running, call start() or startPaused().

To stop the composition, call stop(). The composition must be stopped by the time VuoRunner's destructor is called. If the composition process ends on its own, the VuoRunner detects this and stops itself.

Controlling and querying a composition

While the composition is running, the VuoRunner can control it by sending control request messages to it. The VuoRunner functions that send control request messages must only be called while the composition is running.

Functions that send control request messages are mutually thread-safe, so they may be called concurrently with each other.

Receiving notifications from a composition

While the composition is running, the VuoRunner receives telemetry messages from it. To receive notifications of these messages, create a class that inherits from VuoRunnerDelegate, and call VuoRunner::setDelegate().

See also
Developing Applications that Use Vuo
VuoRunnerCocoa (a similar API, in Objective-C)

Definition at line 89 of file VuoRunner.hh.

Classes

class  Port
 This class represents a published port in a composition. More...
 
class  Private
 Private instance data for VuoRunner. More...
 

Public Member Functions

 ~VuoRunner (void)
 Destructor. More...
 
void setRuntimeChecking (bool runtimeCheckingEnabled)
 When enabled, additional runtime checks are performed on the target composition. More...
 
void start (void)
 Starts the composition running. More...
 
void startPaused (void)
 Starts the composition running, but in a paused state. More...
 
void runOnMainThread (void)
 For a composition in the current process, runs the composition on the main thread until it stops (either on its own or from a call to stop() on another thread). More...
 
void drainMainDispatchQueue (void)
 For a composition in the current process, briefly performs work that requires the main thread (such as Cocoa event handling). More...
 
void pause (void)
 Sends a control request to the composition telling it to cease firing events. More...
 
void unpause (void)
 Sends a control request to the composition telling it to resume firing events. More...
 
void replaceComposition (string compositionDylibPath, string compositionDiff)
 Sends a control request to the composition loader telling it to load an updated version of the running composition. More...
 
void stop (void)
 Sends a control request to the composition telling it to stop. More...
 
void waitUntilStopped (void)
 Waits until the composition is stopped. More...
 
void setPublishedInputPortValues (map< Port *, json_object * > portsAndValues)
 Sends a control request to the composition telling it to modify the value of one or more published input ports. More...
 
void firePublishedInputPortEvent (Port *port)
 Sends a control request to the composition telling it to fire an event into a published input port. More...
 
void firePublishedInputPortEvent (const set< Port * > &ports)
 Sends a control request to the composition telling it to fire an event into all of the given published input ports simultaneously. More...
 
void waitForFiredPublishedInputPortEvent (void)
 Waits until the event most recently fired by firePublishedInputPortEvent() finishes propagating through the composition. More...
 
json_objectgetPublishedInputPortValue (Port *port)
 Sends a control request to the composition telling it to retrieve a published input port's value. More...
 
json_objectgetPublishedOutputPortValue (Port *port)
 Sends a control request to the composition telling it to retrieve a published output port's value. More...
 
vector< Port * > getPublishedInputPorts (void)
 Returns the list of published input ports in the composition. More...
 
vector< Port * > getPublishedOutputPorts (void)
 Returns the list of published output ports in the composition. More...
 
PortgetPublishedInputPortWithName (string name)
 Returns the published input port with the given name, or NULL if no such port exists. More...
 
PortgetPublishedOutputPortWithName (string name)
 Returns the published output port with the given name, or NULL if no such port exists. More...
 
void setInputPortValue (string compositionIdentifier, string portIdentifier, json_object *value)
 Sends a control request to the composition telling it to modify an input port's value. More...
 
void fireTriggerPortEvent (string compositionIdentifier, string portIdentifier)
 Sends a control request to the composition telling it to fire an event from the trigger port. More...
 
json_objectgetInputPortValue (string compositionIdentifier, string portIdentifier)
 Sends a control request to the composition telling it to retrieve an input port's value. More...
 
json_objectgetOutputPortValue (string compositionIdentifier, string portIdentifier)
 Sends a control request to the composition telling it to retrieve an output port's value. More...
 
string getInputPortSummary (string compositionIdentifier, string portIdentifier)
 Sends a control request to the composition telling it to retrieve an input port's summary. More...
 
string getOutputPortSummary (string compositionIdentifier, string portIdentifier)
 Sends a control request to the composition telling it to retrieve an output port's summary. More...
 
string subscribeToInputPortTelemetry (string compositionIdentifier, string portIdentifier)
 Sends a control request to the composition telling it to start sending telemetry for each event through an input port. More...
 
string subscribeToOutputPortTelemetry (string compositionIdentifier, string portIdentifier)
 Sends a control request to the composition telling it to start sending telemetry for each event through an output port. More...
 
void unsubscribeFromInputPortTelemetry (string compositionIdentifier, string portIdentifier)
 Sends a control request to the composition telling it to stop sending telemetry for each event through an input port. More...
 
void unsubscribeFromOutputPortTelemetry (string compositionIdentifier, string portIdentifier)
 Sends a control request to the composition telling it to stop sending telemetry for each event through an output port. More...
 
void subscribeToEventTelemetry (string compositionIdentifier)
 Sends a control request to the composition telling it to start sending telemetry for all events. More...
 
void unsubscribeFromEventTelemetry (string compositionIdentifier)
 Sends a control request to the composition telling it to stop sending telemetry for all events. More...
 
void subscribeToAllTelemetry (string compositionIdentifier)
 Sends a control request to the composition telling it to start sending all telemetry. More...
 
void unsubscribeFromAllTelemetry (string compositionIdentifier)
 Sends a control request to the composition telling it to stop sending all telemetry The composition will continue sending any telemetry subscribed by subscribeToInputPortTelemetry(), subscribeToOutputPortTelemetry(), or subscribeToEventTelemetry(). More...
 
bool isStopped (void)
 Returns true if the composition either has not been started or has been started and stopped. More...
 
void setDelegate (VuoRunnerDelegate *delegate)
 Sets the delegate that receives telemetry messages from the running composition. More...
 
pid_t getCompositionPid ()
 Returns the Unix process id of the running composition. More...
 

Static Public Member Functions

static VuoRunnernewSeparateProcessRunnerFromExecutable (string executablePath, string sourceDir, bool continueIfRunnerDies, bool deleteExecutableWhenFinished)
 Creates a runner that can run a composition in a new process. More...
 
static VuoRunnernewSeparateProcessRunnerFromDynamicLibrary (string compositionLoaderPath, string compositionDylibPath, const std::shared_ptr< VuoRunningCompositionLibraries > &runningCompositionLibraries, string sourceDir, bool continueIfRunnerDies=false, bool deleteDylibsWhenFinished=false)
 Creates a runner object that can run a composition in a new process and replace the composition with a new version while it's running. More...
 
static VuoRunnernewCurrentProcessRunnerFromDynamicLibrary (string dylibPath, string sourceDir, bool deleteDylibWhenFinished=false)
 Creates a runner object that can run a composition in the current process. More...
 

Friends

class TestControlAndTelemetry
 
class TestVuoRunner
 
void * VuoRunner_listen (void *context)
 pthread_create can't directly invoke a C++ instance method, so this is a C wrapper for it. More...
 

Constructor & Destructor Documentation

◆ ~VuoRunner()

VuoRunner::~VuoRunner ( void  )

Destructor.

Assumes the composition either has not been started or has been started and stopped.

Definition at line 200 of file VuoRunner.cc.

Member Function Documentation

◆ drainMainDispatchQueue()

void VuoRunner::drainMainDispatchQueue ( void  )

For a composition in the current process, briefly performs work that requires the main thread (such as Cocoa event handling).

Repeated calls to this function allow the composition to run without taking over the main thread like runOnMainThread() does.

Start calling this function after start() or startPaused().

There's no need to call this function if your application calls dispatch_main(), NSApplicationMain(), or UIApplicationMain(), or if it invokes a CFRunLoop on the main thread.

Throws a VuoException if this runner was not constructed to run the composition in the current process or if this function was not called on the main thread.

Example:
runner->start();
while (! runner->isStopped())
{
// do other work on the main thread
}
See also
runOnMainThread(), an alternative to this function.

Definition at line 840 of file VuoRunner.cc.

◆ firePublishedInputPortEvent() [1/2]

void VuoRunner::firePublishedInputPortEvent ( const set< Port * > &  ports)

Sends a control request to the composition telling it to fire an event into all of the given published input ports simultaneously.

Upon return, the event will have been fired.

Assumes the composition has been started, is not paused, and has not been stopped.

Changed in Vuo 2.0.0:
Added ports argument.

Definition at line 1805 of file VuoRunner.cc.

◆ firePublishedInputPortEvent() [2/2]

void VuoRunner::firePublishedInputPortEvent ( VuoRunner::Port port)

Sends a control request to the composition telling it to fire an event into a published input port.

Upon return, the event will have been fired.

Assumes the composition has been started, is not paused, and has not been stopped.

Definition at line 1788 of file VuoRunner.cc.

◆ fireTriggerPortEvent()

void VuoRunner::fireTriggerPortEvent ( string  compositionIdentifier,
string  portIdentifier 
)

Sends a control request to the composition telling it to fire an event from the trigger port.

If the trigger port carries data, its most recent data is fired along with the event.

Upon return, the event will have been fired.

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance that contains the port. If the port is in the top-level composition, you can just pass an empty string.
portIdentifierThe compile-time identifier for the port (see VuoCompilerEventPort::getIdentifier()).
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1249 of file VuoRunner.cc.

◆ getCompositionPid()

pid_t VuoRunner::getCompositionPid ( )

Returns the Unix process id of the running composition.

Only applicable for compositions running in a separate process.

Definition at line 2783 of file VuoRunner.cc.

◆ getInputPortSummary()

string VuoRunner::getInputPortSummary ( string  compositionIdentifier,
string  portIdentifier 
)

Sends a control request to the composition telling it to retrieve an input port's summary.

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance that contains the port. If the port is in the top-level composition, you can just pass an empty string.
portIdentifierThe compile-time identifier for the port (see VuoCompilerEventPort::getIdentifier()).
Returns
A brief description of the port's value.
See also
Built-in Types for information about types and their summaries.
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1368 of file VuoRunner.cc.

◆ getInputPortValue()

json_object * VuoRunner::getInputPortValue ( string  compositionIdentifier,
string  portIdentifier 
)

Sends a control request to the composition telling it to retrieve an input port's value.

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance that contains the port. If the port is in the top-level composition, you can just pass an empty string.
portIdentifierThe compile-time identifier for the port (see VuoCompilerEventPort::getIdentifier()).
Returns
JSON representation of the port's value.
See also
Built-in Types for information about types and their JSON representations.
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1286 of file VuoRunner.cc.

◆ getOutputPortSummary()

string VuoRunner::getOutputPortSummary ( string  compositionIdentifier,
string  portIdentifier 
)

Sends a control request to the composition telling it to retrieve an output port's summary.

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance that contains the port. If the port is in the top-level composition, you can just pass an empty string.
portIdentifierThe compile-time identifier for the port (see VuoCompilerEventPort::getIdentifier()).
Returns
A brief description of the port's value.
See also
Built-in Types for information about types and their summaries.
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1408 of file VuoRunner.cc.

◆ getOutputPortValue()

json_object * VuoRunner::getOutputPortValue ( string  compositionIdentifier,
string  portIdentifier 
)

Sends a control request to the composition telling it to retrieve an output port's value.

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance that contains the port. If the port is in the top-level composition, you can just pass an empty string.
portIdentifierThe compile-time identifier for the port (see VuoCompilerEventPort::getIdentifier()).
Returns
JSON representation of the port's value.
See also
Built-in Types for information about types and their JSON representations.
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1327 of file VuoRunner.cc.

◆ getPublishedInputPorts()

vector< VuoRunner::Port * > VuoRunner::getPublishedInputPorts ( void  )

Returns the list of published input ports in the composition.

This function may either send a control request to the composition or use cached values.

Assumes the composition has been started and has not been stopped.

Exceptions
VuoExceptionThe connection between the runner and the composition failed.

Definition at line 2114 of file VuoRunner.cc.

◆ getPublishedInputPortValue()

json_object * VuoRunner::getPublishedInputPortValue ( VuoRunner::Port port)

Sends a control request to the composition telling it to retrieve a published input port's value.

Assumes the composition has been started and has not been stopped.

Parameters
portThe published input port.
Returns
JSON representation of the port's value.
See also
Built-in Types for information about types and their JSON representations.

Definition at line 1876 of file VuoRunner.cc.

◆ getPublishedInputPortWithName()

VuoRunner::Port * VuoRunner::getPublishedInputPortWithName ( string  name)

Returns the published input port with the given name, or NULL if no such port exists.

This function may either send a control request to the composition or use cached values.

Assumes the composition has been started and has not been stopped.

Exceptions
VuoExceptionThe connection between the runner and the composition failed.

Definition at line 2142 of file VuoRunner.cc.

◆ getPublishedOutputPorts()

vector< VuoRunner::Port * > VuoRunner::getPublishedOutputPorts ( void  )

Returns the list of published output ports in the composition.

This function may either send a control request to the composition or use cached values.

Assumes the composition has been started and has not been stopped.

Exceptions
VuoExceptionThe connection between the runner and the composition failed.

Definition at line 2128 of file VuoRunner.cc.

◆ getPublishedOutputPortValue()

json_object * VuoRunner::getPublishedOutputPortValue ( VuoRunner::Port port)

Sends a control request to the composition telling it to retrieve a published output port's value.

Assumes the composition has been started and has not been stopped.

Parameters
portThe published output port.
Returns
JSON representation of the port's value.
See also
Built-in Types for information about types and their JSON representations.

Definition at line 1913 of file VuoRunner.cc.

◆ getPublishedOutputPortWithName()

VuoRunner::Port * VuoRunner::getPublishedOutputPortWithName ( string  name)

Returns the published output port with the given name, or NULL if no such port exists.

This function may either send a control request to the composition or use cached values.

Assumes the composition has been started and has not been stopped.

Exceptions
VuoExceptionThe connection between the runner and the composition failed.

Definition at line 2161 of file VuoRunner.cc.

◆ isStopped()

bool VuoRunner::isStopped ( void  )

Returns true if the composition either has not been started or has been started and stopped.

Definition at line 2703 of file VuoRunner.cc.

◆ newCurrentProcessRunnerFromDynamicLibrary()

VuoRunner * VuoRunner::newCurrentProcessRunnerFromDynamicLibrary ( string  dylibPath,
string  sourceDir,
bool  deleteDylibWhenFinished = false 
)
static

Creates a runner object that can run a composition in the current process.

Parameters
dylibPathA linked composition dynamic library, produced by VuoCompiler::linkCompositionToCreateDynamicLibrary().
sourceDirThe directory containing the composition (.vuo) source file, used by nodes in the composition to resolve relative paths.
deleteDylibWhenFinishedTrue if the runner should delete dylibPath when it's finished using the file.
See also
CompileAndRunInCurrentProcess.cc

Definition at line 185 of file VuoRunner.cc.

◆ newSeparateProcessRunnerFromDynamicLibrary()

VuoRunner * VuoRunner::newSeparateProcessRunnerFromDynamicLibrary ( string  compositionLoaderPath,
string  compositionDylibPath,
const std::shared_ptr< VuoRunningCompositionLibraries > &  runningCompositionLibraries,
string  sourceDir,
bool  continueIfRunnerDies = false,
bool  deleteDylibsWhenFinished = false 
)
static

Creates a runner object that can run a composition in a new process and replace the composition with a new version while it's running.

Parameters
compositionLoaderPathThe VuoCompositionLoader executable.
compositionDylibPathA linked composition dynamic library, produced by VuoCompiler::linkCompositionToCreateDynamicLibraries.
runningCompositionLibrariesInformation about libraries referenced by the composition, produced and updated by calls to VuoCompiler::linkCompositionToCreateDynamicLibraries. The runner takes co-ownership of the VuoRunningCompositionLibraries object and will release it when the composition stops.
sourceDirThe directory containing the composition (.vuo) source file, used by nodes in the composition to resolve relative paths.
continueIfRunnerDiesIf true, the composition keeps running if the runner process exits without stopping the composition.
deleteDylibsWhenFinishedTrue if the runner should delete compositionDylibPath and the resource dylibs tracked by runningCompositionLibraries when it's finished using the files.
Changed in Vuo 2.0.0:
Added runningCompositionLibraries argument; removed resourceDylibPath argument.

Definition at line 161 of file VuoRunner.cc.

◆ newSeparateProcessRunnerFromExecutable()

VuoRunner * VuoRunner::newSeparateProcessRunnerFromExecutable ( string  executablePath,
string  sourceDir,
bool  continueIfRunnerDies,
bool  deleteExecutableWhenFinished 
)
static

Creates a runner that can run a composition in a new process.

Parameters
executablePathA linked composition executable, produced by VuoCompiler::linkCompositionToCreateExecutable().
sourceDirThe directory containing the composition (.vuo) source file, used by nodes in the composition to resolve relative paths.
continueIfRunnerDiesIf true, the composition keeps running if the runner process exits without stopping the composition.
deleteExecutableWhenFinishedTrue if the runner should delete executablePath when it's finished using the file.
See also
CompileAndRunInNewProcess.cc

Definition at line 135 of file VuoRunner.cc.

◆ pause()

void VuoRunner::pause ( void  )

Sends a control request to the composition telling it to cease firing events.

Upon return, no more events will be fired and all events will have finished propagating through the composition.

Assumes the composition has been started, is not paused, and has not been stopped.

Definition at line 858 of file VuoRunner.cc.

◆ replaceComposition()

void VuoRunner::replaceComposition ( string  compositionDylibPath,
string  compositionDiff 
)

Sends a control request to the composition loader telling it to load an updated version of the running composition.

Upon return, the old version of the composition will have stopped and the updated version will have started.

Assumes the same VuoRunningCompositionLibraries passed to newSeparateProcessRunnerFromDynamicLibrary was passed again through VuoCompiler::linkCompositionToCreateDynamicLibrary when linking the updated version of the composition. If any subcompositions or other node classes are being replaced in this live-coding reload, the VuoRunningCompositionLibraries also needs to be updated with a call to VuoRunningCompositionLibraries::enqueueLibraryContainingDependencyToUnload.

Assumes the composition loader has been started and has not been stopped.

Parameters
compositionDylibPathA linked composition dynamic library, produced by VuoCompiler::linkCompositionToCreateDynamicLibrary.
compositionDiffA comparison of the old and new compositions, produced by VuoCompilerCompositionDiff::diff.
Changed in Vuo 2.0.0:
Removed resourceDylibPath argument.

Definition at line 928 of file VuoRunner.cc.

◆ runOnMainThread()

void VuoRunner::runOnMainThread ( void  )

For a composition in the current process, runs the composition on the main thread until it stops (either on its own or from a call to stop() on another thread).

Call this function after start() or startPaused().

There's no need to call this function if your application calls dispatch_main(), NSApplicationMain(), or UIApplicationMain(), or if it invokes a CFRunLoop on the main thread.

Throws a VuoException if this runner was not constructed to run the composition in the current process or if this function was not called on the main thread.

See also
drainMainDispatchQueue(), an alternative to this function.

Definition at line 804 of file VuoRunner.cc.

◆ setDelegate()

void VuoRunner::setDelegate ( VuoRunnerDelegate delegate)

Sets the delegate that receives telemetry messages from the running composition.

May be null.

Definition at line 2728 of file VuoRunner.cc.

◆ setInputPortValue()

void VuoRunner::setInputPortValue ( string  compositionIdentifier,
string  portIdentifier,
json_object value 
)

Sends a control request to the composition telling it to modify an input port's value.

Upon return, the input port value will have been modified.

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance that contains the port. If the port is in the top-level composition, you can just pass an empty string.
portIdentifierThe compile-time identifier for the port (see VuoCompilerEventPort::getIdentifier()).
valueJSON representation of the port's new value.
See also
Built-in Types for information about types and their JSON representations.
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1209 of file VuoRunner.cc.

◆ setPublishedInputPortValues()

void VuoRunner::setPublishedInputPortValues ( map< Port *, json_object * >  portsAndValuesToSet)

Sends a control request to the composition telling it to modify the value of one or more published input ports.

When you need to set multiple published input port values, it's more efficient to make a single call to this function passing all of the ports and values than a separate call for each port.

Assumes the composition has been started and has not been stopped.

Parameters
portsAndValuesToSetThe JSON representation of each port's new value.
See also
Built-in Types for information about types and their JSON representations.
Changed in Vuo 2.0.0:
New.

Definition at line 1732 of file VuoRunner.cc.

◆ setRuntimeChecking()

void VuoRunner::setRuntimeChecking ( bool  runtimeCheckingEnabled)

When enabled, additional runtime checks are performed on the target composition.

This can identify issues for node developers to address, but it may reduce performance.

Definition at line 215 of file VuoRunner.cc.

◆ start()

void VuoRunner::start ( void  )

Starts the composition running.

If running the composition in the current process, a call to this method must be followed by either a call to runOnMainThread() or repeated calls to drainMainDispatchQueue() in order to run the composition.

If running the composition in a separate process, no further calls are needed to run the composition.

If running the composition in the current process, the current working directory is changed to the composition source directory that was passed to newCurrentProcessRunnerFromDynamicLibrary() until the composition is stopped.

Assumes the composition is not already running.

Definition at line 275 of file VuoRunner.cc.

◆ startPaused()

void VuoRunner::startPaused ( void  )

Starts the composition running, but in a paused state.

This is useful if you want to call setPublishedInputPortValue() before the composition begins firing events. To unpause the composition, call unpause().

If running the composition in the current process, a call to this method must be followed by either a call to runOnMainThread() or repeated calls to drainMainDispatchQueue() in order to run the composition.

If running the composition in a separate process, no further calls are needed.

If running the composition in the current process, the current working directory is changed to the composition source directory that was passed to newCurrentProcessRunnerFromDynamicLibrary() until the composition is stopped.

Assumes the composition is not already running.

Definition at line 322 of file VuoRunner.cc.

◆ stop()

void VuoRunner::stop ( void  )

Sends a control request to the composition telling it to stop.

Upon return, the composition will have stopped. If the composition was running in a separate process, that process will have ended.

If the composition has already stopped on its own, this function skips sending the control request. It just performs some cleanup.

This function waits for any pending VuoRunnerDelegate function calls to return.

Assumes the composition has been started and has not been stopped.

Definition at line 1021 of file VuoRunner.cc.

◆ subscribeToAllTelemetry()

void VuoRunner::subscribeToAllTelemetry ( string  compositionIdentifier)

Sends a control request to the composition telling it to start sending all telemetry.

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance whose telemetry is requested. If the top-level composition, you can just pass an empty string. The request only applies to events at the level of the requested composition instance, not recursively to subcompositions within it.
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1661 of file VuoRunner.cc.

◆ subscribeToEventTelemetry()

void VuoRunner::subscribeToEventTelemetry ( string  compositionIdentifier)

Sends a control request to the composition telling it to start sending telemetry for all events.

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance whose telemetry is requested. If the top-level composition, you can just pass an empty string. The request only applies to events at the level of the requested composition instance, not recursively to subcompositions within it.
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1593 of file VuoRunner.cc.

◆ subscribeToInputPortTelemetry()

string VuoRunner::subscribeToInputPortTelemetry ( string  compositionIdentifier,
string  portIdentifier 
)

Sends a control request to the composition telling it to start sending telemetry for each event through an input port.

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance that contains the port. If the port is in the top-level composition, you can just pass an empty string.
portIdentifierThe compile-time identifier for the port (see VuoCompilerEventPort::getIdentifier()).
Returns
A brief description of the port's value.
See also
Built-in Types for information about types and their summaries.
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1448 of file VuoRunner.cc.

◆ subscribeToOutputPortTelemetry()

string VuoRunner::subscribeToOutputPortTelemetry ( string  compositionIdentifier,
string  portIdentifier 
)

Sends a control request to the composition telling it to start sending telemetry for each event through an output port.

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance that contains the port. If the port is in the top-level composition, you can just pass an empty string.
portIdentifierThe compile-time identifier for the port (see VuoCompilerEventPort::getIdentifier()).
Returns
A brief description of the port's value.
See also
Built-in Types for information about types and their summaries.
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1488 of file VuoRunner.cc.

◆ unpause()

void VuoRunner::unpause ( void  )

Sends a control request to the composition telling it to resume firing events.

Assumes the composition is paused.

Definition at line 886 of file VuoRunner.cc.

◆ unsubscribeFromAllTelemetry()

void VuoRunner::unsubscribeFromAllTelemetry ( string  compositionIdentifier)

Sends a control request to the composition telling it to stop sending all telemetry The composition will continue sending any telemetry subscribed by subscribeToInputPortTelemetry(), subscribeToOutputPortTelemetry(), or subscribeToEventTelemetry().

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance whose telemetry is to be stopped. If the top-level composition, you can just pass an empty string. The request only applies to events at the level of the requested composition instance, not recursively to subcompositions within it.
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1696 of file VuoRunner.cc.

◆ unsubscribeFromEventTelemetry()

void VuoRunner::unsubscribeFromEventTelemetry ( string  compositionIdentifier)

Sends a control request to the composition telling it to stop sending telemetry for all events.

The composition will continue sending any telemetry subscribed by subscribeToInputPortTelemetry, subscribeToOutputPortTelemetry, or subscribeToAllTelemetry.

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance whose telemetry is to be stopped. If the top-level composition, you can just pass an empty string. The request only applies to events at the level of the requested composition instance, not recursively to subcompositions within it.
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1628 of file VuoRunner.cc.

◆ unsubscribeFromInputPortTelemetry()

void VuoRunner::unsubscribeFromInputPortTelemetry ( string  compositionIdentifier,
string  portIdentifier 
)

Sends a control request to the composition telling it to stop sending telemetry for each event through an input port.

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance that contains the port. If the port is in the top-level composition, you can just pass an empty string.
portIdentifierThe compile-time identifier for the port (see VuoCompilerEventPort::getIdentifier()).
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1525 of file VuoRunner.cc.

◆ unsubscribeFromOutputPortTelemetry()

void VuoRunner::unsubscribeFromOutputPortTelemetry ( string  compositionIdentifier,
string  portIdentifier 
)

Sends a control request to the composition telling it to stop sending telemetry for each event through an output port.

Assumes the composition has been started and has not been stopped.

Parameters
compositionIdentifierThe runtime identifier for the (sub)composition instance that contains the port. If the port is in the top-level composition, you can just pass an empty string.
portIdentifierThe compile-time identifier for the port (see VuoCompilerEventPort::getIdentifier()).
Changed in Vuo 2.0.0:
Added compositionIdentifier argument.

Definition at line 1559 of file VuoRunner.cc.

◆ waitForFiredPublishedInputPortEvent()

void VuoRunner::waitForFiredPublishedInputPortEvent ( void  )

Waits until the event most recently fired by firePublishedInputPortEvent() finishes propagating through the composition.

Assumes no further calls are made to firePublishedInputPortEvent() until this function returns.

Assumes the composition has been started and has not been stopped.

Example:
map<VuoRunner::Port *, json_object *> portsAndValues;
portsAndValues[inputPort] = inputValue;
portsAndValues[anotherInputPort] = anotherInputValue;
set<VuoRunner::Port *> changedPorts;
changedPorts.insert(inputPort);
changedPorts.insert(anotherInputPort);
runner.setPublishedInputPortValues(portsAndValues);
runner.firePublishedInputPortEvent(changedPorts);
runner.waitForFiredPublishedInputPortEvent();
result = runner.getPublishedOutputPortValue(outputPort);
Changed in Vuo 2.0.0:
New.

Definition at line 1861 of file VuoRunner.cc.

◆ waitUntilStopped()

void VuoRunner::waitUntilStopped ( void  )

Waits until the composition is stopped.

If the composition is already stopped, this function returns immediately.

Definition at line 1186 of file VuoRunner.cc.

Friends And Related Function Documentation

◆ VuoRunner_listen

void* VuoRunner_listen ( void *  context)
friend

pthread_create can't directly invoke a C++ instance method, so this is a C wrapper for it.

Definition at line 717 of file VuoRunner.cc.


The documentation for this class was generated from the following files: