@@ -41,16 +41,16 @@ class Plotter
4141 Add a 1-variable graph vs. time
4242
4343 Args:
44- - title: String with title of graph
44+ - title: const char * with title of graph
4545 - pointsDisplayed: number of points to be shown at a given time. Used to control time-scaling
46- - labelA: String with label of the plotted variable
46+ - labelA: const char * with label of the plotted variable
4747 - refA: reference to global variable that will be updated throughout program
4848
4949 Similar methods for multi-variable graphing vs. time are declared below and follow the same format
5050 */
5151 template <typename A>
52- void AddTimeGraph ( String title, int pointsDisplayed,
53- String labelA, A & refA )
52+ void AddTimeGraph ( const char * title, int pointsDisplayed,
53+ const char * labelA, A & refA )
5454 {
5555 VariableWrapper * wrappers = new VariableWrapper[1 ];
5656 wrappers[0 ] = VariableWrapper ( labelA, static_cast <void *>( &refA ), &Dereference<A>, " green" );
@@ -61,16 +61,16 @@ class Plotter
6161 Add an X vs. Y graph
6262
6363 Args:
64- - title: String with title of graph
64+ - title: const char * with title of graph
6565 - pointsDisplayed: number of points to be shown at a given time. Determines duration of data persistance
66- - labelX: String with label of variable to be plotted along X-axis
66+ - labelX: const char * with label of variable to be plotted along X-axis
6767 - refX: reference to global X-variable that will be updated throughout program
68- - labelY: String with label of variable to be plotted along Y-axis
68+ - labelY: const char * with label of variable to be plotted along Y-axis
6969 - refY: reference to global Y-variable that will be updated throughout program
7070 */
7171 template <typename X, typename Y>
72- void AddXYGraph ( String title, int pointsDisplayed,
73- String labelX, X & refX, String labelY, Y & refY )
72+ void AddXYGraph ( const char * title, int pointsDisplayed,
73+ const char * labelX, X & refX, const char * labelY, Y & refY )
7474 {
7575 VariableWrapper * wrappers = new VariableWrapper[2 ];
7676 wrappers[0 ] = VariableWrapper ( labelX, static_cast <void *>( &refX ), &Dereference<X>, " green" );
@@ -107,12 +107,12 @@ class Plotter
107107 Returns:
108108 - true, if successful
109109 */
110- bool SetColor ( int index, String colorA );
110+ bool SetColor ( int index, const char * colorA );
111111
112112 // Add a 2-variable graph vs. time
113113 template <typename A, typename B>
114- void AddTimeGraph ( String title, int pointsDisplayed,
115- String labelA, A & refA, String labelB, B & refB )
114+ void AddTimeGraph ( const char * title, int pointsDisplayed,
115+ const char * labelA, A & refA, const char * labelB, B & refB )
116116 {
117117 VariableWrapper * wrappers = new VariableWrapper[2 ];
118118 wrappers[0 ] = VariableWrapper ( labelA, static_cast <void *>( &refA ), &Dereference<A>, " green" );
@@ -122,8 +122,8 @@ class Plotter
122122
123123 // Add a 3-variable graph vs. time
124124 template <typename A, typename B, typename C>
125- void AddTimeGraph ( String title, int pointsDisplayed,
126- String labelA, A & refA, String labelB, B & refB, String labelC, C & refC )
125+ void AddTimeGraph ( const char * title, int pointsDisplayed,
126+ const char * labelA, A & refA, const char * labelB, B & refB, const char * labelC, C & refC )
127127 {
128128 VariableWrapper * wrappers = new VariableWrapper[3 ];
129129 wrappers[0 ] = VariableWrapper ( labelA, static_cast <void *>( &refA ), &Dereference<A>, " green" );
@@ -134,9 +134,9 @@ class Plotter
134134
135135 // Add a 4-variable graph vs. time
136136 template <typename A, typename B, typename C, typename D>
137- void AddTimeGraph ( String title, int pointsDisplayed,
138- String labelA, A & refA, String labelB, B & refB, String labelC, C & refC,
139- String labelD, D & refD )
137+ void AddTimeGraph ( const char * title, int pointsDisplayed,
138+ const char * labelA, A & refA, const char * labelB, B & refB, const char * labelC, C & refC,
139+ const char * labelD, D & refD )
140140 {
141141 VariableWrapper * wrappers = new VariableWrapper[4 ];
142142 wrappers[0 ] = VariableWrapper ( labelA, static_cast <void *>( &refA ), &Dereference<A>, " green" );
@@ -148,9 +148,9 @@ class Plotter
148148
149149 // Add a 5-variable graph vs. time
150150 template <typename A, typename B, typename C, typename D, typename E>
151- void AddTimeGraph ( String title, int pointsDisplayed,
152- String labelA, A & refA, String labelB, B & refB, String labelC, C & refC,
153- String labelD, D & refD, String labelE, E & refE )
151+ void AddTimeGraph ( const char * title, int pointsDisplayed,
152+ const char * labelA, A & refA, const char * labelB, B & refB, const char * labelC, C & refC,
153+ const char * labelD, D & refD, const char * labelE, E & refE )
154154 {
155155 VariableWrapper * wrappers = new VariableWrapper[5 ];
156156 wrappers[0 ] = VariableWrapper ( labelA, static_cast <void *>( &refA ), &Dereference<A>, " green" );
@@ -163,9 +163,9 @@ class Plotter
163163
164164 // Add a 6-variable graph vs. time
165165 template <typename A, typename B, typename C, typename D, typename E, typename F>
166- void AddTimeGraph ( String title, int pointsDisplayed,
167- String labelA, A & refA, String labelB, B & refB, String labelC, C & refC,
168- String labelD, D & refD, String labelE, E & refE, String labelF, F & refF )
166+ void AddTimeGraph ( const char * title, int pointsDisplayed,
167+ const char * labelA, A & refA, const char * labelB, B & refB, const char * labelC, C & refC,
168+ const char * labelD, D & refD, const char * labelE, E & refE, const char * labelF, F & refF )
169169 {
170170 VariableWrapper * wrappers = new VariableWrapper[6 ];
171171 wrappers[0 ] = VariableWrapper ( labelA, static_cast <void *>( &refA ), &Dereference<A>, " green" );
@@ -178,14 +178,14 @@ class Plotter
178178 }
179179
180180 // Set Colors for multivariable graphs
181- bool SetColor ( int index, String colorA, String colorB );
182- bool SetColor ( int index, String colorA, String colorB, String colorC );
183- bool SetColor ( int index, String colorA, String colroB, String colorC,
184- String colorD );
185- bool SetColor ( int index, String colorA, String colroB, String colorC,
186- String colorD, String colorE );
187- bool SetColor ( int index, String colorA, String colroB, String colorC,
188- String colorD, String colorE, String colorF );
181+ bool SetColor ( int index, const char * colorA, const char * colorB );
182+ bool SetColor ( int index, const char * colorA, const char * colorB, const char * colorC );
183+ bool SetColor ( int index, const char * colorA, const char * colroB, const char * colorC,
184+ const char * colorD );
185+ bool SetColor ( int index, const char * colorA, const char * colroB, const char * colorC,
186+ const char * colorD, const char * colorE );
187+ bool SetColor ( int index, const char * colorA, const char * colroB, const char * colorC,
188+ const char * colorD, const char * colorE, const char * colorF );
189189
190190 // Destructor for Plotter class
191191 ~Plotter ();
@@ -197,17 +197,17 @@ class Plotter
197197 {
198198 public:
199199 VariableWrapper ();
200- VariableWrapper ( String label, void * ref, double ( * deref )( void * ), String color );
200+ VariableWrapper ( const char * label, void * ref, double ( * deref )( void * ), const char * color );
201201
202- String GetLabel ();
202+ const char * GetLabel ();
203203 double GetValue ();
204- String GetColor ();
205- void SetColor ( String col );
204+ const char * GetColor ();
205+ void SetColor ( const char * col );
206206
207207 private:
208208 // Data
209- String label;
210- String color;
209+ const char * label;
210+ const char * color;
211211 void * ref;
212212 double ( * deref )( void * );
213213
@@ -219,10 +219,10 @@ class Plotter
219219 class Graph
220220 {
221221 public:
222- Graph (String title, VariableWrapper * wrappers, int size, bool xvy, int pointsDisplayed);
222+ Graph (const char * title, VariableWrapper * wrappers, int size, bool xvy, int pointsDisplayed);
223223 ~Graph ();
224224 void Plot ( bool config );
225- bool SetColor ( int sz, String * colors );
225+ bool SetColor ( int sz, const char * * colors );
226226
227227 // Data
228228 Graph * next;
@@ -231,15 +231,15 @@ class Plotter
231231 bool xvy;
232232 int size;
233233 int pointsDisplayed;
234- String title;
234+ const char * title;
235235 VariableWrapper * wrappers;
236236
237237 }; // -- Graph
238238
239239private:
240240 // Helpers
241- void AddGraphHelper ( String title, VariableWrapper * wrappers, int sz, bool xvy, int pointsDisplayed );
242- bool SetColorHelper ( int index, int sz, String * colors );
241+ void AddGraphHelper ( const char * title, VariableWrapper * wrappers, int sz, bool xvy, int pointsDisplayed );
242+ bool SetColorHelper ( int index, int sz, const char * * colors );
243243
244244 template <typename T>
245245 static double Dereference ( void * ref )
@@ -261,17 +261,17 @@ class Plotter
261261static const int CONFIG_INTERVAL = 50 ;
262262
263263// Transmission Keys
264- static const String OUTER_KEY = " #" ;
265- static const String TIME_KEY = " t" ;
266- static const String NUM_GRAPH_KEY = " ng" ;
267- static const String LAST_UPDATED_KEY = " lu" ;
268- static const String GRAPHS_KEY = " g" ;
269- static const String TITLE_KEY = " t" ;
270- static const String XVY_KEY = " xvy" ;
271- static const String POINTS_DISPLAYED_KEY = " pd" ;
272- static const String SIZE_KEY = " sz" ;
273- static const String LABELS_KEY = " l" ;
274- static const String COLORS_KEY = " c" ;
275- static const String DATA_KEY = " d" ;
264+ static const char * OUTER_KEY = " #" ;
265+ static const char * TIME_KEY = " t" ;
266+ static const char * NUM_GRAPH_KEY = " ng" ;
267+ static const char * LAST_UPDATED_KEY = " lu" ;
268+ static const char * GRAPHS_KEY = " g" ;
269+ static const char * TITLE_KEY = " t" ;
270+ static const char * XVY_KEY = " xvy" ;
271+ static const char * POINTS_DISPLAYED_KEY = " pd" ;
272+ static const char * SIZE_KEY = " sz" ;
273+ static const char * LABELS_KEY = " l" ;
274+ static const char * COLORS_KEY = " c" ;
275+ static const char * DATA_KEY = " d" ;
276276
277277#endif
0 commit comments