MCPcopy Create free account
hub / github.com/OpenImageDebugger/OpenImageDebugger / chunk

Method chunk

src/ipc/buffer_assembler.cpp:40–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40bool BufferAssembler::chunk(const std::string& name,
41 const std::size_t row_offset,
42 const std::size_t row_count,
43 const std::span<const std::byte> bytes) {
44 const auto it = in_progress_.find(name);
45 if (it == in_progress_.end()) {
46 return false;
47 }
48 auto& entry = it->second;
49 const auto stride = static_cast<std::size_t>(entry.params.stride);
50 const auto offset = row_offset * stride;
51 if (const auto expected = row_count * stride;
52 bytes.size() != expected ||
53 offset + bytes.size() > entry.bytes.size()) {
54 return false;
55 }
56 std::memcpy(entry.bytes.data() + offset, bytes.data(), bytes.size());
57 return true;
58}
59
60std::optional<AssembledBuffer> BufferAssembler::end(const std::string& name) {
61 const auto it = in_progress_.find(name);

Callers 2

TESTFunction · 0.80

Calls 3

endMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by 1

TESTFunction · 0.64