Skip to content

Commit

Permalink
Make the SIOFrameWriter call to finish non-mandatory (AIDASoft#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener authored Jul 13, 2023
1 parent 9ac7d32 commit 6409d58
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/podio/SIOFrameWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Frame;
class SIOFrameWriter {
public:
SIOFrameWriter(const std::string& filename);
~SIOFrameWriter() = default;
~SIOFrameWriter();

SIOFrameWriter(const SIOFrameWriter&) = delete;
SIOFrameWriter& operator=(const SIOFrameWriter&) = delete;
Expand All @@ -37,6 +37,7 @@ class SIOFrameWriter {
sio::ofstream m_stream{}; ///< The output file stream
SIOFileTOCRecord m_tocRecord{}; ///< The "table of contents" of the written file
DatamodelDefinitionCollector m_datamodelCollector{};
bool m_finished{false}; ///< Has finish been called already?
};
} // namespace podio

Expand Down
6 changes: 6 additions & 0 deletions src/SIOFrameWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ SIOFrameWriter::SIOFrameWriter(const std::string& filename) {
sio_utils::writeRecord(blocks, "podio_header_info", m_stream, sizeof(podio::version::Version), false);
}

SIOFrameWriter::~SIOFrameWriter() {
if (!m_finished) {
finish();
}
}

void SIOFrameWriter::writeFrame(const podio::Frame& frame, const std::string& category) {
writeFrame(frame, category, frame.getAvailableCollections());
}
Expand Down

0 comments on commit 6409d58

Please sign in to comment.