Skip to content

Commit 5ac2e8c

Browse files
zhaozhiwenclaude
andcommitted
CSV streamer: always terminate a hit row with a newline
The row newline was emitted only in the else branch of the double-observables loop, so a hit whose detector schema has no double observables (empty dmap) never entered the loop body and produced no newline — concatenating that row with the next one. Move the newline to after the loop, written exactly once per hit, matching the header row's existing logic. Applies to event/publishDigitized.cc, event/publishTrueInfo.cc, and run/publishDigitized.cc. Verified: the normal (doubles-present) path is unchanged — the gstreamer CSV example still produces rows with consistent column counts and newline termination. Fixes #129 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 48f83e5 commit 5ac2e8c

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

gemc/gstreamer/factories/CSV/event/publishDigitized.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ bool GstreamerCsvFactory::publishEventDigitizedDataImpl(const std::string&
5454
for (const auto& [variableName, value] : dmap) {
5555
ofile_digitized << value;
5656
if (++i < total) ofile_digitized << ", ";
57-
else ofile_digitized << "\n";
5857
}
58+
ofile_digitized << "\n";
5959
}
6060
}
6161

gemc/gstreamer/factories/CSV/event/publishTrueInfo.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ bool GstreamerCsvFactory::publishEventTrueInfoDataImpl(const std::string&
5555
for (const auto& [variableName, value] : dmap) {
5656
ofile_true_info << value;
5757
if (++i < total) ofile_true_info << ", ";
58-
else ofile_true_info << "\n";
5958
}
59+
ofile_true_info << "\n";
6060
}
6161
}
6262

gemc/gstreamer/factories/CSV/run/publishDigitized.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ bool GstreamerCsvFactory::publishRunDigitizedDataImpl(const std::string&
5555
for (const auto& [variableName, value] : dmap) {
5656
ofile_digitized << value;
5757
if (++i < total) ofile_digitized << ", ";
58-
else ofile_digitized << "\n";
5958
}
59+
ofile_digitized << "\n";
6060
}
6161
}
6262

0 commit comments

Comments
 (0)