• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ lem::Stream类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SaveBin

void LA_ProjList::SaveBin( lem::Stream &bin ) const
{
 bin.write(&Char,sizeof(Char));
 Collect<LA_WordProjection>::SaveBin(bin);
 return;
}
开发者ID:mcdir,项目名称:GrammarEngine,代码行数:6,代码来源:la_proj_list.cpp


示例2: SaveBin

void ExportCoordFunction_Add::SaveBin(lem::Stream & bin) const
{
    ExportCoordFunction::SaveBin(bin);
    bin.write(&pair, sizeof(pair));
    return;
}
开发者ID:Koziev,项目名称:GrammarEngine,代码行数:6,代码来源:ExportCoordFunction_Add.cpp


示例3: Delete_Entries

void WordEntries_File::LoadBin(lem::Stream &bin)
{
    ml_ref.LoadBin(bin);

    Delete_Entries();

    entry_pos.clear();

    coord_ref.LoadBin(bin);

    /*
     LEM_CHECKIT_Z( group.empty() );
     const int n_group = bin.read_int();
     for( int i=0; i<n_group; ++i )
      {
       SG_EntryGroup *g = new SG_EntryGroup(bin);
       group.insert( std::make_pair( g->GetKey(), g ) );
      }
    */
    lookup_table.LoadBin(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.LoadBin(bin);

    u_entry.LoadBin(bin);

    ML_entry_key_list.LoadBin(bin);
    ML_entry_lex_list.LoadBin(bin);
    ML_entry_pre_list.LoadBin(bin);

    bin.read(&max_ml_len, sizeof(max_ml_len));
    bin.read(predefined_entry, sizeof(predefined_entry));

    const int n_entry = bin.read_int();
    entry.resize(n_entry);

    // загрузили все обязательные данные, теперь опциональная загрузка.
    lem::Stream::pos_type epos_begin_pos = 0;
    lem::Stream::pos_type entries_begin_pos = 0;
    lem::Stream::pos_type end_pos = 0;

    bin.read(&epos_begin_pos, sizeof(epos_begin_pos));
    bin.read(&entries_begin_pos, sizeof(entries_begin_pos));
    bin.read(&end_pos, sizeof(end_pos));

    if (lazy_load)
    {
        // статьи пока не загружаем.

        entry.Nullify();

        // прочитаем только список позиций начала каждой статьи.
        bin.seekp(epos_begin_pos);
        entry_pos.LoadBin(bin);

        lem::MCollect< std::pair<int, int> > key_to_index_tmp;
        key_to_index_tmp.LoadBin(bin);
        for (lem::Container::size_type i = 0; i < key_to_index_tmp.size(); ++i)
            key_to_index.insert(key_to_index_tmp[i]);

        lem::MCollect<Lexem> ML_tmp;
        ML_tmp.LoadBin(bin);
        for (lem::Container::size_type i = 0; i < ML_tmp.size(); ++i)
            ML_fronts.insert(ML_tmp[i]);

        ML_tmp.LoadBin(bin);
        for (lem::Container::size_type i = 0; i < ML_tmp.size(); ++i)
            ML_ML.insert(ML_tmp[i]);
    }
    else
    {
        bin.seekp(entries_begin_pos);

        entry_pos.clear();

        // список словарных статей загружаем сразу целиком в память.
        for (int i0 = 0; i0 < n_entry; i0++)
        {
            entry[i0] = new SG_Entry;
            entry[i0]->LoadBin(bin);

            if (entry[i0] != bogus_entry)
                entry[i0]->ReattachToRefs(*sg);
        }

        for (lem::Container::size_type ie = 0; ie < entry.size(); ie++)
        {
            key_to_index.insert(std::make_pair(entry[ientry[ie]]->GetKey(), ie));
        }
//.........这里部分代码省略.........
开发者ID:Koziev,项目名称:GrammarEngine,代码行数:101,代码来源:WordEntries_File.cpp


示例4: LoadBin

void LA_ProjList::LoadBin( lem::Stream &bin )
{
 bin.read(&Char,sizeof(Char));
 Collect<LA_WordProjection>::LoadBin(bin);
 return;
}
开发者ID:mcdir,项目名称:GrammarEngine,代码行数:6,代码来源:la_proj_list.cpp


示例5: SaveBin

void ExportCoordFunction::SaveBin( lem::Stream & bin ) const
{
 bin.write_int(type);
}
开发者ID:mcdir,项目名称:GrammarEngine,代码行数:4,代码来源:ExportCoordFunction.cpp


示例6: sizeof

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;
}
开发者ID:Koziev,项目名称:GrammarEngine,代码行数:89,代码来源:WordEntries_File.cpp


示例7: SaveBin

void LEMM_Compiler::SaveBin( lem::Stream & bin ) const
{
 bin.write_bool(true);

 const lem::uint32_t model_flags = 0x0000000E;
 bin.write( &model_flags, sizeof(model_flags) );
 bin.write_int( suffix_len );

 bin.write_int( CastSizeToInt(suffices.size()) );
 for( lem::Container::size_type i=0; i<suffices.size(); ++i )
  {
   bin.write( &suffices[i].first, sizeof(suffices[i].first) );
   lem::Save_Packed(suffices[i].second,bin);
  }

 bin.write_int( CastSizeToInt(words.size()) );
 for( lem::Container::size_type i=0; i<words.size(); ++i )
  {
   bin.write( &words[i].first, sizeof(words[i].first) );
   lem::Save_Packed(words[i].second,bin);
  }

 bin.write_int( CastSizeToInt(ngram2.size()) );
 for( lem::Container::size_type i=0; i<ngram2.size(); ++i )
  bin.write( &ngram2[i], sizeof(ngram2[i]) );

 bin.write_int( CastSizeToInt(ngram2_1.size()) );
 for( lem::Container::size_type i=0; i<ngram2_1.size(); ++i )
  bin.write( &ngram2_1[i], sizeof(ngram2_1[i]) );

 bin.write_int( CastSizeToInt(ngram3.size()) );
 for( lem::Container::size_type i=0; i<ngram3.size(); ++i )
  bin.write( &ngram3[i], sizeof(ngram3[i]) );

 bin.write_int( CastSizeToInt(ngram3_1.size()) );
 for( lem::Container::size_type i=0; i<ngram3_1.size(); ++i )
  bin.write( &ngram3_1[i], sizeof(ngram3_1[i]) );

 bin.write_int( CastSizeToInt(ngram3_2.size()) );
 for( lem::Container::size_type i=0; i<ngram3_2.size(); ++i )
  bin.write( &ngram3_2[i], sizeof(ngram3_2[i]) );


 bin.write_int( CastSizeToInt(ngram4.size()) );
 for( lem::Container::size_type i=0; i<ngram4.size(); ++i )
  bin.write( &ngram4[i], sizeof(ngram4[i]) );

 return;
}
开发者ID:Koziev,项目名称:GrammarEngine,代码行数:49,代码来源:LEMM_Compiler.cpp


示例8: LoadBin

void TrFun_Var::LoadBin( lem::Stream& bin )
{
    TrFunCall::LoadBin(bin);
    bin.read( &var_name, sizeof(var_name) );
    return;
}
开发者ID:Koziev,项目名称:GrammarEngine,代码行数:6,代码来源:TrFun_Var.cpp


示例9: SaveBin

void TrFun_Var::SaveBin( lem::Stream& bin ) const
{
    TrFunCall::SaveBin(bin);
    bin.write( &var_name, sizeof(var_name) );
    return;
}
开发者ID:Koziev,项目名称:GrammarEngine,代码行数:6,代码来源:TrFun_Var.cpp


示例10: LoadBin

void TrType::LoadBin( lem::Stream& bin )
{
    bin.read( &is_const, sizeof(is_const) );
    bin.read( &type, sizeof(type) );
    return;
}
开发者ID:Koziev,项目名称:GrammarEngine,代码行数:6,代码来源:TrType.cpp


示例11: SaveBin

void TrType::SaveBin( lem::Stream& bin ) const
{
    bin.write( &is_const, sizeof(is_const) );
    bin.write( &type, sizeof(type) );
    return;
}
开发者ID:Koziev,项目名称:GrammarEngine,代码行数:6,代码来源:TrType.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ lem::UCString类代码示例发布时间:2022-05-31
下一篇:
C++ lem::MCollect类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap