本文整理汇总了C++中lem::Stream::tellp方法的典型用法代码示例。如果您正苦于以下问题:C++ Stream::tellp方法的具体用法?C++ Stream::tellp怎么用?C++ Stream::tellp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lem::Stream
的用法示例。
在下文中一共展示了Stream::tellp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveBin
void WordEntries_File::SaveBin(lem::Stream &bin) const
{
#if defined SOL_SAVEBIN
ml_ref.SaveBin(bin);
coord_ref.SaveBin(bin);
lookup_table.SaveBin(bin);
/*
// #if LEM_DEBUGGING==1
lem::mout->eol();
for( int kkk=0; kkk<lookup_table.lexem_slot.size(); ++kkk )
{
WordEntries_LookUpItem xxx = lookup_table.lexem_slot[kkk];
lem::mout->printf( "x[%d]=%d,%d ", kkk, xxx.start_index, xxx.len );
}
lem::mout->eol();
// #endif
*/
ientry.SaveBin(bin);
u_entry.SaveBin(bin);
ML_entry_key_list.SaveBin(bin);
ML_entry_lex_list.SaveBin(bin);
ML_entry_pre_list.SaveBin(bin);
bin.write(&max_ml_len, sizeof(max_ml_len));
bin.write(predefined_entry, sizeof(predefined_entry));
bin.write_int(CastSizeToInt(entry.size()));
lem::Stream::pos_type p1 = bin.tellp();
lem::Stream::pos_type epos_begin_pos = 0;
lem::Stream::pos_type entries_begin_pos = 0;
lem::Stream::pos_type end_pos = 0;
bin.write(&epos_begin_pos, sizeof(epos_begin_pos)); // сюда впишем позицию списка позиций статей
bin.write(&entries_begin_pos, sizeof(entries_begin_pos)); // а сюда - начало списка статей
bin.write(&end_pos, sizeof(end_pos)); // а сюда - позицию после лексикона, чтобы другие модули могли продолжить загрузку из бинарного файла
lem::MCollect<lem::Stream::pos_type> entry_pos_tmp;
entry_pos_tmp.resize(entry.size());
epos_begin_pos = bin.tellp();
entry_pos_tmp.SaveBin(bin);
lem::MCollect< std::pair<int, int> > key_to_index_tmp;
key_to_index_tmp.reserve(key_to_index.size());
for (std::map< int/*entry_key*/, int/*entry_index*/ >::const_iterator it = key_to_index.begin(); it != key_to_index.end(); ++it)
{
key_to_index_tmp.push_back(*it);
}
key_to_index_tmp.SaveBin(bin);
lem::MCollect<Lexem> ML_fronts_tmp;
ML_fronts_tmp.reserve(ML_fronts.size());
for (std::set<Lexem>::const_iterator it = ML_fronts.begin(); it != ML_fronts.end(); ++it)
ML_fronts_tmp.push_back(*it);
ML_fronts_tmp.SaveBin(bin);
lem::MCollect<Lexem> ML_ML_tmp;
ML_ML_tmp.reserve(ML_ML.size());
for (std::set<Lexem>::const_iterator it = ML_ML.begin(); it != ML_ML.end(); ++it)
ML_ML_tmp.push_back(*it);
ML_ML_tmp.SaveBin(bin);
entries_begin_pos = bin.tellp();
for (lem::Container::size_type i = 0; i < entry.size(); i++)
{
entry_pos_tmp[i] = bin.tellp();
entry[i]->SaveBin(bin);
}
end_pos = bin.tellp();
bin.seekp(p1);
bin.write(&epos_begin_pos, sizeof(epos_begin_pos));
bin.write(&entries_begin_pos, sizeof(entries_begin_pos));
bin.write(&end_pos, sizeof(end_pos));
entry_pos_tmp.SaveBin(bin);
bin.seekp(end_pos);
#endif
return;
}