void term() { genc.encode(0); genc.encode(0); genc.flush(); SGO.flush(); SGOout.flush(); indexout.clear(); indexout.seekg(0,std::ios::beg); // uint64_t const indexpos = SGO.getWrittenBytes(); indexout.clear(); indexout.seekg(0,std::ios::beg); libmaus2::util::GetFileSize::copy(indexout,SGOout,2*sizeof(uint64_t)*indexentries); libmaus2::util::NumberSerialisation::serialiseNumber(SGOout,indexentries ? prevkey : 0); // highest key in file libmaus2::util::NumberSerialisation::serialiseNumber(SGOout,indexentries); SGOout.flush(); }
void implicitFlush() { uint64_t const bs = pc-pa; if ( bs ) { uint64_t acc = 0; uint64_t const pos = SGO.getWrittenBytes(); GE.encode(bs); for ( uint64_t i = 0; i < bs; ++i ) { acc += pa[i].second; GE.encodeWord(pa[i].first,albits); GE.encode(pa[i].second); } GE.flush(); ::libmaus2::huffman::IndexEntry const entry(pos,bs,acc); index.push_back(entry); pc = pa; } }