示例#1
0
			void flush()
			{
				if ( ! flushed )
				{
					flushed = true;

					implicitFlush();
					PSGO->flush();
					PSGO.reset();

					uint64_t const offset = headerlength + PSGO->getWrittenBytes();

					libmaus2::util::NumberSerialisation::serialiseNumber(*PMETA,offset);
					libmaus2::util::NumberSerialisation::serialiseNumber(*PMETA,valueswritten);

					PMETA->flush();
					PMETA.reset();

					assert ( POSI->tellp() == static_cast<int64_t>(offset) );

					libmaus2::aio::InputStreamInstance::unique_ptr_type METAin(new libmaus2::aio::InputStreamInstance(metafn));
					while ( METAin->peek() != std::istream::traits_type::eof() )
						libmaus2::util::NumberSerialisation::serialiseNumber(*POSI,libmaus2::util::NumberSerialisation::deserialiseNumber(*METAin));
					METAin.reset();

					libmaus2::aio::FileRemoval::removeFile(metafn);

					// write index offset
					libmaus2::util::NumberSerialisation::serialiseNumber(*POSI,offset);

					POSI->flush();
					POSI.reset();
				}
			}
示例#2
0
			void flush()
			{
				assert ( pc != pe );

				if ( curcnt )
				{
					*(pc++) = rl_pair(cursym,curcnt);
					curcnt = 0;
				}
				
				implicitFlush();
				
				// std::cerr << "Index size " << index.size()*2*sizeof(uint64_t) << " for " << this << std::endl;;
				
				if ( ! indexwritten )
				{
					writer.flushBitStream();
					uint64_t const indexpos = writer.getPos();
					
					writeIndex(writer,index,indexpos,numsyms);

					indexwritten = true;
				}
				
				writer.flush();
			}
示例#3
0
			void flush()
			{
				assert ( rc != re );

				if ( currun.rlen )
				{
					*(rc++) = currun;
					currun.rlen = 0;
					currun.sym = std::numeric_limits<int64_t>::min();
				}

				implicitFlush();

				// std::cerr << "Index size " << index.size()*2*sizeof(uint64_t) << " for " << this << std::endl;;

				if ( ! indexwritten )
				{
					writer.flushBitStream();
					uint64_t const indexpos = writer.getPos();

					writeIndex(writer,index,indexpos);

					indexwritten = true;
				}

				writer.flush();
			}
示例#4
0
			void flush()
			{
				if ( curcnt )
				{
					*(pc++) = ptype(cursym,curcnt);
					implicitFlush();
					curcnt = 0;
				}

				SGO.flush();

				uint64_t const indexpos = SGO.getWrittenBytes();
				writeIndex(indexpos);				
			}
示例#5
0
			void encodeRun(SymBitRun const & SC)
			{
				if ( static_cast<SymBit const &>(SC) == static_cast<SymBit const &>(currun) )
				{
					currun.rlen += SC.rlen;
				}
				else
				{
					if ( currun.rlen )
					{
						*(rc++) = currun;
						if ( rc == re )
							implicitFlush();
					}

					currun = SC;
				}
			}
示例#6
0
			void encode(SymBit const & SC)
			{
				if ( SC == currun )
				{
					currun.rlen += 1;
				}
				else
				{
					if ( currun.rlen )
					{
						*(rc++) = currun;
						if ( rc == re )
							implicitFlush();
					}

					currun = SC;
					currun.rlen = 1;
				}
			}
示例#7
0
			void encode(uint64_t const sym)
			{
				if ( sym == cursym )
				{
					curcnt++;
				}
				else if ( curcnt )
				{
					*(pc++) = ptype(cursym,curcnt);
					
					if ( pc == pe )
						implicitFlush();
					
					cursym = sym;
					curcnt = 1;
				}
				else
				{
					assert ( sym != cursym );
					cursym = sym;
					curcnt = 1;
				}
			}
示例#8
0
			void encode(uint64_t const v)
			{
				*(pc++) = v;
				if ( pc == pe )
					implicitFlush();
			}