MCPcopy Create free account
hub / github.com/ElementsProject/elements / read

Method read

src/streams.h:280–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278 int GetVersion() const { return nVersion; }
279
280 void read(Span<value_type> dst)
281 {
282 if (dst.size() == 0) return;
283
284 // Read from the beginning of the buffer
285 auto next_read_pos{CheckedAdd(m_read_pos, dst.size())};
286 if (!next_read_pos.has_value() || next_read_pos.value() > vch.size()) {
287 throw std::ios_base::failure("CDataStream::read(): end of data");
288 }
289 memcpy(dst.data(), &vch[m_read_pos], dst.size());
290 if (next_read_pos.value() == vch.size()) {
291 m_read_pos = 0;
292 vch.clear();
293 return;
294 }
295 m_read_pos = next_read_pos.value();
296 }
297
298 void ignore(size_t num_ignore)
299 {

Callers

nothing calls this directly

Calls 5

CheckedAddFunction · 0.85
sizeMethod · 0.45
valueMethod · 0.45
dataMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected