CARMA C++
meanmed.h
Go to the documentation of this file.
1 
10 #ifndef CARMA_OBSERVERTOOLS_MEANMED_H
11 #define CARMA_OBSERVERTOOLS_MEANMED_H
12 
13 #include <vector>
14 #include <string>
15 #include <fstream>
16 
17 namespace carma{
18  namespace observertools{
19  class Meanmed
20  {
21  public:
25  Meanmed();
26 
29  ~Meanmed();
30 
34  void readFile(const std::string &fileName);
35 
38  void calculate();
39 
42  bool validate(std::string &value);
43 
44  private:
45 // adapted from numerical recipes
46  void siftDown(int i, int n);
47 // adapted from numerical recipes
48  void heapSort();
49  std::vector<float> data_;
50  float median_,sum_,min_,max_,sumsq_,mean_,sigma_;
51  };
52  }; // namespace observertools
53 }; // namespace carma
54 
55 #endif //CARMA_OBSERVERTOOLS_MEANMED_H