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

Method Write

lib/mdflib/mdflib/src/tr3block.cpp:34–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34uint64_t Tr3Block::Write(std::streambuf& buffer) {
35 // The TR block is normally added after the measurement has been stopped as it
36 // cannot be appended
37 if (FilePosition() > 0) {
38 return block_size_;
39 }
40
41 nof_events_ = static_cast<uint16_t>(event_list_.size());
42 block_type_ = "TR";
43 block_size_ = (2 + 2) + (1 * 4) + 2 + (nof_events_ * 24);
44 link_list_.resize(1, 0);
45
46 if (!comment_.empty()) {
47 Tx3Block tx(comment_);
48 tx.Init(*this);
49 tx.Write(buffer);
50 link_list_[kIndexTx] = tx.FilePosition();
51 }
52
53 uint64_t bytes = MdfBlock::Write(buffer);
54 bytes += WriteNumber(buffer, nof_events_);
55
56 for (const auto &ev : event_list_) {
57 bytes += WriteNumber(buffer, ev.event_time);
58 bytes += WriteNumber(buffer, ev.pre_time);
59 bytes += WriteNumber(buffer, ev.post_time);
60 }
61
62 return bytes;
63}
64
65} // namespace mdf::detail

Callers

nothing calls this directly

Calls 5

emptyMethod · 0.80
sizeMethod · 0.45
resizeMethod · 0.45
InitMethod · 0.45
FilePositionMethod · 0.45

Tested by

no test coverage detected