volt_distr_creator.h
Go to the documentation of this file.
00001 /*
00002  * volt_distr_creator.h
00003  * Copyright 2013 University of Massachusetts Lowell
00004  * Author: Jonathan Hasenzahl
00005  */
00006 
00007 #ifndef VOLT_DISTR_CREATOR_H_
00008 #define VOLT_DISTR_CREATOR_H_
00009 
00010 #include "neuro_recv/dish_state.h"
00011 #include <map>
00012 #include <vector>
00013 #include <fstream>
00014 
00020 double truncate(double val)
00021 {
00022     if (val > 0)
00023         return floor(val * 10000) / 10000;
00024     else if (val < 0)
00025         return ceil(val * 10000) / 10000;
00026     else
00027         return val;
00028 }
00029 
00038 class VoltDistrCreator
00039 {
00040 public:
00041     VoltDistrCreator();
00042 
00043     void add(const neuro_recv::dish_state& d);
00044     void toFile(const std::string& file_path);
00045     boost::array<double, 60> getPercents();
00046 
00047     void setDoTruncateVolts(int i) { do_truncate_volts_ = i; }
00048 
00049 private:
00050     std::map<double, std::vector<int> > volts_;
00051     std::ofstream log_file_;
00052     bool do_truncate_volts_;
00053     boost::array<int, 60> negatives_;
00054     int total_dishes_;
00055 };
00056 
00057 #endif


volt_distr
Author(s): Jonathan Hasenzahl
autogenerated on Sun Jan 5 2014 11:12:31