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

Method Write

lib/mdflib/mdflib/src/sr3block.cpp:49–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49uint64_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
80void Sr3Block::ReadData(std::streambuf& buffer) const {

Callers

nothing calls this directly

Calls 3

resizeMethod · 0.45
sizeMethod · 0.45
FilePositionMethod · 0.45

Tested by

no test coverage detected