| 73 | } |
| 74 | |
| 75 | bool MdfConverter::FinalizeMeasurement() { |
| 76 | write_cache_.Exit(); |
| 77 | |
| 78 | // Save outstanding non-written blocks and any block updates as |
| 79 | // sample counters which changes during DG/DT updates |
| 80 | if (!mdf_file_) { |
| 81 | MDF_ERROR() << "The MDF file is not created. Invalid use of the function."; |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | if (!IsOpen()) { |
| 86 | MDF_ERROR() << "Failed to open the file for writing. File: " << filename_; |
| 87 | return false; |
| 88 | } |
| 89 | const bool write = mdf_file_ && mdf_file_->Write(*file_); |
| 90 | const bool signal_data = WriteSignalData(*file_); |
| 91 | Close(); |
| 92 | |
| 93 | write_state_ = WriteState::Finalize; |
| 94 | return write && signal_data; |
| 95 | } |
| 96 | |
| 97 | |
| 98 | |