| 47 | } |
| 48 | |
| 49 | uint64_t Sr3Block::Write(std::streambuf& buffer) { |
| 50 | // SR block must be written with its data once with no updates |
| 51 | const bool update = FilePosition() > 0; |
| 52 | if (update) { |
| 53 | return block_size_; |
| 54 | } |
| 55 | block_type_ = "SR"; |
| 56 | block_size_ = (2 + 2) + (2 * 4) + 4 + 8; |
| 57 | link_list_.resize(2, 0); |
| 58 | uint64_t bytes = MdfBlock::Write(buffer); |
| 59 | bytes += WriteNumber(buffer, nof_reduced_samples_); |
| 60 | bytes += WriteNumber(buffer, time_interval_); |
| 61 | |
| 62 | for (size_t index = 0; index < block_list_.size(); ++index) { |
| 63 | auto &data = block_list_[index]; |
| 64 | if (!data) { |
| 65 | continue; |
| 66 | } |
| 67 | if (data->FilePosition() > 0) { |
| 68 | continue; |
| 69 | } |
| 70 | data->Write(buffer); |
| 71 | if (index == 0) { |
| 72 | UpdateLink(buffer, kIndexData, data->FilePosition()); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | return bytes; |
| 77 | } |
| 78 | |
| 79 | |
| 80 | void Sr3Block::ReadData(std::streambuf& buffer) const { |
nothing calls this directly
no test coverage detected