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

Method FlushImpl

library/cpp/blockcodecs/core/stream.cpp:107–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107bool TCodedOutput::FlushImpl() {
108 const bool ret = !D_.Empty();
109 const size_t payload = sizeof(TCodecID) + sizeof(TBlockLen);
110 O_.Reserve(C_->MaxCompressedLength(D_) + payload);
111
112 void* out = O_.Data() + payload;
113 const size_t olen = C_->Compress(D_, out);
114
115 {
116 TMemoryOutput mo(O_.Data(), payload);
117
118 ::Save(&mo, CodecID(C_));
119 ::Save(&mo, SafeIntegerCast<TBlockLen>(olen));
120 }
121
122 S_->Write(O_.Data(), payload + olen);
123
124 D_.Clear();
125 O_.Clear();
126
127 return ret;
128}
129
130void TCodedOutput::DoFlush() {
131 if (S_ && !D_.Empty()) {

Callers

nothing calls this directly

Calls 9

CodecIDFunction · 0.85
SaveFunction · 0.50
EmptyMethod · 0.45
ReserveMethod · 0.45
MaxCompressedLengthMethod · 0.45
DataMethod · 0.45
CompressMethod · 0.45
WriteMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected