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

Function CopyDataToFile

lib/mdflib/mdflib/src/dg4block.cpp:34–52  ·  view source on GitHub ↗

< Helper function that recursively copies all data bytes to a destination file.

Source from the content-addressed store, hash-verified

32///< Helper function that recursively copies all data bytes to a
33/// destination file.
34uint64_t CopyDataToFile(
35 const mdf::detail::DataListBlock::BlockList& block_list, // NOLINT
36 std::streambuf& from_file, std::streambuf& to_file) {
37 uint64_t count = 0;
38 for (const auto& block : block_list) {
39 if (!block) {
40 continue;
41 }
42 const auto* db = dynamic_cast<const mdf::detail::DataBlock*>(block.get());
43 const auto* dl =
44 dynamic_cast<const mdf::detail::DataListBlock*>(block.get());
45 if (db != nullptr) {
46 count += db->CopyDataToFile(from_file, to_file);
47 } else if (dl != nullptr) {
48 count += CopyDataToFile(dl->DataBlockList(), from_file, to_file);
49 }
50 }
51 return count;
52}
53
54} // namespace
55

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
CopyDataToFileMethod · 0.45

Tested by

no test coverage detected