18 #include "LumiverseCoreConfig.h"
24 #include "lib/libjson/libjson.h"
27 #include "lib/arnold/include/ai.h"
33 #if defined(USE_ARNOLD) || defined(USE_ARNOLD_CACHING)
43 typedef function<Patch*(JSONNode&)> patchParseFunc;
133 bool load(
string filename);
319 bool save(
string filename,
bool overwrite =
true);
void update()
Pushes data over the network.
Definition: Rig.cpp:435
void stop()
Stops the update loop.
Definition: Rig.cpp:285
Implementation of a patch for a DMX system.
bool m_slow
Incidates if the Rig is updating slowly.
Definition: Rig.h:504
void loadPatches(JSONNode root)
Load patches in the JSON file.
Definition: Rig.cpp:118
Represents a physical lighting Device in Lumiverse.
Patch * getSimulationPatch(string type)
Get a simulation patch.
Definition: Rig.cpp:579
set< string > getMetadataValues(string key)
Returns a set containing all of the unique values for a metadata key.
Definition: Rig.cpp:23
Subclass of ArnoldPatch to render frames of an animation.
set< Device * > m_devices
Raw list of devices for sending to the Patch->update function.
Definition: Rig.h:466
set< string > getAllUsedParams()
Gets a set of all the parameters used by the devices.
Definition: Rig.cpp:524
DMXPatch * getPatchAsDMXPatch(string id)
Gets a patch from a rig and treats it as a DMXPatch.
Definition: Rig.h:199
DeviceSet getChannel(unsigned int channel)
Gets all the devices in a channel.
Definition: Rig.cpp:509
map< string, Device * > m_devicesById
Devices mapped by their device ID.
Definition: Rig.h:479
float m_loopTime
Amount of time an update loop can take in s.
Definition: Rig.h:457
void deleteDevice(string id)
Removes the device with specified id from the rig. Also deletes it.
Definition: Rig.cpp:367
void loadDevices(JSONNode root)
Loads the devices in the JSON file.
Definition: Rig.cpp:100
A Patch maps devices to output channels and handles the output of data to the network.
Definition: Patch.h:24
Implementation of a patch for OSC.
DeviceSet getAllDevices()
Returns a set consisting of all devices in the rig.
Definition: Rig.cpp:505
unsigned int m_refreshRate
Sets the speed of the run loop in cycles/second. Default is 40.
Definition: Rig.h:449
bool save(string filename, bool overwrite=true)
Writes the rig out to a JSON file.
Definition: Rig.cpp:536
A DeviceSet is a set of devices.
Definition: DeviceSet.h:41
void setRefreshRate(unsigned int rate)
Sets the refresh rate for the update loop in cycles / second.
Definition: Rig.cpp:430
DeviceSet getDevices(string key, string val, bool isEqual)
Gets devices by metadata info.
Definition: Rig.cpp:519
bool addFunction(int pid, function< void()> func)
Adds a function to the additional functions list.
Definition: Rig.cpp:593
unsigned int getRefreshRate()
Gets the refresh rate for the update loop.
Definition: Rig.h:224
void init()
Initializes the rig.
Definition: Rig.cpp:274
map< string, Patch * > m_patches
Maps Patch id to at Patch object.
Definition: Rig.h:474
void loadJSON(JSONNode root)
Loads the rig info from the parsed JSON data.
Definition: Rig.cpp:47
Implementation of a patch for Arnold.
void reset()
Empties all the data from the rig.
Definition: Rig.cpp:236
Subclass of ArnoldPatch to render frames of an animation.
Contains functions for logging information to console or file.
void setAllDevices(map< string, Device * > devices)
Updates the parameters of the devices stored in the specified map.
Definition: Rig.cpp:472
const set< Device * > & getDeviceRaw()
Gets the raw list of devices.
Definition: Rig.h:308
map< int, function< void()> > m_updateFunctions
List of functions to run at the end of the update loop.
Definition: Rig.h:499
~Rig()
Destroys and frees all objects in the rig.
Definition: Rig.cpp:256
DeviceSet select(string q)
Gets a DeviceSet based on a query string.
Definition: Rig.cpp:496
thread * m_updateLoop
Thread that runs the update loop.
Definition: Rig.h:437
const map< string, Patch * > & getPatches()
Returns the map of ID to Patch held by the Rig.
Definition: Rig.h:189
Device * operator[](string id)
Shorthand for getDevice(string)
Definition: Rig.cpp:492
bool isSlow()
Returns true if the Rig is running slowly.
Definition: Rig.h:399
void updateOnce()
Forces an update to happen when this function is called.
Definition: Rig.cpp:458
size_t getNumDevices()
Returns the number of devices in the Rig.
Definition: Rig.h:389
Device * getDevice(string id)
Gets a device from the rig.
Definition: Rig.cpp:359
void addPatch(string id, Patch *patch)
Adds a Patch to the rig.
Definition: Rig.cpp:399
bool removeFunction(int pid)
Removes a function from the additional functions list.
Definition: Rig.cpp:623
Patch * getPatch(string id)
Gets a patch from the rig.
Definition: Rig.cpp:412
multimap< unsigned int, Device * > m_devicesByChannel
Devices mapped by channel number.
Definition: Rig.h:482
Implementation of a patch for Arnold.
Rig()
Makes an empty rig.
Definition: Rig.cpp:7
Contains all core Lumiverse functions and variables.
Definition: Device.cpp:2
void resetDevices()
Resets all devices in the rig to defaults.
Definition: Rig.cpp:653
The DMX Patch object manages the communication between the DMX network and the Lumiverse devices...
Definition: DMXPatch.h:42
bool load(string filename)
Loads a file into an existing rig.
Definition: Rig.cpp:292
void addDevice(Device *device)
Adds a device to the Rig.
Definition: Rig.cpp:339
The Rig contains information about the state of the lighting system.
Definition: Rig.h:58
A Device in Lumiverse maintains information about a lighting device.
Definition: Device.h:55
void run()
Runs the update loop that sends updates to the network.
Definition: Rig.cpp:280
bool m_running
Indicates the status of the update loop.
Definition: Rig.h:443
static map< string, patchParseFunc > patchParsers
Map containing functions to parse non-default patch types.
Definition: Rig.h:72
JSONNode toJSON()
Gets the JSON data for the rig.
Definition: Rig.cpp:551
The Patch translates Lumiverse Data to Network Data.
void deletePatch(string id)
Deletes an entire patch from the rig.
Definition: Rig.cpp:416