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

Function WriteVarSerialVector

libs/coding/coding_tests/var_serial_vector_test.cpp:30–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29template <typename ItT, typename TDstStream>
30void WriteVarSerialVector(ItT begin, ItT end, TDstStream & dst)
31{
32 vector<uint32_t> offsets;
33 uint32_t offset = 0;
34 for (ItT it = begin; it != end; ++it)
35 {
36 offset += it->size() * sizeof((*it)[0]);
37 offsets.push_back(offset);
38 }
39
40 WriteToSink(dst, static_cast<uint32_t>(end - begin));
41
42 for (size_t i = 0; i < offsets.size(); ++i)
43 WriteToSink(dst, offsets[i]);
44
45 for (ItT it = begin; it != end; ++it)
46 {
47 typename ItT::value_type const & v = *it;
48 if (!v.empty())
49 dst.Write(&v[0], v.size() * sizeof(v[0]));
50 }
51}
52
53} // namespace
54

Callers 1

UNIT_TESTFunction · 0.85

Calls 5

WriteToSinkFunction · 0.85
sizeMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected