Lumiverse
2.5
A framework for creating lighting control applications
|
A DynamicDeviceSet is a set of devices specified by a query string. More...
#include <DynamicDeviceSet.h>
Public Member Functions | |
DynamicDeviceSet () | |
Default constructor. More... | |
DynamicDeviceSet (Rig *rig, string query) | |
Constructs a DynamicDeviceSet. More... | |
DynamicDeviceSet (Rig *rig, JSONNode data) | |
Constructs a DynamicDeviceSet from a JSON Node. More... | |
DynamicDeviceSet (const DynamicDeviceSet &dc) | |
Copy a DynamicDeviceSet. More... | |
~DynamicDeviceSet () | |
Destructor for the DeviceSet. | |
std::ostream & | operator<< (std::ostream &str) |
Override for steam output. More... | |
DeviceSet | getDeviceSet () |
Gets a DeviceSet containing the devices that match the query at the time this function is called. | |
void | setQuery (string query) |
Sets the query string of this DynamicDeviceSet. More... | |
string | getQuery () |
Gets the query string. | |
bool | isQueryNull () |
Returns true if the query string is empty. | |
void | reset () |
Resets all the parameters in each Device in the device set. More... | |
void | setParam (string param, float val) |
Sets the value of a LumiverseFloat parameter on every device in the group. More... | |
void | setParam (string param, string val, float val2=-1.0f) |
Sets the value of a LumiverseEnum parameter on every device in the group. More... | |
void | setParam (string param, string channel, double val) |
Sets the value of a LumiverseColor parameter. More... | |
void | setParam (string param, string val, float val2, LumiverseEnum::Mode mode, LumiverseEnum::InterpolationMode interpMode) |
Sets the value of a LumiverseEnum parameter. More... | |
void | setParam (string param, double x, double y, double weight=1.0) |
Sets the value of a LumiverseColor parameter using LumiverseColor::setxy() More... | |
void | setColorRGBRaw (string param, double r, double g, double b, double weight=1.0) |
Sets the value of a LumiverseColor parameter. More... | |
void | setColorRGB (string param, double r, double g, double b, double weight=1.0, RGBColorSpace cs=sRGB) |
Sets the value of a LumiverseColor parameter. More... | |
const set< Device * > & | getDevices () |
Gets the devices managed by this set. More... | |
vector< string > | getIds () |
Gets a copy of the list of the IDs contained by this DynamicDeviceSet. | |
set< string > | getAllParams () |
Gets a copy of the set of all the parameters used by devices in this set. More... | |
set< string > | getAllMetadata () |
Gets a copy of the set of all the metadata keys used by devices in this set. | |
set< string > | getAllMetadataForKey (string key) |
Gets a copy of the set of all metadata values used by a particular key. | |
string | info () |
Returns a string containing info about the DynamicDeviceSet. More... | |
size_t | size () |
Returns the number of devices in the DynamicDeviceSet. More... | |
bool | hasSameIds (DynamicDeviceSet &devices) |
Returns true if the device sets have the same number of devices and contain the same set of IDs. More... | |
bool | hasSameDevices (DynamicDeviceSet &devices) |
Returns true if the device sets have the same number of devices and point to the same Devices. More... | |
bool | contains (Device *d) |
Checks to see if a device is in the device set. More... | |
bool | contains (string id) |
Checks to see if a device is in the device set. More... | |
JSONNode | toJSON (string name) |
Saves the device set as a JSON object with the given name. More... | |
Private Attributes | |
string | m_query |
Query string. | |
Rig * | m_rig |
Pointer to the rig for accessing indexes and devices. | |
A DynamicDeviceSet is a set of devices specified by a query string.
DynamicDeviceSets are constructed with the standard query syntax (https://github.com/ebshimizu/Lumiverse/wiki/Query-Syntax-Notes) and each time they're accessed, the set of devices matching the query will be selected for use. Note that this class is really a wrapper around DeviceSets and may be slow for repeated use of large queries.
|
inline |
Default constructor.
Like the default constructor for DeviceSet, this isn't particularly useful.
Lumiverse::DynamicDeviceSet::DynamicDeviceSet | ( | Rig * | rig, |
string | query | ||
) |
Constructs a DynamicDeviceSet.
Similar to a copy constructor.
rig | Pointer to a Rig to get devices from. |
query | Query string to associate with this DynamicDeviceSet |
Lumiverse::DynamicDeviceSet::DynamicDeviceSet | ( | Rig * | rig, |
JSONNode | data | ||
) |
Constructs a DynamicDeviceSet from a JSON Node.
rig | Pointer to the rig to get devices from. |
data | JSON data to load from. |
Lumiverse::DynamicDeviceSet::DynamicDeviceSet | ( | const DynamicDeviceSet & | dc | ) |
Copy a DynamicDeviceSet.
dc | DynamicDeviceSet to copy data from |
bool Lumiverse::DynamicDeviceSet::contains | ( | Device * | d | ) |
Checks to see if a device is in the device set.
This version of the contains function takes a pointer and checks to see if the exact same device is in the set. This function is faster than contains(string).
bool Lumiverse::DynamicDeviceSet::contains | ( | string | id | ) |
Checks to see if a device is in the device set.
This version of the contains function takes a device ID and checks if a device with the same id is in the set.
set< string > Lumiverse::DynamicDeviceSet::getAllParams | ( | ) |
Gets a copy of the set of all the parameters used by devices in this set.
Set means no duplicates
|
inline |
Gets the devices managed by this set.
bool Lumiverse::DynamicDeviceSet::hasSameDevices | ( | DynamicDeviceSet & | devices | ) |
Returns true if the device sets have the same number of devices and point to the same Devices.
This actually just checks to see if the pointers in the set of devices managed by the device set are pointing to the same things.
bool Lumiverse::DynamicDeviceSet::hasSameIds | ( | DynamicDeviceSet & | devices | ) |
Returns true if the device sets have the same number of devices and contain the same set of IDs.
Note that even if this returns true, the device sets could refer to different objects, as they store pointers to the devices they contain. This function is currently very slow.
string Lumiverse::DynamicDeviceSet::info | ( | ) |
Returns a string containing info about the DynamicDeviceSet.
|
inline |
Override for steam output.
Converts DynamicDeviceSet to a string representation and outputs it to a stream.
void Lumiverse::DynamicDeviceSet::reset | ( | ) |
Resets all the parameters in each Device in the device set.
void Lumiverse::DynamicDeviceSet::setColorRGB | ( | string | param, |
double | r, | ||
double | g, | ||
double | b, | ||
double | weight = 1.0 , |
||
RGBColorSpace | cs = sRGB |
||
) |
Sets the value of a LumiverseColor parameter.
Proxy for LumiverseColor::setRGB().
void Lumiverse::DynamicDeviceSet::setColorRGBRaw | ( | string | param, |
double | r, | ||
double | g, | ||
double | b, | ||
double | weight = 1.0 |
||
) |
Sets the value of a LumiverseColor parameter.
Not gonna work terribly well if you're mixing fixtures that don't have RGB for some reason in your selection. Proxy for LumiverseColor::setRGBRaw().
void Lumiverse::DynamicDeviceSet::setParam | ( | string | param, |
float | val | ||
) |
Sets the value of a LumiverseFloat parameter on every device in the group.
This function will only set the value of an existing parameter. If the parameter doesn't exist, it will not be created by this function.
param | Parameter to modify |
val | Value of the parameter |
void Lumiverse::DynamicDeviceSet::setParam | ( | string | param, |
string | val, | ||
float | val2 = -1.0f |
||
) |
Sets the value of a LumiverseEnum parameter on every device in the group.
This function will only set the value of an existing parameter. If the parameter doesn't exist, it will not be created by this function.
param | Parameter to modify |
val | Value of the enumeration |
val2 | The tweak value of the LumiverseEnum |
void Lumiverse::DynamicDeviceSet::setParam | ( | string | param, |
string | channel, | ||
double | val | ||
) |
Sets the value of a LumiverseColor parameter.
LumiverseColors present a bit of a challenge for group selections. Every light has differen color representations, so not every function will work for every group. This function will call the corresponding set param function for each device, but not every device may react to it.
param | Parameter name |
channel | Color channel name |
val | Value of the color channel |
void Lumiverse::DynamicDeviceSet::setParam | ( | string | param, |
string | val, | ||
float | val2, | ||
LumiverseEnum::Mode | mode, | ||
LumiverseEnum::InterpolationMode | interpMode | ||
) |
Sets the value of a LumiverseEnum parameter.
void Lumiverse::DynamicDeviceSet::setParam | ( | string | param, |
double | x, | ||
double | y, | ||
double | weight = 1.0 |
||
) |
Sets the value of a LumiverseColor parameter using LumiverseColor::setxy()
x and y are chromaticity coordinates in the xyY color space. Ideally this function would be the unifying function for all devices in a Rig. However, it only works if you know the XYZ values for each color of LED in a light, and it doesn't work with CMY fixtures at the moment.
param | Parameter name. |
x | x coordinate |
y | y coordinate |
void Lumiverse::DynamicDeviceSet::setQuery | ( | string | query | ) |
Sets the query string of this DynamicDeviceSet.
query | New query string to use. |
|
inline |
Returns the number of devices in the DynamicDeviceSet.
JSONNode Lumiverse::DynamicDeviceSet::toJSON | ( | string | name | ) |
Saves the device set as a JSON object with the given name.
This serializes to a list of IDs that can be used to reconstruct the DynamicDeviceSet if it's given the same Rig as it currently has.
name | Node name. |