Add a param in fileExport method in moSampling to be able to write at the end of the file
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1939 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
1ee68125fd
commit
e91516ba50
1 changed files with 152 additions and 141 deletions
|
|
@ -38,6 +38,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <cstdlib>
|
||||||
#include <eoFunctor.h>
|
#include <eoFunctor.h>
|
||||||
#include <utils/eoMonitor.h>
|
#include <utils/eoMonitor.h>
|
||||||
#include <continuator/moStat.h>
|
#include <continuator/moStat.h>
|
||||||
|
|
@ -130,10 +132,17 @@ public:
|
||||||
* to export the vectors of values into one file
|
* to export the vectors of values into one file
|
||||||
* @param _filename file name
|
* @param _filename file name
|
||||||
* @param _delim delimiter between statistics
|
* @param _delim delimiter between statistics
|
||||||
|
* @param _openFile to specify if it writes at the following of the file
|
||||||
*/
|
*/
|
||||||
void fileExport(std::string _filename, std::string _delim = " ") {
|
void fileExport(std::string _filename, std::string _delim = " ", bool _openFile=false) {
|
||||||
// create file
|
// create file
|
||||||
std::ofstream os(_filename.c_str());
|
std::ofstream os;
|
||||||
|
|
||||||
|
if(! _openFile)
|
||||||
|
os.open(_filename.c_str());
|
||||||
|
|
||||||
|
else
|
||||||
|
os.open(_filename.c_str(),std::ios::app);
|
||||||
|
|
||||||
if (!os) {
|
if (!os) {
|
||||||
std::string str = "moSampling: Could not open " + _filename;
|
std::string str = "moSampling: Could not open " + _filename;
|
||||||
|
|
@ -159,16 +168,18 @@ public:
|
||||||
* to export one vector of values into a file
|
* to export one vector of values into a file
|
||||||
* @param _col number of vector to print into file
|
* @param _col number of vector to print into file
|
||||||
* @param _filename file name
|
* @param _filename file name
|
||||||
|
* @param _openFile to specify if it writes at the following of the file
|
||||||
*/
|
*/
|
||||||
void fileExport(unsigned int _col, std::string _filename) {
|
void fileExport(unsigned int _col, std::string _filename, bool _openFile=false) {
|
||||||
if (_col >= monitorVec.size()) {
|
if (_col >= monitorVec.size()) {
|
||||||
std::string str = "moSampling: Could not export into file the vector. The index does not exists (too large)";
|
std::string str = "moSampling: Could not export into file the vector. The index does not exists (too large)";
|
||||||
throw std::runtime_error(str);
|
throw std::runtime_error(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
monitorVec[_col]->fileExport(_filename);
|
monitorVec[_col]->fileExport(_filename, _openFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* to get one vector of values
|
* to get one vector of values
|
||||||
* @param _numStat number of statistics to get (in the order of creation)
|
* @param _numStat number of statistics to get (in the order of creation)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue