Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
06d263de
Commit
06d263de
authored
Mar 18, 2021
by
Robin Eschbach
Browse files
[ADD
#138
] save column counter
parent
2f6b17b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
src/modules/writeProtonCSV/WMWriteCSV.cpp
src/modules/writeProtonCSV/WMWriteCSV.cpp
+11
-1
No files found.
src/modules/writeProtonCSV/WMWriteCSV.cpp
View file @
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
++
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment