Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the SIOFrameWriter call to finish non-mandatory #446

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading