00001 00016 #ifndef CONTROLLERUTIL_H_ 00017 #define CONTROLLERUTIL_H_ 00018 00019 #include <vector> 00020 00021 class ControllerUtil { 00022 public: 00023 struct HistoryMap; 00024 public: 00025 00026 // ControllerUtil(); 00027 00028 // virtual ~ControllerUtil(); 00029 00030 static float computeAverage(HistoryMap* histMap, float currentValue); 00031 00032 static int computeAverageClassification(HistoryMap* histMap, float currentValue); 00033 00034 HistoryMap* NewHistoryMap(int pSize, float pDefaultValue) { 00035 return new HistoryMap(pSize, pDefaultValue); }; 00036 00037 static void print(HistoryMap *histMap); 00038 00039 public: 00040 00045 struct HistoryMap { 00047 std::vector<float> history; 00049 int historySize; 00051 int currentValueIndex; 00053 float defaultValue; 00055 HistoryMap(int hSize, float hDefaultValue): 00056 history(hSize), 00057 historySize(hSize), 00058 currentValueIndex(0), 00059 defaultValue(hDefaultValue) 00060 { 00061 for (int x = 0; x < historySize; ++x) 00062 history[x] = 0.0; 00063 } 00064 }; 00065 00066 }; 00067 00068 #endif /* CONTROLLERUTIL_H_ */
1.6.1