2 * tunableConst - a system parameter that we might one to change during
3 * execution of the system.
5 * $Log: tunableConst.C,v $
6 * Revision 1.3 1994/08/03 18:37:39 hollings
7 * split tunable constant into Boolean and Float sub-classes.
9 * Revision 1.2 1994/02/28 23:58:38 hollings
10 * Changed global list to be a pointer to a list because I couldn't rely on
11 * the order of global constructors.
13 * Revision 1.1 1994/02/25 00:26:17 hollings
14 * added tuntable constants
19 #include "util/h/stringPool.h"
20 #include "util/h/tunableConst.h"
22 List<tunableConstant*> *tunableConstant::allConstants;
23 stringPool *tunableConstant::pool;
25 tunableBooleanConstant::tunableBooleanConstant(Boolean initialValue,
26 booleanChangeValCallBackFunc cb,
34 typeName = tunableBoolean;
36 if (!pool) pool = new(stringPool);
37 name = pool->findAndAdd(n);
38 newValueCallBack = cb;
39 if (!allConstants) allConstants = new(List<tunableConstant*>);
40 allConstants->add(this, name);
43 void tunableBooleanConstant::print()
45 cout << name << " = ";
53 Boolean tunableFloatConstant::simpleRangeCheck(float val)
55 return((val >= min) && (val <= max));
58 tunableFloatConstant::tunableFloatConstant(float initialValue,
61 floatChangeValCallBackFunc cb,
72 typeName = tunableFloat;
73 newValueCallBack = cb;
75 if (!pool) pool = new(stringPool);
76 name = pool->findAndAdd(n);
77 if (!allConstants) allConstants = new(List<tunableConstant*>);
78 allConstants->add(this, name);
81 tunableFloatConstant::tunableFloatConstant(float initialValue,
83 floatChangeValCallBackFunc cb,
90 typeName = tunableFloat;
93 newValueCallBack = cb;
95 if (!pool) pool = new(stringPool);
96 name = pool->findAndAdd(n);
97 if (!allConstants) allConstants = new(List<tunableConstant*>);
98 allConstants->add(this, name);
101 void tunableFloatConstant::print()
103 cout << name << " = " << value << "\n";