Lumiverse  2.5
A framework for creating lighting control applications
CueList.h
1 #ifndef _CUELIST_H_
2 #define _CUELIST_H_
3 
4 #pragma once
5 
6 #include <LumiverseCore.h>
7 #include "Cue.h"
8 #include "Playback.h"
9 
10 namespace Lumiverse {
11 namespace ShowControl {
12 
13 class Playback;
14 
15 // A cue list is a list of cues. This class maintains the relationships
16 // between cues and performs update operations.
17 // This system will optionally track through changes to the cue, meaning
18 // that if you change a parameter value in a cue, it'll look forward
19 // through the cue list and update the values of that parameter if
20 // the parameter was the same in the previous cue.
21 
22 // these should probably have a name field at some point...
23 class CueList
24 {
25 public:
27  CueList(string name, Playback* pb);
28 
30  CueList(JSONNode node, Playback* pb);
31 
32  // Delete the cue list
33  ~CueList();
34 
35  // Stores a cue in the list.
36  // Returns false if there's already a cue with the given number in the map.
37  // Set overwrite to true to force.
38  bool storeCue(float num, string cueID, bool overwrite = false);
39 
40  // Delets a cue. Does not delete the Cue object from the playback controls by default
41  void deleteCue(float num, bool totalDelete = false);
42 
43  // Updates a cue and tracks changes.
44  // Set track to true if tracking desired.
45  // This function is a bit more complicated at the moment
46  //void update(float num, Rig* rig, bool track = false);
47 
48  // Gets the list of cue numbers
49  const map<float, string>& getCueList() { return _cues; }
50 
56  float getFirstCueNum();
57 
58  string getFirstCue();
59 
65  float getLastCueNum();
66 
67  string getLastCue();
68 
69  // Gets a cue and allows user to modify it.
70  Cue* getCue(float num);
71  string getCueName(float num);
72 
73  // Gets the next cue in the list
74  // If the given cue number isn't in the list, returns nullptr
75  string getNextCue(float num);
76 
77  // Same as getNextCue but returns the cue number.
78  // If the given cue number isn't in the list, returns -1
79  float getNextCueNum(float num);
80 
86  string getPrevCue(float num);
87 
93  float getPrevCueNum(float num);
94 
95  // For those who need to access a cue by indexing into an array
96  // we've got you covered.
97  float getCueNumAtIndex(int index);
98 
100  void setName(string name) { _name = name; }
101 
103  string getName() { return _name; }
104 
108  JSONNode toJSON();
109 
110 private:
111  // List of cues. Cue numbers can be floats.
112  map<float, string> _cues;
113 
115  string _name;
116 
119 };
120 
121 }
122 }
123 #endif
float getPrevCueNum(float num)
Gets the number of the previous cue in the list.
Definition: CueList.cpp:163
Include file for all of LumiverseCore in one conveninent location.
string getPrevCue(float num)
Gets the previous cue in the list.
Definition: CueList.cpp:152
float getFirstCueNum()
Gets the number of the first cue.
Definition: CueList.cpp:80
Definition: CueList.h:23
float getLastCueNum()
Gets the number of the last cue.
Definition: CueList.cpp:96
CueList(string name, Playback *pb)
Make a new empty cue list.
Definition: CueList.cpp:6
A playback object manages layers, timelines, and coordinates their actions and updates.
Definition: Playback.h:32
Playback * _pb
Pointer to Playback object that contains the actual cue data.
Definition: CueList.h:118
string _name
Name of the list.
Definition: CueList.h:115
JSONNode toJSON()
Returns the JSON representation of the cue list.
Definition: CueList.cpp:184
Contains all core Lumiverse functions and variables.
Definition: Device.cpp:2
void setName(string name)
Sets the name of the cue list.
Definition: CueList.h:100
string getName()
Gets the name of the cue list.
Definition: CueList.h:103
A cue stores data for a particular look (called a cue)
Definition: Cue.h:31