/* * StatisticData.hh * * Created on: Nov 08, 2014 * Author: AKKA */ #ifndef STATISTICDATA_HH_ #define STATISTICDATA_HH_ #include namespace AMDA { namespace Parameters { template struct StatisticDataScalar { Type _result; int _nbDataProcessed; }; template using StatisticDataVector = std::vector>; template using StatisticDataMatrix = std::vector>> ; template void pushStatisticDataInVectorString(std::vector &result, std::vector &coverage, StatisticDataScalar data, int ideal, bool isCoverageIndependantOfResultType, int /* index */) { //push result std::stringstream res; res << data._result; result.push_back(res.str()); //push coverage if (isCoverageIndependantOfResultType && (coverage.size() >= 1)) return; double c = (double)data._nbDataProcessed / (double)ideal; if (c < 0.) c = 0.; if (c > 1.) c = 1.; std::stringstream cov; cov << c; coverage.push_back(cov.str()); } template void pushStatisticDataInVectorString(std::vector &result, std::vector &coverage, StatisticDataVector data, int ideal, bool isCoverageIndependantOfResultType, int index) { for (int i = 0; i < (int)data.size(); ++i) { if ((index >= 0) && (index != (int)i)) continue; pushStatisticDataInVectorString(result, coverage, data[i], ideal, isCoverageIndependantOfResultType, -1); } } template void pushStatisticDataInVectorString(std::vector &result, std::vector &coverage, StatisticDataMatrix data, int ideal, bool isCoverageIndependantOfResultType, int index) { for (int i = 0; i < (int)data.size(); ++i) { for (int j = 0; j < (int)data[i].size(); ++j) { if ((index >= 0) && (index != i*(int)data.size()+j)) continue; pushStatisticDataInVectorString(result, coverage, data[i][j], ideal, isCoverageIndependantOfResultType, -1); } } } } /* namespace Parameters */ } /* namespace AMDA */ #endif