MCPcopy Create free account
hub / github.com/davisking/dlib / flush

Method flush

dlib/entropy_encoder/entropy_encoder_kernel_2.cpp:184–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182// ----------------------------------------------------------------------------------------
183
184 void entropy_encoder_kernel_2::
185 flush (
186 )
187 {
188
189 // flush low to the output stream
190
191
192 unsigned char buf;
193
194
195 buf = static_cast<unsigned char>((low >> 24)&0xFF);
196 if (streambuf->sputn(reinterpret_cast<char*>(&buf),1) == 0)
197 throw std::ios_base::failure("error occurred in the entropy_encoder object");
198
199
200
201
202 buf = static_cast<unsigned char>((low >> 16)&0xFF);
203 if (streambuf->sputn(reinterpret_cast<char*>(&buf),1)==0)
204 throw std::ios_base::failure("error occurred in the entropy_encoder object");
205
206
207
208 buf = static_cast<unsigned char>((low >> 8)&0xFF);
209 if (streambuf->sputn(reinterpret_cast<char*>(&buf),1)==0)
210 throw std::ios_base::failure("error occurred in the entropy_encoder object");
211
212
213 buf = static_cast<unsigned char>((low)&0xFF);
214 if (streambuf->sputn(reinterpret_cast<char*>(&buf),1)==0)
215 throw std::ios_base::failure("error occurred in the entropy_encoder object");
216
217
218
219
220 // make sure the stream buffer flushes to its I/O channel
221 streambuf->pubsync();
222
223
224 // reset the encoder state
225 low = initial_low;
226 high = initial_high;
227 }
228
229// ----------------------------------------------------------------------------------------
230

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected