Commit 8ecac3f2 authored by Hung Dang-Quoc's avatar Hung Dang-Quoc
Browse files

Merge branch 'top2021s5/#138_count_save_column' into 'sprint_6'

[MERGE #138] save column counter

See merge request top/21s/sivert-vis/sivert-vis-project!89
parents 52bccdc7 06d263de
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <list> #include <list>
#include <string> #include <string>
#include <vector>
#include "core/common/WPathHelper.h" #include "core/common/WPathHelper.h"
#include "core/kernel/WKernel.h" #include "core/kernel/WKernel.h"
...@@ -214,6 +215,7 @@ void WMWriteCSV::writeToFile() ...@@ -214,6 +215,7 @@ void WMWriteCSV::writeToFile()
std::string outputFilename = sourceFilename + ".csv"; std::string outputFilename = sourceFilename + ".csv";
WDataSetCSV::SeperatedRowSPtr csvContent = m_CSVInput->getData()->getRawDataSet(); WDataSetCSV::SeperatedRowSPtr csvContent = m_CSVInput->getData()->getRawDataSet();
std::vector< std::string > csvHeader = m_CSVInput->getData()->getHeader()->at( 0 );
WDataSetFibers::SPtr fibers = m_PointsAndFibersInput->getData()->getFibers(); WDataSetFibers::SPtr fibers = m_PointsAndFibersInput->getData()->getFibers();
WDataSetPoints::SPtr points = m_PointsAndFibersInput->getData()->getPoints(); WDataSetPoints::SPtr points = m_PointsAndFibersInput->getData()->getPoints();
...@@ -230,7 +232,15 @@ void WMWriteCSV::writeToFile() ...@@ -230,7 +232,15 @@ void WMWriteCSV::writeToFile()
bool isMatch = false; bool isMatch = false;
newCSVFile << csvContent->at( 0 ) << "," << "SelectedEventID" << std::endl; std::string newColumnName = "SelectedEventID";
size_t counter = 1;
while( std::find( csvHeader.begin(), csvHeader.end(), newColumnName ) != csvHeader.end() )
{
newColumnName = "SelectedEventID_" + boost::lexical_cast< std::string >( counter );
counter++;
}
newCSVFile << csvContent->at( 0 ) << "," << newColumnName << std::endl;
csvContent->erase( csvContent->begin() ); csvContent->erase( csvContent->begin() );
for( size_t row = 0; row < csvContent->size(); row++ ) for( size_t row = 0; row < csvContent->size(); row++ )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment