MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / closeResources

Method closeResources

app/src/MDF4/Export.cpp:168–189  ·  view source on GitHub ↗

* @brief Closes the MDF4 file */

Source from the content-addressed store, hash-verified

166 * @brief Closes the MDF4 file
167 */
168void MDF4::ExportWorker::closeResources()
169{
170 if (isResourceOpen() && m_writer) {
171 try {
172 const auto steadyNow = DataModel::TimestampedFrame::SteadyClock::now();
173 const auto steadyOffset = steadyNow - m_steadyBaseline;
174 const auto systemTime = m_systemBaseline + steadyOffset;
175 const auto stop_time =
176 std::chrono::duration_cast<std::chrono::nanoseconds>(systemTime.time_since_epoch()).count();
177
178 m_writer->StopMeasurement(static_cast<uint64_t>(stop_time));
179 m_writer->FinalizeMeasurement();
180 } catch (const std::exception& e) {
181 qWarning() << "[MDF4] Exception in closeResources:" << e.what();
182 }
183
184 m_fileOpen = false;
185 m_writer.reset();
186 m_groupMap.clear();
187 DataModel::clear_frame(m_templateFrame);
188 }
189}
190
191/**
192 * @brief Stores the schema template frame; must run on the worker thread (queued invoke) so

Callers

nothing calls this directly

Calls 6

clear_frameFunction · 0.85
countMethod · 0.45
StopMeasurementMethod · 0.45
FinalizeMeasurementMethod · 0.45
resetMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected