1 // $Id: setget.h,v 1.45 2011/03/07 06:08:53 bobgian Exp $
2 
3 /*
4  *  Copyright 2002  Peter Beerli, Mary Kuhner, Jon Yamato and Joseph Felsenstein
5  *
6  *  This software is distributed free of charge for non-commercial use
7  *  and is copyrighted.  Of course, we do not guarantee that the software
8  *  works, and are not responsible for any damage you may cause or have.
9  *
10  */
11 
12 #ifndef SETGET_H
13 #define SETGET_H
14 
15 #include <cassert>
16 #include <string>
17 
18 #include "constants.h"
19 #include "datatype.h"
20 #include "errhandling.h"
21 #include "parameter.h"
22 #include "stringx.h"
23 #include "rangex.h"
24 #include "ui_constants.h"
25 #include "ui_id.h"
26 #include "paramstat.h"
27 
28 //------------------------------------------------------------------------------------
29 
30 class UIVars;
31 
32 // Classes defined here are for setting and getting values
33 // from the "backend" code.
34 
35 // very basic virtual class. The parent of all SetGetTemplate<> objects
36 class SetGet
37 {
38   protected:
39     const std::string & uikey;
40   public:
SetGet(const std::string & key)41     SetGet(const std::string & key) : uikey(key) {};
~SetGet()42     virtual ~SetGet() {};
43     // UIKey should be unique -- it is used to create and
44     // access a single instance of this Getter/Setter
45     // and should describe what this getter/setter gets/sets
46     // Each should be defined as a constant string in the
47     // uistr class
UIKey()48     virtual const string & UIKey()
49     { return uikey;};
50     // Get a string describing what will be set/gotten
Description(UIVars & vars,UIId id)51     virtual string Description(UIVars& vars, UIId id)
52     { return UIKey();};
53     //Get a string describing the min/max values possible.
Min(UIVars & vars,UIId id)54     virtual string Min(UIVars& vars, UIId id) { return ToString(FLAGDOUBLE);};
Max(UIVars & vars,UIId id)55     virtual string Max(UIVars& vars, UIId id) { return ToString(FLAGDOUBLE);};
56     // Get a string that represents the value stored in the backend
57     virtual std::string GetPrintString(UIVars& vars, UIId id) = 0;
NextToggleValue(UIVars & vars,UIId id)58     virtual std::string NextToggleValue(UIVars& vars, UIId id)
59     { throw implementation_error("no toggle possible");};
60     // returns true if the values associated with id for this
61     // menu item are internally consistent -- used to verify
62     // that two or more values are mutually OK.
IsConsistent(UIVars & vars,UIId id)63     virtual bool IsConsistent(UIVars& vars, UIId id)
64     {
65         return true;
66     };
SetFromString(UIVars & vars,UIId id,string stringVal)67     virtual void SetFromString(UIVars& vars, UIId id, string stringVal)
68     { throw implementation_error("no SetFromString possible");};
69 };
70 
71 //------------------------------------------------------------------------------------
72 // Basic methods instructing how to get and set a single
73 // value.
74 template<class ValType>
75 class GetTemplate : public SetGet
76 {
77   public:
GetTemplate(const std::string & key)78     GetTemplate(const std::string & key): SetGet(key) {};
~GetTemplate()79     virtual ~GetTemplate() {};
80     // reaches into the backend code to get a single value
81     virtual ValType Get(UIVars& vars, UIId id) = 0;
82     // default implementation -- makes a menu-printable string
83     // out of the id'th associated variable
GetPrintString(UIVars & vars,UIId id)84     virtual std::string GetPrintString(UIVars& vars, UIId id)
85     { return MakePrintString(vars,Get(vars,id));};
86     // how these values should be printed out
MakePrintString(UIVars & vars,ValType v)87     virtual std::string MakePrintString(UIVars& vars,ValType v)
88     { return ToString(v);};
89 };
90 
91 template<class ValType>
92 class SetGetTemplate : public GetTemplate<ValType>
93 {
94   public:
SetGetTemplate(const std::string & key)95     SetGetTemplate(const std::string & key): GetTemplate<ValType>(key) {};
~SetGetTemplate()96     virtual ~SetGetTemplate() {};
97     // reaches into the backend code to set a single value
98     virtual void Set(UIVars& vars,UIId id,ValType value) = 0;
99     // converts stringVal to ValType and uses ::Set
SetFromString(UIVars & vars,UIId id,string stringVal)100     virtual void SetFromString(UIVars& vars, UIId id, string stringVal)
101     { Set(vars,id,GetValFromString(vars,stringVal));};
102     // GetValFromString converts a string to ValType
103     virtual ValType GetValFromString(UIVars&,string) = 0;
104 
105 };
106 
107 //------------------------------------------------------------------------------------
108 // Refinement of GetTemplate<bool> defines only how to get
109 // a bool value from string input. All classes getting
110 // a bool value should inherit from this one.
111 class GetBool : public GetTemplate<bool>
112 {
113   public:
GetBool(const std::string & key)114     GetBool(const std::string & key)
115         : GetTemplate<bool>(key) {};
~GetBool()116     virtual ~GetBool() {};
117 };
118 
119 //------------------------------------------------------------------------------------
120 // Refinement of GetTemplate<data_type>
121 class GetDataType : public GetTemplate<data_type>
122 {
123   public:
GetDataType(const std::string & key)124     GetDataType(const std::string & key)
125         : GetTemplate<data_type>(key) {};
~GetDataType()126     virtual ~GetDataType() {};
127 };
128 
129 //------------------------------------------------------------------------------------
130 // Refinement of GetTemplate<DoubleVec1d> defines only how to get
131 // a DoubleVec1d value from string input. All classes getting
132 // a DoubleVec1d value should inherit from this one.
133 class GetDoubleVec1d : public GetTemplate<DoubleVec1d>
134 {
135   public:
GetDoubleVec1d(const std::string & key)136     GetDoubleVec1d(const std::string & key)
137         : GetTemplate<DoubleVec1d>(key) {};
~GetDoubleVec1d()138     virtual ~GetDoubleVec1d() {};
139 };
140 
141 //------------------------------------------------------------------------------------
142 // Refinement of GetTemplate<ForceTypeVec1d> defines only how to get
143 // a ForceTypeVec1d value from string input. All classes getting
144 // a ForceTypeVec1d value should inherit from this one.
145 class GetForceTypeVec1d : public GetTemplate<ForceTypeVec1d>
146 {
147   public:
GetForceTypeVec1d(const std::string & key)148     GetForceTypeVec1d(const std::string & key)
149         : GetTemplate<ForceTypeVec1d>(key) {};
~GetForceTypeVec1d()150     virtual ~GetForceTypeVec1d() {};
151 };
152 
153 //------------------------------------------------------------------------------------
154 // Refinement of GetTemplate<long int> defines only how to get
155 // a long int value from string input. All classes getting
156 // a long int value should inherit from this one.
157 class GetLong : public GetTemplate<long int>
158 {
159   public:
GetLong(const std::string & key)160     GetLong(const std::string & key)
161         : GetTemplate<long int>(key) {};
~GetLong()162     virtual ~GetLong() {};
163 };
164 
165 //------------------------------------------------------------------------------------
166 // Refinement of GetTemplate<LongVec1d> defines only how to get
167 // a LongVec1d value from string input. All classes getting
168 // a LongVec1d value should inherit from this one.
169 class GetLongVec1d : public GetTemplate<LongVec1d>
170 {
171   public:
GetLongVec1d(const std::string & key)172     GetLongVec1d(const std::string & key)
173         : GetTemplate<LongVec1d>(key) {};
~GetLongVec1d()174     virtual ~GetLongVec1d() {};
175 };
176 
177 //------------------------------------------------------------------------------------
178 // Refinement of GetTemplate<MethodTypeVec1d> defines only how to get
179 // a MethodTypeVec1d value from string input. All classes getting
180 // a MethodTypeVec1d value should inherit from this one.
181 class GetMethodTypeVec1d : public GetTemplate<MethodTypeVec1d>
182 {
183   public:
GetMethodTypeVec1d(const std::string & key)184     GetMethodTypeVec1d(const std::string & key)
185         : GetTemplate<MethodTypeVec1d>(key) {};
~GetMethodTypeVec1d()186     virtual ~GetMethodTypeVec1d() {};
187 };
188 
189 //------------------------------------------------------------------------------------
190 // Refinement of GetTemplate<paramlistcondition> defines only how to get
191 // a paramlistcondition value from string input. All classes getting
192 // a paramlistcondition value should inherit from this one.
193 class GetParamlistcondition : public GetTemplate<paramlistcondition>
194 {
195   public:
GetParamlistcondition(const std::string & key)196     GetParamlistcondition(const std::string & key)
197         : GetTemplate<paramlistcondition>(key) {};
~GetParamlistcondition()198     virtual ~GetParamlistcondition() {};
199 };
200 
201 //------------------------------------------------------------------------------------
202 // Refinement of GetTemplate<std::string> defines only how to get
203 // a std::string value from string input. All classes getting
204 // a std::string value should inherit from this one.
205 class GetString : public GetTemplate<std::string>
206 {
207   public:
GetString(const std::string & key)208     GetString(const std::string & key)
209         : GetTemplate<std::string>(key) {};
~GetString()210     virtual ~GetString() {};
211 };
212 
213 //------------------------------------------------------------------------------------
214 // Refinement of GetTemplate<StringVec1d> defines only how to get
215 // a StringVec1d value from string input. All classes getting
216 // a StringVec1d value should inherit from this one.
217 class GetStringVec1d : public GetTemplate<StringVec1d>
218 {
219   public:
GetStringVec1d(const std::string & key)220     GetStringVec1d(const std::string & key)
221         : GetTemplate<StringVec1d>(key) {};
~GetStringVec1d()222     virtual ~GetStringVec1d() {};
223 };
224 
225 //------------------------------------------------------------------------------------
226 // Refinement of GetTemplate<UIIdVec1d> defines only how to get
227 // a UIIdVec1d value from string input. All classes getting
228 // a UIIdVec1d value should inherit from this one.
229 class GetUIIdVec1d : public GetTemplate<UIIdVec1d>
230 {
231   public:
GetUIIdVec1d(const std::string & key)232     GetUIIdVec1d(const std::string & key)
233         : GetTemplate<UIIdVec1d>(key) {};
~GetUIIdVec1d()234     virtual ~GetUIIdVec1d() {};
235 };
236 
237 //------------------------------------------------------------------------------------
238 // Refinement of GetTemplate<UIIdVec2d> defines only how to get
239 // a UIIdVec2d value from string input. All classes getting
240 // a UIIdVec2d value should inherit from this one.
241 class GetUIIdVec2d : public GetTemplate<UIIdVec2d>
242 {
243   public:
GetUIIdVec2d(const std::string & key)244     GetUIIdVec2d(const std::string & key)
245         : GetTemplate<UIIdVec2d>(key) {};
~GetUIIdVec2d()246     virtual ~GetUIIdVec2d() {};
247 };
248 
249 //------------------------------------------------------------------------------------
250 // Refinement of SetGetTemplate<bool> defines only how to get
251 // a bool value from string input. All classes setting/getting
252 // a bool value should inherit from this one.
253 class SetGetBool : public SetGetTemplate<bool>
254 {
255   public:
SetGetBool(const std::string & key)256     SetGetBool(const std::string & key): SetGetTemplate<bool>(key) {};
~SetGetBool()257     virtual ~SetGetBool() {};
GetValFromString(UIVars & vars,string input)258     virtual bool GetValFromString(UIVars& vars,string input)
259     { return ProduceBoolOrBarf(input);};
NextToggleValue(UIVars & vars,UIId id)260     virtual std::string NextToggleValue(UIVars& vars,UIId id)
261     { bool v = Get(vars,id); return ToString(!v);};
262 };
263 
264 //------------------------------------------------------------------------------------
265 // Refinement of SetGetTemplate<double> defines only how to get
266 // a double value from string input. All classes setting/getting
267 // a double value should inherit from this one.
268 class SetGetDouble : public SetGetTemplate<double>
269 {
270   public:
SetGetDouble(const std::string & key)271     SetGetDouble(const std::string & key): SetGetTemplate<double>(key) {};
~SetGetDouble()272     virtual ~SetGetDouble() {};
GetValFromString(UIVars & vars,string input)273     virtual double GetValFromString(UIVars& vars,string input)
274     { return ProduceDoubleOrBarf(input);};
275 };
276 
277 //------------------------------------------------------------------------------------
278 // Refinement of SetGetTemplate<growth_scheme> defines only how to get
279 // a growth_scheme value from string input. All classes setting/getting
280 // a growth_scheme value should inherit from this one.
281 class SetGetGrowthScheme : public SetGetTemplate<growth_scheme>
282 {
283   public:
SetGetGrowthScheme(const std::string & key)284     SetGetGrowthScheme(const std::string & key): SetGetTemplate<growth_scheme>(key) {};
~SetGetGrowthScheme()285     virtual ~SetGetGrowthScheme() {};
GetValFromString(UIVars & vars,string input)286     virtual growth_scheme GetValFromString(UIVars& vars,string input)
287     { return ProduceGrowthSchemeOrBarf(input);};
288 };
289 
290 //------------------------------------------------------------------------------------
291 // Refinement of SetGetTemplate<growth_type> defines only how to get
292 // a growth_type value from string input. All classes setting/getting
293 // a growth_type value should inherit from this one.
294 class SetGetGrowthType : public SetGetTemplate<growth_type>
295 {
296   public:
SetGetGrowthType(const std::string & key)297     SetGetGrowthType(const std::string & key): SetGetTemplate<growth_type>(key) {};
~SetGetGrowthType()298     virtual ~SetGetGrowthType() {};
GetValFromString(UIVars & vars,string input)299     virtual growth_type GetValFromString(UIVars& vars,string input)
300     { return ProduceGrowthTypeOrBarf(input);};
301 };
302 
303 //-------------------------------------------------------------------------------------
304 // Refinement of SetGetTemplate<selection_type> defines only how to get
305 // a selection_type value from string input. All classes setting/getting
306 // a selection_type value should inherit from this one.
307 class SetGetSelectionType : public SetGetTemplate<selection_type>
308 {
309   public:
SetGetSelectionType(const std::string & key)310     SetGetSelectionType(const std::string & key): SetGetTemplate<selection_type>(key) {};
~SetGetSelectionType()311     virtual ~SetGetSelectionType() {};
GetValFromString(UIVars & vars,string input)312     virtual selection_type GetValFromString(UIVars& vars,string input)
313     { return ProduceSelectionTypeOrBarf(input);};
314 };
315 
316 //------------------------------------------------------------------------------------
317 // Refinement of SetGetTemplate<long int> defines only how to get
318 // a long int value from string input. All classes setting/getting
319 // a long int value should inherit from this one.
320 class SetGetLong : public SetGetTemplate<long int>
321 {
322   public:
SetGetLong(const std::string & key)323     SetGetLong(const std::string & key): SetGetTemplate<long int>(key) {};
~SetGetLong()324     virtual ~SetGetLong() {};
GetValFromString(UIVars & vars,string input)325     virtual long int GetValFromString(UIVars& vars,string input)
326     { return ProduceLongOrBarf(input);};
327 };
328 
329 //------------------------------------------------------------------------------------
330 // Refinement of SetGetTemplate<method_type> defines only how to get
331 // a method_type value from string input. All classes setting/getting
332 // a method_type value should inherit from this one.
333 class SetGetMethodType : public SetGetTemplate<method_type>
334 {
335   public:
SetGetMethodType(const std::string & key)336     SetGetMethodType(const std::string & key): SetGetTemplate<method_type>(key) {};
~SetGetMethodType()337     virtual ~SetGetMethodType() {};
GetValFromString(UIVars & vars,string input)338     virtual method_type GetValFromString(UIVars& vars,string input)
339     { return ProduceMethodTypeOrBarf(input);};
340 };
341 
342 //------------------------------------------------------------------------------------
343 // Refinement of SetGetTemplate<string> defines only how to get
344 // a string value from string input. All classes setting/getting
345 // a string value should inherit from this one.
346 class SetGetString : public SetGetTemplate<std::string>
347 {
348   public:
SetGetString(const std::string & key)349     SetGetString(const std::string & key): SetGetTemplate<std::string>(key) {};
~SetGetString()350     virtual ~SetGetString() {};
GetValFromString(UIVars & vars,string input)351     virtual string GetValFromString(UIVars& vars,string input)
352     { return input;};
353 };
354 
355 //------------------------------------------------------------------------------------
356 // Refinement of SetGetTemplate<model_type> defines only how to get
357 // a string value from model_type input. All classes setting/getting
358 // a model_type value should inherit from this one.
359 class SetGetModelType : public SetGetTemplate<model_type>
360 {
361   public:
SetGetModelType(const std::string & key)362     SetGetModelType(const std::string & key): SetGetTemplate<model_type>(key) {};
~SetGetModelType()363     virtual ~SetGetModelType() {};
GetValFromString(UIVars & vars,string input)364     virtual model_type GetValFromString(UIVars& vars,string input)
365     { return ProduceModelTypeOrBarf(input);};
366 };
367 
368 //------------------------------------------------------------------------------------
369 // Refinement of SetGetTemplate<proftype> defines only how to get
370 // a string value from proftype input. All classes setting/getting
371 // a proftype value should inherit from this one.
372 class SetGetProftype : public SetGetTemplate<proftype>
373 {
374   public:
SetGetProftype(const std::string & key)375     SetGetProftype(const std::string & key): SetGetTemplate<proftype>(key) {};
~SetGetProftype()376     virtual ~SetGetProftype() {};
GetValFromString(UIVars & vars,string input)377     virtual proftype GetValFromString(UIVars& vars,string input)
378     { return ProduceProftypeOrBarf(input);};
NextToggleValue(UIVars & vars,UIId id)379     virtual std::string NextToggleValue(UIVars& vars,UIId id)
380     {
381         switch(Get(vars,id))
382         {
383             case profile_NONE:
384                 return ToString(profile_FIX);
385                 break;
386             case profile_FIX:
387                 return ToString(profile_PERCENTILE);
388                 break;
389             case profile_PERCENTILE:
390                 return ToString(profile_NONE);
391                 break;
392         }
393         return "UNKNOWN";  // should not happen; this line was
394         // added to silence compiler warning
395     };
396 };
397 
398 class SetGetIndividualParamstatus : public SetGetTemplate<ParamStatus>
399 {
400   public:
SetGetIndividualParamstatus(const std::string & key)401     SetGetIndividualParamstatus(const std::string & key): SetGetTemplate<ParamStatus>(key) {};
~SetGetIndividualParamstatus()402     virtual ~SetGetIndividualParamstatus() {};
GetValFromString(UIVars & vars,string input)403     virtual ParamStatus GetValFromString(UIVars& vars,string input)
404     { return ProduceParamstatusOrBarf(input);};
NextToggleValue(UIVars & vars,UIId id)405     virtual std::string NextToggleValue(UIVars& vars,UIId id)
406     {
407         return (Get(vars,id).ToggleIndividualStatus(id.GetForceType()));
408     };
409 };
410 
411 class SetGetGroupParamstatus : public SetGetTemplate<ParamStatus>
412 {
413   public:
SetGetGroupParamstatus(const std::string & key)414     SetGetGroupParamstatus(const std::string & key): SetGetTemplate<ParamStatus>(key) {};
~SetGetGroupParamstatus()415     virtual ~SetGetGroupParamstatus() {};
GetValFromString(UIVars & vars,string input)416     virtual ParamStatus GetValFromString(UIVars& vars,string input)
417     { return ProduceParamstatusOrBarf(input);};
NextToggleValue(UIVars & vars,UIId id)418     virtual std::string NextToggleValue(UIVars& vars,UIId id)
419     {
420         return (Get(vars,id).ToggleGroupStatus(id.GetForceType()));
421     };
422 };
423 
424 //------------------------------------------------------------------------------------
425 // Refinement of SetGetTemplate<verbosity_type> defines only how to get
426 // a string value from verbosity_type input. All classes setting/getting
427 // a verbosity_type value should inherit from this one.
428 class SetGetVerbosityType : public SetGetTemplate<verbosity_type>
429 {
430   public:
SetGetVerbosityType(const std::string & key)431     SetGetVerbosityType(const std::string & key)
432         : SetGetTemplate<verbosity_type>(key) {};
~SetGetVerbosityType()433     virtual ~SetGetVerbosityType() {};
GetValFromString(UIVars & vars,string input)434     virtual verbosity_type GetValFromString(UIVars& vars,string input)
435     { return ProduceVerbosityTypeOrBarf(input);};
NextToggleValue(UIVars & vars,UIId id)436     virtual std::string NextToggleValue(UIVars& vars, UIId id)
437     {
438         switch(Get(vars,id))
439         {
440             case NONE:
441                 return ToString(CONCISE);
442                 break;
443             case CONCISE:
444                 return ToString(NORMAL);
445                 break;
446             case NORMAL:
447                 return ToString(VERBOSE);
448                 break;
449             case VERBOSE:
450                 return ToString(NONE);
451                 break;
452         }
453         return "UNKNOWN";  // line should never be reached;
454         // it's here to silence compiler warnings
455     };
456 };
457 
458 //Since we want to exclude 'none' as an option for output file verbosity,
459 // this class sets NextToggleValue to skip over it (but can handle the case
460 // where it receives it as input, if, say, it was read in from the input file).
461 
462 class SetGetVerbosityTypeNoNone : public SetGetTemplate<verbosity_type>
463 {
464   public:
SetGetVerbosityTypeNoNone(const std::string & key)465     SetGetVerbosityTypeNoNone(const std::string & key)
466         : SetGetTemplate<verbosity_type>(key) {};
~SetGetVerbosityTypeNoNone()467     virtual ~SetGetVerbosityTypeNoNone() {};
GetValFromString(UIVars & vars,string input)468     virtual verbosity_type GetValFromString(UIVars& vars, string input)
469     { return ProduceVerbosityTypeOrBarf(input);};
NextToggleValue(UIVars & vars,UIId id)470     virtual std::string NextToggleValue(UIVars& vars, UIId id)
471     {
472         switch(Get(vars,id))
473         {
474             case NONE:
475                 return ToString(CONCISE);
476                 break;
477             case CONCISE:
478                 return ToString(NORMAL);
479                 break;
480             case NORMAL:
481                 return ToString(VERBOSE);
482                 break;
483             case VERBOSE:
484                 return ToString(CONCISE);
485                 break;
486         }
487         return "UNKNOWN";  // line should never be reached;
488         // it's here to silence compiler warnings
489     };
490 };
491 
492 //For now, there are only two possible prior types, but there may be more in
493 // the future.  If that changes, the bounds may need more information, too.
494 class SetGetPriorType : public SetGetTemplate<priortype>
495 {
496   public:
SetGetPriorType(const std::string & key)497     SetGetPriorType(const std::string & key)
498         : SetGetTemplate<priortype>(key) {};
~SetGetPriorType()499     virtual ~SetGetPriorType() {};
GetValFromString(UIVars & vars,string input)500     virtual priortype GetValFromString(UIVars& vars, string input)
501     { return ProducePriorTypeOrBarf(input);};
NextToggleValue(UIVars & vars,UIId id)502     virtual std::string NextToggleValue(UIVars& vars, UIId id)
503     {
504         switch(Get(vars,id))
505         {
506             case LINEAR:
507                 if (id.GetForceType()==force_GROW) {
508                     return ToString(LINEAR);
509                 }
510                 return ToString(LOGARITHMIC);
511                 break;
512             case LOGARITHMIC:
513                 return ToString(LINEAR);
514                 break;
515         }
516         return "UNKNOWN";  // line should never be reached;
517         // it's here to silence compiler warnings
518     };
519 };
520 
521 //------------------------------------------------------------------------------------
522 // Refinement of SetGetTemplate<LongVec1d> defines only how to get
523 // a LongVec1d value from string input. All classes setting/getting
524 // a LongVec1d value should inherit from this one.
525 class SetGetLongVec1d : public SetGetTemplate<LongVec1d>
526 {
527   public:
SetGetLongVec1d(const std::string & key)528     SetGetLongVec1d(const std::string & key)
529         : SetGetTemplate<LongVec1d>(key) {};
~SetGetLongVec1d()530     virtual ~SetGetLongVec1d() {};
GetValFromString(UIVars & vars,string input)531     virtual LongVec1d  GetValFromString(UIVars& vars, string input)
532     {   return ProduceLongVec1dOrBarf(input); };
533 };
534 
535 //------------------------------------------------------------------------------------
536 // Refinement of SetGetTemplate<ProftypeVec1d> defines only how to get
537 // a ProftypeVec1d value from string input. All classes setting/getting
538 // a ProftypeVec1d value should inherit from this one.
539 class SetGetProftypeVec1d : public SetGetTemplate<ProftypeVec1d>
540 {
541   public:
SetGetProftypeVec1d(const std::string & key)542     SetGetProftypeVec1d(const std::string & key)
543         : SetGetTemplate<ProftypeVec1d>(key) {};
~SetGetProftypeVec1d()544     virtual ~SetGetProftypeVec1d() {};
GetValFromString(UIVars & vars,string input)545     virtual ProftypeVec1d  GetValFromString(UIVars& vars, string input)
546     {   return ProduceProftypeVec1dOrBarf(input); };
547 };
548 
549 //------------------------------------------------------------------------------------
550 // Refinement of SetGetBool which prints "Enabled" for
551 // a true value and "Disabled" for a false one
552 class SetGetBoolEnabled : public SetGetBool
553 {
554   public:
SetGetBoolEnabled(const std::string & key)555     SetGetBoolEnabled(const std::string & key) : SetGetBool(key) {};
~SetGetBoolEnabled()556     virtual ~SetGetBoolEnabled() {};
MakePrintString(UIVars & vars,bool val)557     virtual std::string MakePrintString(UIVars& vars, bool val)
558     {
559         if(val) return "Enabled";
560         return "Disabled";
561     };
562 };
563 
564 //------------------------------------------------------------------------------------
565 // Refinement of SetGetBool which prints "On" for
566 // a true value and "Off" for a false one
567 class SetGetBoolOnOff : public SetGetBool
568 {
569   public:
SetGetBoolOnOff(const std::string & key)570     SetGetBoolOnOff(const std::string & key) : SetGetBool(key) {};
~SetGetBoolOnOff()571     virtual ~SetGetBoolOnOff() {};
MakePrintString(UIVars & vars,bool val)572     virtual std::string MakePrintString(UIVars& vars, bool val)
573     {
574         if(val) return "On";
575         return "Off";
576     };
577 };
578 
579 //------------------------------------------------------------------------------------
580 // Refinement of SetGetBool which prints "Write" for
581 // a true value and "Read" for a false one
582 class SetGetBoolReadWrite : public SetGetBool
583 {
584   public:
SetGetBoolReadWrite(const std::string & key)585     SetGetBoolReadWrite(const std::string & key) : SetGetBool(key) {};
~SetGetBoolReadWrite()586     virtual ~SetGetBoolReadWrite() {};
MakePrintString(UIVars & vars,bool val)587     virtual std::string MakePrintString(UIVars& vars, bool val)
588     {
589         if(val) return "Write";
590         return "Read";
591     };
592 };
593 
594 class SetGetNoval : public SetGetTemplate<noval>
595 {
596   public:
SetGetNoval(const std::string & key)597     SetGetNoval(const std::string & key)
598         : SetGetTemplate<noval>(key) {};
~SetGetNoval()599     virtual ~SetGetNoval() {};
Get(UIVars & vars,UIId id)600     virtual noval Get(UIVars& vars, UIId id) { return noval_none;};
GetValFromString(UIVars & vars,string input)601     virtual noval GetValFromString(UIVars& vars, string input)
602     { return noval_none;};
NextToggleValue(UIVars & vars,UIId id)603     virtual std::string NextToggleValue(UIVars& vars, UIId id)
604     { return ToString(noval_none);};
605 };
606 
607 class SetGetProftypeSeries : public SetGetProftype
608 {
609   public:
SetGetProftypeSeries(const std::string & key)610     SetGetProftypeSeries(const std::string & key)
611         : SetGetProftype(key) {};
~SetGetProftypeSeries()612     virtual ~SetGetProftypeSeries() {};
613 };
614 
615 #endif  // SETGET_H
616 
617 //____________________________________________________________________________________
618