From 5ac2e8c23d6e6c2dbf433e951f37f67c9a08bac4 Mon Sep 17 00:00:00 2001 From: Zhiwen Zhao Date: Fri, 12 Jun 2026 22:57:53 -0400 Subject: [PATCH] CSV streamer: always terminate a hit row with a newline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- gemc/gstreamer/factories/CSV/event/publishDigitized.cc | 2 +- gemc/gstreamer/factories/CSV/event/publishTrueInfo.cc | 2 +- gemc/gstreamer/factories/CSV/run/publishDigitized.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gemc/gstreamer/factories/CSV/event/publishDigitized.cc b/gemc/gstreamer/factories/CSV/event/publishDigitized.cc index cf112749..3283dd3b 100644 --- a/gemc/gstreamer/factories/CSV/event/publishDigitized.cc +++ b/gemc/gstreamer/factories/CSV/event/publishDigitized.cc @@ -54,8 +54,8 @@ bool GstreamerCsvFactory::publishEventDigitizedDataImpl(const std::string& for (const auto& [variableName, value] : dmap) { ofile_digitized << value; if (++i < total) ofile_digitized << ", "; - else ofile_digitized << "\n"; } + ofile_digitized << "\n"; } } diff --git a/gemc/gstreamer/factories/CSV/event/publishTrueInfo.cc b/gemc/gstreamer/factories/CSV/event/publishTrueInfo.cc index 1d2cbd46..0f313424 100644 --- a/gemc/gstreamer/factories/CSV/event/publishTrueInfo.cc +++ b/gemc/gstreamer/factories/CSV/event/publishTrueInfo.cc @@ -55,8 +55,8 @@ bool GstreamerCsvFactory::publishEventTrueInfoDataImpl(const std::string& for (const auto& [variableName, value] : dmap) { ofile_true_info << value; if (++i < total) ofile_true_info << ", "; - else ofile_true_info << "\n"; } + ofile_true_info << "\n"; } } diff --git a/gemc/gstreamer/factories/CSV/run/publishDigitized.cc b/gemc/gstreamer/factories/CSV/run/publishDigitized.cc index 3835d815..aafe35d5 100644 --- a/gemc/gstreamer/factories/CSV/run/publishDigitized.cc +++ b/gemc/gstreamer/factories/CSV/run/publishDigitized.cc @@ -55,8 +55,8 @@ bool GstreamerCsvFactory::publishRunDigitizedDataImpl(const std::string& for (const auto& [variableName, value] : dmap) { ofile_digitized << value; if (++i < total) ofile_digitized << ", "; - else ofile_digitized << "\n"; } + ofile_digitized << "\n"; } }