Vuo  2.0.0
Typedefs | Functions | Variables
VuoRuntime.cc File Reference

Description

VuoRuntime implementation.

Definition in file VuoRuntime.cc.

Go to the source code of this file.

Typedefs

typedef void(* VuoCompositionFiniCallback) (void)
 Callback prototype for vuoAddCompositionFiniCallback. More...
 

Functions

void vuoInit (int argc, char **argv)
 Parses command-line arguments, then calls vuoInitInProcess(). More...
 
void vuoInitInProcess (void *ZMQContext, const char *controlURL, const char *telemetryURL, bool isPaused, pid_t runnerPid, int runnerPipe, bool continueIfRunnerDies, const char *workingDirectory, void *compositionBinaryHandle, void *previousRuntimeState, bool doAppInit)
 Starts a composition running in the current process. More...
 
void * vuoFini (void)
 Cleans up the ØMQ connections. More...
 
void vuoFiniRuntimeState (void *runtimeState)
 Deallocates the return value of vuoFini(). More...
 
char * vuoGetWorkingDirectory (VuoCompositionState *compositionState)
 Calls VuoRuntimePersistentState::getWorkingDirectory() on the given runtime state if any, otherwise on the current runtime state if any, otherwise returns null. More...
 
pid_t vuoGetRunnerPid (VuoCompositionState *compositionState)
 Calls VuoRuntimeState::getRunnerPid() on the given runtime state if any, otherwise on the current runtime state if any, otherwise returns -1. More...
 
void vuoStopComposition (VuoCompositionState *compositionState)
 Calls VuoRuntimeState::stopCompositionAsOrderedByComposition() on the given runtime state if any, otherwise on the current runtime state if any, otherwise does nothing. More...
 
void vuoAddCompositionFiniCallback (VuoCompositionState *compositionState, VuoCompositionFiniCallback fini)
 Calls VuoRuntimePersistentState::addFiniCallback() on the given runtime state if any, otherwise on the current runtime state if any, otherwise does nothing. More...
 
void vuoDisableTermination (VuoCompositionState *compositionState)
 Calls VuoRuntimeState::disableTermination() on the given runtime state if any, otherwise on the current runtime state if any, otherwise does nothing. More...
 
void vuoEnableTermination (VuoCompositionState *compositionState)
 Calls VuoRuntimeState::enableTermination() on the given runtime state if any, otherwise on the current runtime state if any, otherwise does nothing. More...
 
bool vuoIsCurrentCompositionStopped (void)
 Returns true if the composition has not yet started or if it has stopped. More...
 

Variables

static VuoRuntimeStateruntimeState = NULL
 Runtime instance specific to this composition, keeping it separate from any other compositions running in the current process. More...
 
void * vuoRuntimeState = NULL
 Casted version of runtimeState for use by generated bitcode. More...
 

Typedef Documentation

◆ VuoCompositionFiniCallback

typedef void(* VuoCompositionFiniCallback) (void)

Callback prototype for vuoAddCompositionFiniCallback.

Definition at line 303 of file VuoRuntime.cc.

Function Documentation

◆ vuoAddCompositionFiniCallback()

void vuoAddCompositionFiniCallback ( VuoCompositionState compositionState,
VuoCompositionFiniCallback  fini 
)

Calls VuoRuntimePersistentState::addFiniCallback() on the given runtime state if any, otherwise on the current runtime state if any, otherwise does nothing.

Definition at line 346 of file VuoRuntime.cc.

◆ vuoDisableTermination()

void vuoDisableTermination ( VuoCompositionState compositionState)

Calls VuoRuntimeState::disableTermination() on the given runtime state if any, otherwise on the current runtime state if any, otherwise does nothing.

Definition at line 357 of file VuoRuntime.cc.

◆ vuoEnableTermination()

void vuoEnableTermination ( VuoCompositionState compositionState)

Calls VuoRuntimeState::enableTermination() on the given runtime state if any, otherwise on the current runtime state if any, otherwise does nothing.

Definition at line 368 of file VuoRuntime.cc.

