Lumiverse
2.5
A framework for creating lighting control applications
|
A Programmer is a special Layer-like object used to manipulate specific devices for cues. More...
#include <Programmer.h>
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) |
Device * | operator[] (string id) |
Shorthand to access a device by ID. More... | |
Device * | getDevice (string id) |
Returns a device from the Programmer and captures it. More... | |
const Device * | readDevice (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... | |
Cue * | getCue (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. | |
Rig * | m_rig |
The Rig this programmer is storing a state for. | |
mutex | m_progMutex |
Mutex for interacting with the programmer. | |
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.
Lumiverse::ShowControl::Programmer::Programmer | ( | Rig * | rig | ) |
Programmers must be initialized from Rigs to ensure that they contain the same Devices.
rig | Rig to create a Programmer for. |
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.
d | Devices 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.
DeviceSet | devices 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
id | Id of the device to capture. |
Device * Lumiverse::ShowControl::Programmer::getDevice | ( | string | id | ) |
Returns a device from the Programmer and captures it.
id | Device ID |
|
inline |
Gets the set of the Devices the Programmer has.
bool Lumiverse::ShowControl::Programmer::isCaptured | ( | string | id | ) |
Returns that capture status of a single device.
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.
id | Device ID |
const Device * Lumiverse::ShowControl::Programmer::readDevice | ( | string | id | ) |
Returns a device from the programmer without capturing it.
Used to read state of the devices.
id | DeviceID |
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.
selection | Selected devices |
param | Parameter to modify |
val | Value 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.
selection | Query string |
param | Param name |
val | Value to set the parameter to. |
void Lumiverse::ShowControl::Programmer::writeToTimeline | ( | shared_ptr< Timeline > | tl, |
size_t | time, | ||
bool | ucs = false |
||
) |
Creates a cue from the programmer's state.
upfade | Upfade time in seconds |
downfade | Downfade time in seconds |
delay | Delay in seconds |
Writes the programmer's current values to a timeline at the specified time.
|
private |
Set of devices managed by this Programmer.
Note that these are copies of the devices contained in the Rig.