Lumiverse  2.5
A framework for creating lighting control applications
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Lumiverse::ShowControl::Programmer Class Reference

A Programmer is a special Layer-like object used to manipulate specific devices for cues. More...

#include <Programmer.h>

Collaboration diagram for Lumiverse::ShowControl::Programmer:
Collaboration graph
[legend]

Public Member Functions

 Programmer (Rig *rig)
 Programmers must be initialized from Rigs to ensure that they contain the same Devices. More...
 
 Programmer (Rig *rig, JSONNode data)
 Creates a programmed based off the given rig and intialized with the JSON data.
 
 ~Programmer ()
 Destroys a programmer object.
 
void setParam (DeviceSet selection, string param, LumiverseType *val)
 Sets the selected device's parameter to the given value. More...
 
void setParam (string selection, string param, LumiverseType *val)
 Sets the selected devices's parameter to the given value. More...
 
void setParam (DeviceSet selection, string param, float val)
 
void setParam (DeviceSet selection, string param, string val, float val2=-1.0f)
 
void setParam (DeviceSet selection, string param, string channel, double val)
 
void setParam (DeviceSet selection, string param, double x, double y, double weight=1.0)
 
void setParam (DeviceSet selection, string param, string val, float val2, LumiverseEnum::Mode mode, LumiverseEnum::InterpolationMode interpMode)
 
void setColorRGB (DeviceSet selection, string param, double r, double g, double b, double weight=1.0, RGBColorSpace cs=sRGB)
 
void setColorRGBRaw (DeviceSet selection, string param, double r, double g, double b, double weight=1.0)
 
void setParam (string selection, string param, float val)
 
void setParam (string selection, string param, string val, float val2=-1.0f)
 
void setParam (string selection, string param, string channel, double val)
 
void setParam (string selection, string param, double x, double y, double weight=1.0)
 
void setParam (string selection, string param, string val, float val2, LumiverseEnum::Mode mode, LumiverseEnum::InterpolationMode interpMode)
 
void setColorRGB (string selection, string param, double r, double g, double b, double weight=1.0, RGBColorSpace cs=sRGB)
 
void setColorRGBRaw (string selection, string param, double r, double g, double b, double weight=1.0)
 
Deviceoperator[] (string id)
 Shorthand to access a device by ID. More...
 
DevicegetDevice (string id)
 Returns a device from the Programmer and captures it. More...
 
const DevicereadDevice (string id)
 Returns a device from the programmer without capturing it. More...
 
void captureDevices (DeviceSet d)
 Adds the selected devices to the captured list. More...
 
void clearCaptured ()
 Clears the list of captured devices but does not reset the state of the devices.
 
void reset ()
 Resets the state of the layer. Does not clear the captured devices.
 
void clearAndReset ()
 Clears the list of captured devices and resets the state of the devices.
 
map< string, Device * > getCapturedDevices ()
 Returns the set of captured devices.
 
bool isCaptured (string id)
 Returns that capture status of a single device. More...
 
void blend (map< string, Device * > state)
 Writes the programmer's captured channels on top of the given device state. More...
 
const map< string, Device * > & getDevices ()
 Gets the set of the Devices the Programmer has. More...
 
void writeToTimeline (shared_ptr< Timeline > tl, size_t time, bool ucs=false)
 Creates a cue from the programmer's state. More...
 
void writeToTimeline (DeviceSet d, shared_ptr< Timeline > tl, size_t time, bool ucs=false)
 
void captureFromRig (DeviceSet devices)
 Captures the selected devices and copies their current values from the rig. More...
 
void captureFromRig (string id)
 Captures the selected devices and copies their current values from the rig. More...
 
JSONNode toJSON ()
 Converts this object to a JSON object.
 
bool loadJSON (JSONNode data)
 Loads JSON data into the Programmer. More...
 
CuegetCue (float up, float down, float delay)
 Returns a cue constructed from the current state of the programmer.
 

Private Member Functions

void addCaptured (DeviceSet set)
 Safely adds a set to the set of captured devices.
 
void addCaptured (string id)
 Safely adds an ID to the set of captured devices.
 

Private Attributes

map< string, Device * > m_devices
 Set of devices managed by this Programmer. More...
 
DeviceSet captured
 Set of captured devices in the Programmer.
 
Rigm_rig
 The Rig this programmer is storing a state for.
 
mutex m_progMutex
 Mutex for interacting with the programmer.
 

Detailed Description

A Programmer is a special Layer-like object used to manipulate specific devices for cues.

A Programmer object stores a specific state of a Rig. It tracks devices that have been directly modified (captured) and is able to store those into a Cue when requested. Programmer objects do not contain Patches and cannot start an update loop.

Note that this class never returns a DeviceSet, as those are attached to the Rig that generated it. Modifying the devices in a DeviceSet will modify the Rig, not a Programmer that might return them.

Constructor & Destructor Documentation

Lumiverse::ShowControl::Programmer::Programmer ( Rig rig)

Programmers must be initialized from Rigs to ensure that they contain the same Devices.

Parameters
rigRig to create a Programmer for.

Member Function Documentation

void Lumiverse::ShowControl::Programmer::blend ( map< string, Device * >  state)

Writes the programmer's captured channels on top of the given device state.

Blend in this case means overwrite. Given a map of Devices by ID, this function will write the current state of the captured devices into the state map.

void Lumiverse::ShowControl::Programmer::captureDevices ( DeviceSet  d)

Adds the selected devices to the captured list.

Parameters
dDevices to capture
void Lumiverse::ShowControl::Programmer::captureFromRig ( DeviceSet  devices)

Captures the selected devices and copies their current values from the rig.

Any existing captured devices will be added to by this function.

Parameters
DeviceSetdevices to capture.
void Lumiverse::ShowControl::Programmer::captureFromRig ( string  id)

Captures the selected devices and copies their current values from the rig.

Andy existing captured devices will be added to by this function

Parameters
idId of the device to capture.
Device * Lumiverse::ShowControl::Programmer::getDevice ( string  id)

Returns a device from the Programmer and captures it.

Parameters
idDevice ID
Returns
Pointer to specified device. nullptr if device does not exist.
const map<string, Device *>& Lumiverse::ShowControl::Programmer::getDevices ( )
inline

Gets the set of the Devices the Programmer has.

Returns
Reference to the set of Devices managed by the programmer.
bool Lumiverse::ShowControl::Programmer::isCaptured ( string  id)

Returns that capture status of a single device.

Returns
true if the device is captured, false otherwise.
bool Lumiverse::ShowControl::Programmer::loadJSON ( JSONNode  data)

Loads JSON data into the Programmer.

Does not assign the rig, so it's ok to use this for reinitialization if the rig is the same.

Device * Lumiverse::ShowControl::Programmer::operator[] ( string  id)

Shorthand to access a device by ID.

If you use this function, the device specified will automatically be added to the captured devices.

Parameters
idDevice ID
Returns
Pointer to the specified device. Nullptr otherwise.
const Device * Lumiverse::ShowControl::Programmer::readDevice ( string  id)

Returns a device from the programmer without capturing it.

Used to read state of the devices.

Parameters
idDeviceID
Returns
Pointer to specified device. nullptr if device does not exist.
void Lumiverse::ShowControl::Programmer::setParam ( DeviceSet  selection,
string  param,
LumiverseType val 
)

Sets the selected device's parameter to the given value.

This function is the primary way to modify devices in a programmer. This function will mark the changed devices as captured and change the parameter.

Parameters
selectionSelected devices
paramParameter to modify
valValue to set the parameter to
void Lumiverse::ShowControl::Programmer::setParam ( string  selection,
string  param,
LumiverseType val 
)

Sets the selected devices's parameter to the given value.

Selection is done with a query string in this instance. Queries are based off of the Rig so that parameter related queries hit the right data.

Parameters
selectionQuery string
paramParam name
valValue to set the parameter to.
See also
DeviceSet::query
void Lumiverse::ShowControl::Programmer::writeToTimeline ( shared_ptr< Timeline tl,
size_t  time,
bool  ucs = false 
)

Creates a cue from the programmer's state.

Parameters
upfadeUpfade time in seconds
downfadeDownfade time in seconds
delayDelay in seconds

Writes the programmer's current values to a timeline at the specified time.

Member Data Documentation

map<string, Device*> Lumiverse::ShowControl::Programmer::m_devices
private

Set of devices managed by this Programmer.

Note that these are copies of the devices contained in the Rig.


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