本文整理汇总了C++中stream_type::flush方法的典型用法代码示例。如果您正苦于以下问题:C++ stream_type::flush方法的具体用法?C++ stream_type::flush怎么用?C++ stream_type::flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stream_type
的用法示例。
在下文中一共展示了stream_type::flush方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例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);
}
示例3: 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();
}
示例4: createFinalStream
uint64_t createFinalStream(stream_type & out)
{
flush();
uint64_t p = 0;
p += ::libmaus::util::NumberSerialisation::serialiseNumber(out,symbols); // n
p += root->serialize(out); // huffman code tree
p += ::libmaus::util::NumberSerialisation::serialiseNumber(out,contexts.size()); // number of bit vectors
std::vector<uint64_t> nodeposvec;
for ( uint64_t i = 0; i < contexts.size(); ++i )
{
nodeposvec.push_back(p);
uint64_t const blockswritten = contexts[i]->blockswritten;
uint64_t const datawordswritten = 6*blockswritten;
uint64_t const allwordswritten = 8*blockswritten;
contexts[i].reset();
tmpcnt.closeOutputTempFile(i);
// bits written
p += ::libmaus::serialize::Serialize<uint64_t>::serialize(out,64*datawordswritten);
// auto array header (words written)
p += ::libmaus::serialize::Serialize<uint64_t>::serialize(out,allwordswritten);
//std::string const filename = outputfilenames[i];
//::libmaus::aio::CheckedInputStream istr(filename);
std::istream & istr = tmpcnt.openInputTempFile(i);
// std::ifstream istr(filename.c_str(),std::ios::binary);
// std::cerr << "Copying " << allwordswritten << " from stream " << filename << std::endl;
::libmaus::util::GetFileSize::copy (istr, out, allwordswritten, sizeof(uint64_t));
p += allwordswritten * sizeof(uint64_t);
tmpcnt.closeInputTempFile(i);
// remove(filename.c_str());
}
uint64_t const indexpos = p;
p += ::libmaus::util::NumberSerialisation::serialiseNumberVector(out,nodeposvec);
p += ::libmaus::util::NumberSerialisation::serialiseNumber(out,indexpos);
out.flush();
return p;
}
示例5: term
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();
}