MCPcopy Create free account
hub / github.com/catboost/catboost / SerializeMem

Function SerializeMem

library/cpp/binsaver/mem_io.h:50–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49 template <class T>
50 inline void SerializeMem(bool bRead, TVector<char>* data, T& c, bool stableOutput = false) {
51 if (IBinSaver::HasNonTrivialSerializer<T>(0u)) {
52 TMemoryStream f(data);
53 {
54 IBinSaver bs(f, bRead, stableOutput);
55 bs.Add(1, &c);
56 }
57 } else {
58 if (bRead) {
59 Y_ASSERT(data->size() == sizeof(T));
60 c = *reinterpret_cast<T*>(&(*data)[0]);
61 } else {
62 data->yresize(sizeof(T));
63 *reinterpret_cast<T*>(&(*data)[0]) = c;
64 }
65 }
66 }
67
68 ////////////////////////////////////////////////////////////////////////////
69 class THugeMemoryStream: public IBinaryStream {

Callers 2

SerializeToMemFunction · 0.85
SerializeFromMemFunction · 0.85

Calls 6

SerializeFromMemFunction · 0.85
yresizeMethod · 0.80
AddMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected