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

Method Write

lib/mdflib/mdflib/src/mdfblock.cpp:613–638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

611}
612
613uint64_t MdfBlock::Write(std::streambuf& buffer) {
614 SetLastFilePosition(buffer);
615 file_position_ = GetFilePosition(buffer);
616
617 uint64_t bytes = 0;
618 if (IsMdf4()) {
619 bytes += WriteStr(buffer, block_type_, 4);
620 const std::vector<uint8_t> reserved(4, 0);
621 bytes += WriteByte(buffer, reserved);
622 bytes += WriteNumber(buffer, block_length_);
623 uint64_t link_count = link_list_.size();
624 bytes += WriteNumber(buffer, link_count);
625 for (auto link : link_list_) {
626 bytes += WriteNumber(buffer, link);
627 }
628 } else {
629 bytes += WriteStr(buffer, block_type_, 2);
630 bytes += WriteNumber(buffer, block_size_);
631 link_count_ = link_list_.size();
632 for (auto link : link_list_) {
633 const auto link32 = static_cast<uint32_t>(link);
634 bytes += WriteNumber(buffer, link32);
635 }
636 }
637 return bytes;
638}
639
640uint64_t MdfBlock::Update(std::streambuf& buffer) const {
641 SetFilePosition(buffer, FilePosition());

Callers 2

WriteMdCommentMethod · 0.45
WriteTx4Method · 0.45

Calls 4

GetFilePositionFunction · 0.85
WriteStrFunction · 0.85
WriteByteFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected