RPC_undo_arg_list expects reference args, not pointers.
[dyninst.git] / pdutil / h / tunableConst.h
1 /*
2  * tunableConstant - a constant that might be changed during execution.
3  *
4  * $Log: tunableConst.h,v $
5  * Revision 1.1  1994/02/25 00:25:58  hollings
6  * added tunable constants.
7  *
8  *
9  */
10 #ifndef TUNABLE_CONST_H
11 #define TUNABLE_CONST_H
12
13 #include "util/h/list.h"
14
15 typedef Boolean (*isValidFunc)(float newVale);
16 typedef void (*changeValCallBackFunc)(float value);
17
18 class tunableConstant {
19     public:
20         tunableConstant(float initialValue, 
21                         float min, 
22                         float max, 
23                         changeValCallBackFunc cb,
24                         char *name,
25                         char *desc);
26         tunableConstant(float initialValue, 
27                         isValidFunc, 
28                         changeValCallBackFunc cb,
29                         char *name,
30                         char *desc);
31         float getValue() { return value; }
32         char *getDesc() { return(desc); }
33         char *getName() { return(name); }
34         Boolean setValue(float newVal) {
35             if ((isValidValue) && isValidValue(newVal)) {
36                 if (newValueCallBack) newValueCallBack(newVal);
37                 return(TRUE);
38             } else if (simpleRangeCheck(newVal)) {
39                 if (newValueCallBack) newValueCallBack(newVal);
40                 return(TRUE);
41             } else {
42                 return(FALSE);
43             }
44         }
45     private:
46         char *desc;
47         char *name;
48         float value;
49         float min, max;
50         isValidFunc isValidValue;
51         Boolean simpleRangeCheck(float val);
52         changeValCallBackFunc newValueCallBack;
53         static List<tunableConstant*> allConstants;
54 };
55
56 #endif