2 * tunableConstant - a constant that might be changed during execution.
4 * $Log: tunableConst.h,v $
5 * Revision 1.2 1994/02/28 23:58:28 hollings
6 * Changed global list to be a pointer to a list because I couldn't rely on
7 * the order of global constructors.
9 * Revision 1.1 1994/02/25 00:25:58 hollings
10 * added tunable constants.
14 #ifndef TUNABLE_CONST_H
15 #define TUNABLE_CONST_H
17 #include "util/h/stringPool.h"
18 #include "util/h/list.h"
20 typedef Boolean (*isValidFunc)(float newVale);
21 typedef void (*changeValCallBackFunc)(float value);
23 class tunableConstant {
25 tunableConstant(float initialValue,
28 changeValCallBackFunc cb,
31 tunableConstant(float initialValue,
33 changeValCallBackFunc cb,
36 float getValue() { return value; }
37 char *getDesc() { return(desc); }
38 char *getName() { return(name); }
39 Boolean setValue(float newVal) {
40 if ((isValidValue) && isValidValue(newVal)) {
42 if (newValueCallBack) newValueCallBack(newVal);
44 } else if (simpleRangeCheck(newVal)) {
46 if (newValueCallBack) newValueCallBack(newVal);
52 static List<tunableConstant*> *allConstants;
53 static stringPool *pool;
59 isValidFunc isValidValue;
60 Boolean simpleRangeCheck(float val);
61 changeValCallBackFunc newValueCallBack;