◆ vuoFini()

void* vuoFini ( void  )

Cleans up the ØMQ connections.

To be called after the composition has stopped.

Returns a data structure containing runtime state that should persist across a live-coding reload. If this function is called for a live-coding reload, pass the return value to the next call to vuoInitInProcess(). Otherwise, pass it to vuoFiniRuntimeState().

Definition at line 286 of file VuoRuntime.cc.

◆ vuoFiniRuntimeState()

void vuoFiniRuntimeState ( void *  runtimeState)

Deallocates the return value of vuoFini().

Definition at line 295 of file VuoRuntime.cc.

◆ vuoGetRunnerPid()

pid_t vuoGetRunnerPid ( VuoCompositionState compositionState)

Calls VuoRuntimeState::getRunnerPid() on the given runtime state if any, otherwise on the current runtime state if any, otherwise returns -1.

Definition at line 322 of file VuoRuntime.cc.

◆ vuoGetWorkingDirectory()

char* vuoGetWorkingDirectory ( VuoCompositionState compositionState)

Calls VuoRuntimePersistentState::getWorkingDirectory() on the given runtime state if any, otherwise on the current runtime state if any, otherwise returns null.

Definition at line 309 of file VuoRuntime.cc.

◆ vuoInit()

void vuoInit ( int  argc,
char **  argv 
)

Parses command-line arguments, then calls vuoInitInProcess().

Definition at line 33 of file VuoRuntime.cc.

◆ vuoInitInProcess()

void vuoInitInProcess ( void *  ZMQContext,
const char *  controlURL,
const char *  telemetryURL,
bool  isPaused,
pid_t  runnerPid,
int  runnerPipe,
bool  continueIfRunnerDies,
const char *  workingDirectory,
void *  compositionBinaryHandle,
void *  previousRuntimeState,
bool  doAppInit 
)

Starts a composition running in the current process.

Parameters
ZMQContextA ØMQ context shared with the runner (since ØMQ only allows one context per process). If not needed, pass null.
controlURLThe URL to which the runtime should bind the ØMQ socket that it uses to receive control requests and send replies.
telemetryURLThe URL to which the runtime should bind the ØMQ socket that it uses to publish telemetry.
isPausedIf true, the composition starts out paused, and it's up to the runner to unpause it.
runnerPidThe process ID of the runner.
runnerPipeThe file descriptor of the pipe that the runtime should use to check if the runner process has ended. If not needed, pass -1.
continueIfRunnerDiesIf true, the runtime should allow the composition to keep running if runnerPipe indicates that the runner process has ended. If false, the runtime should instead stop the composition.
workingDirectoryThe directory that the composition should use to resolve relative paths.
compositionBinaryHandleThe handle of the composition's dynamic library or executable returned by dlopen().
previousRuntimeStateIf the composition is restarting for a live-coding reload, pass the value returned by the previous call to vuoFini(). Otherwise, pass null.
doAppInitShould we call VuoApp_init()?

Definition at line 232 of file VuoRuntime.cc.

◆ vuoIsCurrentCompositionStopped()

bool vuoIsCurrentCompositionStopped ( void  )

Returns true if the composition has not yet started or if it has stopped.

Assumes that just one composition is running in the process.

Definition at line 380 of file VuoRuntime.cc.

◆ vuoStopComposition()

void vuoStopComposition ( VuoCompositionState compositionState)

Calls VuoRuntimeState::stopCompositionAsOrderedByComposition() on the given runtime state if any, otherwise on the current runtime state if any, otherwise does nothing.

Definition at line 335 of file VuoRuntime.cc.

Variable Documentation

◆ runtimeState

VuoRuntimeState* runtimeState = NULL
static

Runtime instance specific to this composition, keeping it separate from any other compositions running in the current process.

Definition at line 27 of file VuoRuntime.cc.

◆ vuoRuntimeState

void* vuoRuntimeState = NULL

Casted version of runtimeState for use by generated bitcode.

Definition at line 28 of file VuoRuntime.cc.