MCPcopy Create free account
hub / github.com/comaps/comaps / ReadAndWrite

Function ReadAndWrite

libs/coding/read_write_utils.hpp:147–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145
146template <class ReaderT, class WriterT>
147void ReadAndWrite(ReaderT & reader, WriterT & writer, size_t bufferSize = 4 * 1024)
148{
149 uint64_t size = reader.Size();
150 std::vector<char> buffer(std::min(bufferSize, static_cast<size_t>(size)));
151
152 while (size > 0)
153 {
154 size_t const curr = std::min(bufferSize, static_cast<size_t>(size));
155
156 reader.Read(&buffer[0], curr);
157 writer.Write(&buffer[0], curr);
158
159 size -= curr;
160 }
161}
162} // namespace rw

Callers 3

UnpackMwmFunction · 0.85
FinishMethod · 0.85
WriteMethod · 0.85

Calls 3

SizeMethod · 0.45
ReadMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected