当前位置: 首页>>代码示例>>C++>>正文


C++ stream_type类代码示例

本文整理汇总了C++中stream_type的典型用法代码示例。如果您正苦于以下问题:C++ stream_type类的具体用法?C++ stream_type怎么用?C++ stream_type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了stream_type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: peekLinearChunk

			static bool peekLinearChunk(stream_type & stream, uint64_t const refid, int64_t const chunkid)
			{
				::libmaus2::bambam::BamIndexLinearChunk LC;

				if ( stream.peek() == stream_type::traits_type::eof() )
					return false;
				
				stream.read(reinterpret_cast<char *>(&LC),sizeof(::libmaus2::bambam::BamIndexLinearChunk));
				stream.clear();
				stream.seekg(-static_cast<int64_t>(sizeof(::libmaus2::bambam::BamIndexLinearChunk)),std::ios::cur);
				
				return LC.refid == refid && LC.chunkid == chunkid;
			}
开发者ID:dkj,项目名称:libmaus2,代码行数:13,代码来源:BamIndexGenerator.hpp

示例2: operator

        result_type operator() (stream_type& strm, value_type const& value) const
        {
            strm.flush();
            typedef typename stream_type::streambuf_type streambuf_type;
            string_type& str = *static_cast< streambuf_type* >(strm.rdbuf())->storage();

            char_type buf[std::numeric_limits< unsigned int >::digits10 + 2];
            char_type* p = buf;

            typedef karma::uint_generator< unsigned int, 10 > uint_gen;
            karma::generate(p, uint_gen(), value.line);
            str.append(buf, p);
        }
开发者ID:ElaraFX,项目名称:boost,代码行数:13,代码来源:named_scope_format_parser.cpp

示例3: open_next_file

 void open_next_file(stream_type& res) {
   if(files_open_ >= concurrent_files_)
     return;
   while(paths_cur_ != paths_end_) {
     std::string path = *paths_cur_;
     ++paths_cur_;
     res.reset(new file_stream(path.c_str(), *this));
     if(res->good())
       return;
     res.reset();
     throw std::runtime_error(err::msg() << "Can't open file '" << path << "'");
   }
 }
开发者ID:dfajar2,项目名称:KAT,代码行数:13,代码来源:stream_manager.hpp

示例4: open_next_pipe

 void open_next_pipe(stream_type& res) {
   while(!free_pipes_.empty()) {
     const char* path = free_pipes_.front();
     free_pipes_.pop_front();
     res.reset(new pipe_stream(path, *this));
     if(res->good()) {
       busy_pipes_.insert(path);
       return;
     }
     // The pipe failed to open, so it is not marked as busy. This
     // reset will make us forget about this path.
     res.reset();
   }
 }
开发者ID:dfajar2,项目名称:KAT,代码行数:14,代码来源:stream_manager.hpp

示例5: flush

			std::pair<uint64_t,uint64_t> flush(stream_type & out)
			{
				uint64_t const start = out.tellp();

				if ( pc != pa )
				{
					std::sort(pa,pc);
					out.write(reinterpret_cast<char const *>(pa),(pc-pa)*sizeof(element_type));
					pc = pa;
				}

				uint64_t const end = out.tellp();

				return std::pair<uint64_t,uint64_t>(start,end);
			}
开发者ID:gt1,项目名称:libmaus2,代码行数:15,代码来源:Buffer.hpp

示例6: readAlignmentGz

			static bool readAlignmentGz(
				stream_type & GZ,
				::libmaus::bambam::BamAlignment & alignment,
				::libmaus::bambam::BamHeader const * bamheader = 0,
				bool const validate = true
			)
			{
				/* read alignment block size */
				int64_t const bs0 = GZ.get();
				int64_t const bs1 = GZ.get();
				int64_t const bs2 = GZ.get();
				int64_t const bs3 = GZ.get();
				if ( bs3 < 0 )
					// reached end of file
					return false;
				
				/* assemble block size as LE integer */
				alignment.blocksize = (bs0 << 0) | (bs1 << 8) | (bs2 << 16) | (bs3 << 24) ;

				/* read alignment block */
				if ( alignment.blocksize > alignment.D.size() )
					alignment.D = ::libmaus::bambam::BamAlignment::D_array_type(alignment.blocksize,false);
				GZ.read(reinterpret_cast<char *>(alignment.D.begin()),alignment.blocksize);

				if ( static_cast<int64_t>(GZ.gcount()) != static_cast<int64_t>(alignment.blocksize) )
				{
					::libmaus::exception::LibMausException se;
					se.getStream() << "Invalid alignment (EOF in alignment block of length " << alignment.blocksize  << ")" << std::endl;
					se.finish();
					throw se;
				}
				
				if ( validate )
				{
					libmaus_bambam_alignment_validity const validity = bamheader ? alignment.valid(*bamheader) : alignment.valid();
					if ( validity != ::libmaus::bambam::libmaus_bambam_alignment_validity_ok )
					{
						::libmaus::exception::LibMausException se;
						se.getStream() << "Invalid alignment: " << validity << std::endl;
						se.finish();
						throw se;					
					}
				}
				
				return true;
			}
开发者ID:allenday,项目名称:libmaus,代码行数:46,代码来源:BamAlignmentDecoder.hpp

示例7: CompactFastQHeader

			CompactFastQHeader(stream_type & stream)
			:
			  blocklen(::libmaus::util::NumberSerialisation::deserialiseNumber(stream)),
			  numreads(::libmaus::util::NumberSerialisation::deserialiseNumber(stream)),
			  qbits(stream.get()),
			  quant(stream)
			{
			
			}
开发者ID:srl147,项目名称:libmaus,代码行数:9,代码来源:CompactFastQHeader.hpp

示例8: peekBin

			static int64_t peekBin(stream_type & stream)
			{
				::libmaus2::bambam::BamIndexBinChunk BC;
				
				if ( stream.peek() == stream_type::traits_type::eof() )
					return -1;
					
				stream.read(
					reinterpret_cast<char *>(&BC),
					sizeof(::libmaus2::bambam::BamIndexBinChunk)
				);
				
				assert ( stream.gcount() == sizeof(::libmaus2::bambam::BamIndexBinChunk) );
				
				stream.clear();
				stream.seekg(-static_cast<int64_t>(sizeof(::libmaus2::bambam::BamIndexBinChunk)),std::ios::cur);
				
				return BC.refid;
			}
开发者ID:dkj,项目名称:libmaus2,代码行数:19,代码来源:BamIndexGenerator.hpp

示例9: operator

        /*!
         * The operator generates a file name based on the log record
         */
        result_type operator() (record_view const& rec) const
        {
            boost::log::aux::cleanup_guard< stream_type > cleanup1(m_FormattingStream);
            boost::log::aux::cleanup_guard< result_type::string_type > cleanup2(m_FileName);

            m_Formatter(rec, m_FormattingStream);
            m_FormattingStream.flush();

            return result_type(m_FileName);
        }
开发者ID:BranchMetrics,项目名称:react-native-branch-deep-linking,代码行数:13,代码来源:text_multifile_backend.hpp

示例10: do_manip

    void do_manip(stream_type& strm) const
        {
        if (error_m != std::ios_base::goodbit)
            strm.setstate(error_m);
        else
            {
            std::ios_base::iostate err(error_m);
            try
                {
                (*pf_m)(strm, arg1_m, arg2_m);
                }
            catch (...)
                {
                err = handle_error(strm);
                }

            if (err) strm.setstate(err);
            }
        }
开发者ID:andyprowl,项目名称:virtual-concepts,代码行数:19,代码来源:manip.hpp

示例11:

fcppt::io::basic_scoped_rdbuf<
	Ch,
	Traits
>::basic_scoped_rdbuf(
	stream_type &_source,
	stream_type &_receiver
)
:
	receiver_(
		_receiver
	),
	old_(
		_receiver.rdbuf()
	)
{
	receiver_.rdbuf(
		_source.rdbuf()
	);
}
开发者ID:vinzenz,项目名称:fcppt,代码行数:19,代码来源:basic_scoped_rdbuf_impl.hpp

示例12: getLEInteger

			static value_type getLEInteger(stream_type & stream)
			{
				value_type v = 0;
				
				for ( uint64_t i = 0; i < length; ++i )
					if ( stream.peek() == stream_type::traits_type::eof() )
					{
						libmaus2::exception::LibMausException ex;
						ex.getStream() << "Failed to little endian number of length " << length << " in BamIndex::getLEInteger." << std::endl;
						ex.finish();
						throw ex;		
					}
					else
					{
						v |= static_cast<value_type>(stream.get()) << (8*i);
					}
									
				return v;
			}
开发者ID:dkj,项目名称:libmaus2,代码行数:19,代码来源:BamIndex.hpp

示例13: getByte

			static uint8_t getByte(stream_type & in)
			{
				int const c = in.get();

				if ( c < 0 )
				{
					::libmaus2::exception::LibMausException se;
					se.getStream() << "Unexpected EOF in ::libmaus2::bambam::DecoderBase::getByte()" << std::endl;
					se.finish();
					throw se;
				}

				return c;
			}
开发者ID:whitwham,项目名称:libmaus2,代码行数:14,代码来源:DecoderBase.hpp

示例14: serialise

			void serialise(stream_type & out) const
			{
				IHWT->serialise(out);
				
				if ( IHWT->getN() )
					for ( int s = IHWT->enctable.minsym; s <= IHWT->enctable.maxsym; ++s )
						if ( s > 1 && IHWT->rank(s,IHWT->getN()-1) )
						{
							assert ( C[s].get() );
							C[s]->serialize(out);
						}
				
				out.flush();
			}
开发者ID:allenday,项目名称:libmaus,代码行数:14,代码来源:ImpCompactNumberArray.hpp

示例15:

 /*!
  * Copy constructor
  */
 file_name_composer_adapter(file_name_composer_adapter const& that) :
     m_Formatter(that.m_Formatter),
     m_FormattingStream(m_FileName)
 {
     m_FormattingStream.exceptions(std::ios_base::badbit | std::ios_base::failbit);
     m_FormattingStream.imbue(that.m_FormattingStream.getloc());
 }
开发者ID:13W,项目名称:icq-desktop,代码行数:10,代码来源:text_multifile_backend.hpp


注:本文中的stream_type类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。