Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 066583bb authored by sarrazij's avatar sarrazij
Browse files

FIXED: std:: methods are properly called

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@644 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 68952b4a
...@@ -193,15 +193,15 @@ void convertMml::plotMonitor() ...@@ -193,15 +193,15 @@ void convertMml::plotMonitor()
if ( ui->mmlRadioButton->isChecked() ) { if ( ui->mmlRadioButton->isChecked() ) {
if ( ui->monitorListWidget->count() !=0 ) { if ( ui->monitorListWidget->count() !=0 ) {
// First stage is to compute a csv from ./mml2csv with files in the box above // First stage is to compute a csv from ./mml2csv with files in the box above
list <dataMonitoredList> monitors; std::list <dataMonitoredList> monitors;
for ( int i = 0; i< ui->monitorListWidget->count(); i++ ) { for ( int i = 0; i< ui->monitorListWidget->count(); i++ ) {
monitors.push_back ( dataMonitoredList ( ui->monitorListWidget->item ( i )->text().toStdString() ) ); monitors.push_back ( dataMonitoredList ( ui->monitorListWidget->item ( i )->text().toStdString() ) );
} }
list<string> mmlFiles; std::list<std::string> mmlFiles;
for ( int j = 0; j< ui->mmlListWidget->count(); j++ ) { for ( int j = 0; j< ui->mmlListWidget->count(); j++ ) {
mmlFiles.push_back ( ui->mmlListWidget->item ( j )->text().toStdString() ); mmlFiles.push_back ( ui->mmlListWidget->item ( j )->text().toStdString() );
} }
string output= "untitled.csv"; std::string output= "untitled.csv";
if ( !ui->saveMonitorslineEdit->text().isEmpty() ) { if ( !ui->saveMonitorslineEdit->text().isEmpty() ) {
output = ui->saveMonitorslineEdit->text().toStdString(); output = ui->saveMonitorslineEdit->text().toStdString();
} else { } else {
...@@ -220,7 +220,7 @@ void convertMml::plotMonitor() ...@@ -220,7 +220,7 @@ void convertMml::plotMonitor()
} }
//Now we can plotting with the qcustomplot library and ./csv2plot //Now we can plotting with the qcustomplot library and ./csv2plot
// csv2Plot plot ; // csv2Plot plot ;
list<string> liste; std::list<std::string> liste;
liste.push_back ( ui->plotComboBox->currentText().toStdString() ); liste.push_back ( ui->plotComboBox->currentText().toStdString() );
csv2Plot plot ( inputFile.toStdString(),liste ); csv2Plot plot ( inputFile.toStdString(),liste );
ui->customPlot->clearPlottables(); ui->customPlot->clearPlottables();
...@@ -278,15 +278,15 @@ void convertMml::generateCommandLines() ...@@ -278,15 +278,15 @@ void convertMml::generateCommandLines()
//---------------generateCsvFile--------------------------------------------------------- //---------------generateCsvFile---------------------------------------------------------
void convertMml::generateCsvFile() void convertMml::generateCsvFile()
{ {
string saveMMLFile= ui->saveMonitorslineEdit->text().toStdString(); std::string saveMMLFile= ui->saveMonitorslineEdit->text().toStdString();
if ( ui->mmlListWidget->count() != 0 ) { if ( ui->mmlListWidget->count() != 0 ) {
// Case where ./mml2csv must be launch first // Case where ./mml2csv must be launch first
if ( ui->mmlRadioButton->isChecked() ) { if ( ui->mmlRadioButton->isChecked() ) {
list <dataMonitoredList> monitors; std::list <dataMonitoredList> monitors;
for ( int i = 0; i< ui->monitorListWidget->count(); i++ ) { for ( int i = 0; i< ui->monitorListWidget->count(); i++ ) {
monitors.push_back ( dataMonitoredList ( ui->monitorListWidget->item ( i )->text().toStdString() ) ); monitors.push_back ( dataMonitoredList ( ui->monitorListWidget->item ( i )->text().toStdString() ) );
} }
list<string> mmlFiles; std::list<std::string> mmlFiles;
for ( int j = 0; j< ui->mmlListWidget->count(); j++ ) { for ( int j = 0; j< ui->mmlListWidget->count(); j++ ) {
mmlFiles.push_back ( ui->mmlListWidget->item ( j )->text().toStdString() ); mmlFiles.push_back ( ui->mmlListWidget->item ( j )->text().toStdString() );
} }
...@@ -302,12 +302,12 @@ void convertMml::generateCsvFile() ...@@ -302,12 +302,12 @@ void convertMml::generateCsvFile()
saveMMLFile=ui->mmlListWidget->item ( 0 )->text().toStdString(); saveMMLFile=ui->mmlListWidget->item ( 0 )->text().toStdString();
} }
// get a list where stats name are saved // get a list where stats name are saved
list<string> statsName; std::list<std::string> statsName;
for ( int i =0; i< ui->statsListWidget->count(); i++ ) { for ( int i =0; i< ui->statsListWidget->count(); i++ ) {
statsName.push_back ( ( ui->statsListWidget->item ( i )->text() ).toStdString() ); statsName.push_back ( ( ui->statsListWidget->item ( i )->text() ).toStdString() );
} }
// compute statistics // compute statistics
string output ="untitledSTATS.csv"; std::string output ="untitledSTATS.csv";
if ( !ui->saveStatsLineEdit->text().isEmpty() ) { if ( !ui->saveStatsLineEdit->text().isEmpty() ) {
output = ui->saveStatsLineEdit->text().toStdString(); output = ui->saveStatsLineEdit->text().toStdString();
} else { } else {
......
...@@ -34,17 +34,16 @@ ...@@ -34,17 +34,16 @@
#include <fstream> #include <fstream>
#include <complex> #include <complex>
#include <stdlib.h> #include <stdlib.h>
#include <vector>
#include "plotWindow.h" #include "plotWindow.h"
#include <bits/stl_algo.h> #include <bits/stl_algo.h>
//--------Constructor---------------------------------------------------------------------- //--------Constructor----------------------------------------------------------------------
csv2Plot::csv2Plot(string file, list< string > whichPlot, list< dataMonitoredList > results): csv2Sthing(file, whichPlot, results) csv2Plot::csv2Plot(std::string file, std::list< std::string > whichPlot, std::list< dataMonitoredList > results): csv2Sthing(file, whichPlot, results)
{ {
} }
//------------constructor---------------------------------------------------- //------------constructor----------------------------------------------------
csv2Plot::csv2Plot(string file, list< string > whichPlot): csv2Sthing(file, whichPlot) csv2Plot::csv2Plot(std::string file, std::list< std::string > whichPlot): csv2Sthing(file, whichPlot)
{ {
} }
...@@ -55,10 +54,10 @@ csv2Plot::~csv2Plot() { ...@@ -55,10 +54,10 @@ csv2Plot::~csv2Plot() {
//-------------drawMeMyPlots----------------------------------------------------------- //-------------drawMeMyPlots-----------------------------------------------------------
void csv2Plot::drawMeMyPlots() void csv2Plot::drawMeMyPlots()
{ {
list<dataMonitoredList> monitoredValues =results; std::list<dataMonitoredList> monitoredValues =results;
// Iterator // Iterator
list<dataMonitoredList>::iterator listDataResults; std::list<dataMonitoredList>::iterator listDataResults;
list<string>::iterator plotName; std::list<std::string>::iterator plotName;
// for each type of given plot // for each type of given plot
for (plotName=item.begin(); plotName!= item.end();plotName++) { for (plotName=item.begin(); plotName!= item.end();plotName++) {
...@@ -72,7 +71,7 @@ void csv2Plot::drawMeMyPlots() ...@@ -72,7 +71,7 @@ void csv2Plot::drawMeMyPlots()
} else if ((*plotName)=="BARCHART") { } else if ((*plotName)=="BARCHART") {
drawBarChart(p->getCustomPlot(),(*listDataResults).getMonitorName()); drawBarChart(p->getCustomPlot(),(*listDataResults).getMonitorName());
} }
string title = (*listDataResults).getMonitorName()+"-"+(*plotName); std::string title = (*listDataResults).getMonitorName()+"-"+(*plotName);
p->getCustomPlot()->replot(); p->getCustomPlot()->replot();
p->setWindowTitle(QString(title.c_str())); p->setWindowTitle(QString(title.c_str()));
p->show(); p->show();
...@@ -81,15 +80,15 @@ void csv2Plot::drawMeMyPlots() ...@@ -81,15 +80,15 @@ void csv2Plot::drawMeMyPlots()
} }
//--------------drawBarChart------------------------------------------------------------- //--------------drawBarChart-------------------------------------------------------------
bool csv2Plot::drawBarChart(QCustomPlot *plot, string monitor) bool csv2Plot::drawBarChart(QCustomPlot *plot, std::string monitor)
{ {
list<dataMonitoredList>::iterator listDR =results.begin(); std::list<dataMonitoredList>::iterator listDR =results.begin();
while (listDR != results.end()) { while (listDR != results.end()) {
if ((*listDR).getMonitorName() == monitor) { if ((*listDR).getMonitorName() == monitor) {
// create empty bar chart objects: // create empty bar chart objects:
QCPBars *dataToMonitor= new QCPBars(plot->xAxis, plot->yAxis); QCPBars *dataToMonitor= new QCPBars(plot->xAxis, plot->yAxis);
plot->addPlottable(dataToMonitor); plot->addPlottable(dataToMonitor);
vector<double> v= (*listDR).getResultData(); std::vector<double> v= (*listDR).getResultData();
//calculate number of classes k=1+ (10*log(size)/3) //calculate number of classes k=1+ (10*log(size)/3)
double k = 1 + (10 * log10((*listDR).getResultData().size())/3); double k = 1 + (10 * log10((*listDR).getResultData().size())/3);
...@@ -107,14 +106,13 @@ bool csv2Plot::drawBarChart(QCustomPlot *plot, string monitor) ...@@ -107,14 +106,13 @@ bool csv2Plot::drawBarChart(QCustomPlot *plot, string monitor)
QVector<double> xData (k,0); QVector<double> xData (k,0);
QVector<double> yData(k,0); QVector<double> yData(k,0);
QVector<double>::iterator ite;
double sup,inf = 0.0; double sup,inf = 0.0;
for (int i =0; i<k ; i++) { for (int i =0; i<k ; i++) {
inf = (*listDR).getMin() + (i*h); inf = (*listDR).getMin() + (i*h);
sup = (*listDR).getMin()+((i+1)*h); sup = (*listDR).getMin()+((i+1)*h);
xData[i]=(inf+sup)/2.0; xData[i]=(inf+sup)/2.0;
vector<double>::iterator ite; std::vector<double>::iterator ite;
for (ite = v.begin(); ite != v.end();ite++) { for (ite = v.begin(); ite != v.end();ite++) {
if ((*ite >= inf) && (*ite < sup)) { if ((*ite >= inf) && (*ite < sup)) {
yData[i] += 1; yData[i] += 1;
...@@ -137,7 +135,7 @@ bool csv2Plot::drawBarChart(QCustomPlot *plot, string monitor) ...@@ -137,7 +135,7 @@ bool csv2Plot::drawBarChart(QCustomPlot *plot, string monitor)
plot->xAxis->setAutoSubTicks(false); plot->xAxis->setAutoSubTicks(false);
plot->xAxis->setSubTickCount(9); plot->xAxis->setSubTickCount(9);
// setup Y-Axis: // setup Y-Axis:
int max = (int)*max_element(yData.begin(),yData.end()); int max = (int)*std::max_element(yData.begin(),yData.end());
plot->yAxis->setRange(0, max+1); plot->yAxis->setRange(0, max+1);
plot->yAxis->setAutoTickStep(false); plot->yAxis->setAutoTickStep(false);
plot->yAxis->setTickStep(1); plot->yAxis->setTickStep(1);
...@@ -168,9 +166,9 @@ bool csv2Plot::drawBarChart(QCustomPlot *plot, string monitor) ...@@ -168,9 +166,9 @@ bool csv2Plot::drawBarChart(QCustomPlot *plot, string monitor)
//-------------drawBox------------------------------------- //-------------drawBox-------------------------------------
bool csv2Plot::drawBoxChart(QCustomPlot *plot, string monitor) bool csv2Plot::drawBoxChart(QCustomPlot *plot, std::string monitor)
{ {
list<dataMonitoredList>::iterator listDR =results.begin(); std::list<dataMonitoredList>::iterator listDR =results.begin();
while (listDR != results.end()) { while (listDR != results.end()) {
if ((*listDR).getMonitorName() == monitor) { if ((*listDR).getMonitorName() == monitor) {
// create empty statistical box plottables: // create empty statistical box plottables:
...@@ -185,11 +183,11 @@ bool csv2Plot::drawBoxChart(QCustomPlot *plot, string monitor) ...@@ -185,11 +183,11 @@ bool csv2Plot::drawBoxChart(QCustomPlot *plot, string monitor)
sample1->setLowerQuartile((*listDR).firstQuartile()); sample1->setLowerQuartile((*listDR).firstQuartile());
sample1->setMedian((*listDR).median()); sample1->setMedian((*listDR).median());
sample1->setUpperQuartile((*listDR).thirdQuartile()); sample1->setUpperQuartile((*listDR).thirdQuartile());
vector<double> v = (*listDR).outliers(); std::vector<double> v = (*listDR).outliers();
int up=0,down = 0; int up=0,down = 0;
if (v.size()>0) { if (v.size()>0) {
sample1->setOutliers(QVector<double>::fromStdVector(v)); sample1->setOutliers(QVector<double>::fromStdVector(v));
for (vector<double>::iterator it = v.begin(); it != v.end();it++) { for (std::vector<double>::iterator it = v.begin(); it != v.end();it++) {
if (*it < (*listDR).firstQuartile()) { if (*it < (*listDR).firstQuartile()) {
down++; down++;
} else if (*it > (*listDR).thirdQuartile()) { } else if (*it > (*listDR).thirdQuartile()) {
...@@ -198,7 +196,7 @@ bool csv2Plot::drawBoxChart(QCustomPlot *plot, string monitor) ...@@ -198,7 +196,7 @@ bool csv2Plot::drawBoxChart(QCustomPlot *plot, string monitor)
} }
} }
vector<double> temp = (*listDR).getResultData(); std::vector<double> temp = (*listDR).getResultData();
std::sort(temp.begin(),temp.end()); std::sort(temp.begin(),temp.end());
if (up!=0) { if (up!=0) {
int val = temp.size()-up-1; int val = temp.size()-up-1;
......
...@@ -52,23 +52,23 @@ public: ...@@ -52,23 +52,23 @@ public:
/** /**
* Constructor * Constructor
* @param file path+filename where csv file is * @param file path+filename where csv file is
* @param whichPlot list which contains plot to draw * @param whichPlot std::list which contains plot to draw
* @param results list of @see dataMonitoredList * @param results std::list of @see dataMonitoredList
*/ */
csv2Plot(string file, list<string> whichPlot, list<dataMonitoredList> results); csv2Plot(std::string file, std::list<std::string> whichPlot, std::list<dataMonitoredList> results);
/** /**
* Constructor * Constructor
* @param file path+filename where csv file is * @param file path+filename where csv file is
* @param whichPlot list which contains plot to draw * @param whichPlot std::list which contains plot to draw
*/ */
csv2Plot(string file, list<string> whichPlot); csv2Plot(std::string file, std::list<std::string> whichPlot);
/// destructor /// destructor
virtual ~csv2Plot(); virtual ~csv2Plot();
/** /**
* method to call the method allowing to draw a kind of plot. * method to call the method allowing to draw a kind of plot.
* @param data list of data to display * @param data std::list of data to display
*/ */
void drawMeMyPlots(); void drawMeMyPlots();
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
* @param monitor which monitor will be plotted * @param monitor which monitor will be plotted
* @return true if success, false otherwise * @return true if success, false otherwise
*/ */
bool drawBarChart (QCustomPlot *plot, string monitor); bool drawBarChart (QCustomPlot *plot, std::string monitor);
/** /**
* Allows to draw a box chart. * Allows to draw a box chart.
...@@ -86,7 +86,7 @@ public: ...@@ -86,7 +86,7 @@ public:
* @param monitor which monitor will be plotted * @param monitor which monitor will be plotted
* @return true if success, false otherwise * @return true if success, false otherwise
*/ */
bool drawBoxChart (QCustomPlot *plot, string monitor); bool drawBoxChart (QCustomPlot *plot, std::string monitor);
}; };
......
...@@ -226,9 +226,9 @@ double csv2StatsVal::statsCalculation(string name,vector< double > l) ...@@ -226,9 +226,9 @@ double csv2StatsVal::statsCalculation(string name,vector< double > l)
return RMSCalculationExact(l); return RMSCalculationExact(l);
} else if ((name)=="RMS") { } else if ((name)=="RMS") {
return RMSCalculation(l); return RMSCalculation(l);
} else {
cout<<"ERROR: "<<(name)<<" is not yet implemented !"<<endl;
} }
cout<<"ERROR: "<<(name)<<" is not yet implemented !"<<endl;
return 0.0;
} }
......
...@@ -32,8 +32,6 @@ ...@@ -32,8 +32,6 @@
#ifndef CSV2STATSVAL_H #ifndef CSV2STATSVAL_H
#define CSV2STATSVAL_H #define CSV2STATSVAL_H
#include <string>
#include <list>
#include "../../mml2Csv/dataMonitoredList.h" #include "../../mml2Csv/dataMonitoredList.h"
#include "../csv2Sthing.h" #include "../csv2Sthing.h"
...@@ -52,14 +50,14 @@ public: ...@@ -52,14 +50,14 @@ public:
* @param statsName list of given stats to compute * @param statsName list of given stats to compute
* @param results list of @see dataMonitoredList * @param results list of @see dataMonitoredList
*/ */
csv2StatsVal(string saveFile, string file, list<string> statsName, list<dataMonitoredList> results); csv2StatsVal(std::string saveFile, std::string file, std::list<std::string> statsName, std::list<dataMonitoredList> results);
/** /**
* Constructor * Constructor
* @param saveFile path where the stats csv file will be saved * @param saveFile path where the stats csv file will be saved
* @param file path to the input csv file @see mml2Csv * @param file path to the input csv file @see mml2Csv
* @param statsName list of given stats to compute * @param statsName list of given stats to compute
*/ */
csv2StatsVal(string saveFile, string file, list<string> statsName); csv2StatsVal(std::string saveFile, std::string file, std::list<std::string> statsName);
/// destructor /// destructor
virtual ~csv2StatsVal(); virtual ~csv2StatsVal();
...@@ -69,38 +67,38 @@ public: ...@@ -69,38 +67,38 @@ public:
* WARNING: use this method when you're initial values in mml are not exact (Apparent error is calculated) * WARNING: use this method when you're initial values in mml are not exact (Apparent error is calculated)
* @param l data vector * @param l data vector
*/ */
double RMSCalculation(vector<double> l); double RMSCalculation(std::vector<double> l);
/** /**
* generate the rms error of a given data list. * generate the rms error of a given data list.
* WARNING: use this method when you're initial values in mml are exact (Real Error is calculated) * WARNING: use this method when you're initial values in mml are exact (Real Error is calculated)
* @param l data vector * @param l data vector
*/ */
double RMSCalculationExact(vector<double> l); double RMSCalculationExact(std::vector<double> l);
/** /**
* generate the mean error of a given data list * generate the mean error of a given data list
* @param l data vector * @param l data vector
*/ */
double mean(vector<double> l); double mean(std::vector<double> l);
/** /**
* find the max error in a given list * find the max error in a given list
* @param l the data vector * @param l the data vector
*/ */
double getMax(vector<double> l); double getMax(std::vector<double> l);
/** /**
* find the min error in a given list * find the min error in a given list
* @param l the data vector * @param l the data vector
*/ */
double getMin(vector<double> l); double getMin(std::vector<double> l);
/** /**
* find the standard deviation of a given list * find the standard deviation of a given list
* @param l the data vector * @param l the data vector
*/ */
double standardDeviation(vector<double> l); double standardDeviation(std::vector<double> l);
/** /**
* Allows you to write some stats in a csv file @param saveFile to a csv file @param filename. * Allows you to write some stats in a csv file @param saveFile to a csv file @param filename.
...@@ -109,7 +107,7 @@ public: ...@@ -109,7 +107,7 @@ public:
* @param statsName name of the stats to calculate * @param statsName name of the stats to calculate
* @param values object type @class dataMonitoredList which contains all data to calculate stats. * @param values object type @class dataMonitoredList which contains all data to calculate stats.
*/ */
void writeStatsCSV(string filename, string saveFile, list<string>statsName,list<dataMonitoredList> values ); void writeStatsCSV(std::string filename, std::string saveFile, std::list<std::string>statsName,std::list<dataMonitoredList> values );
/** /**
* Allows to write computed statistics as a text * Allows to write computed statistics as a text
...@@ -117,29 +115,29 @@ public: ...@@ -117,29 +115,29 @@ public:
* @param statsName statistics will be computed * @param statsName statistics will be computed
* @param values values which allow to compute statistics * @param values values which allow to compute statistics
*/ */
void writeStatsText(string filename, list<string>statsName, list<dataMonitoredList> values ); void writeStatsText(std::string filename, std::list<std::string>statsName, std::list<dataMonitoredList> values );
/** /**
* Get the results as text * Get the results as text
* @return results in pre-formated string * @return results in pre-formated string
*/ */
string getResultsAsText(); std::string getResultsAsText();
/** /**
* Set the string which contains results under a simple pre-formated text * Set the string which contains results under a simple pre-formated text
* @param file the new text * @param file the new text
*/ */
void setResultsAsText(string file); void setResultsAsText(std::string file);
private: private:
/// path where generated csv file will be saved /// path where generated csv file will be saved
string saveFile; std::string saveFile;
/// method to match the name of a stat with its method. /// method to match the name of a stat with its method.
double statsCalculation(string name, std::vector< double > l); double statsCalculation(std::string name, std::vector< double > l);
/// string which contains results in csv format /// string which contains results in csv format
string resultsAsText; std::string resultsAsText;
}; };
......
...@@ -58,7 +58,7 @@ csv2Sthing::~csv2Sthing() ...@@ -58,7 +58,7 @@ csv2Sthing::~csv2Sthing()
} }
//------------------------------------getResultsData-------------------------------------------------- //------------------------------------getResultsData--------------------------------------------------
list< dataMonitoredList > csv2Sthing::getResultsData() std::list< dataMonitoredList > csv2Sthing::getResultsData()
{ {
return results; return results;
} }
...@@ -67,30 +67,30 @@ return results; ...@@ -67,30 +67,30 @@ return results;
//-----------------------------------------------------------------------------createDataMonitoredList---- //-----------------------------------------------------------------------------createDataMonitoredList----
std::list< dataMonitoredList, std::allocator< dataMonitoredList > > csv2Sthing::createDataMonitoredList() std::list< dataMonitoredList, std::allocator< dataMonitoredList > > csv2Sthing::createDataMonitoredList()
{ {
std::istringstream stm; std::stringstream stm;
double d; double d;
string line; std::string line;
//open the csv file //open the csv file
ifstream myfile (file.c_str()); std::ifstream myfile (file.c_str());
vector<double> tempResults; std::vector<double> tempResults;
list<dataMonitoredList> list; std::list<dataMonitoredList> list;