void PatternDefaultLinkage::SaveBin( lem::Stream &bin ) const
{
 bin.write_bool(optional_node);
 bin.write( &marker_name, sizeof(marker_name) );
 bin.write( &node_name, sizeof(node_name) );
 return;
}
示例#2
0
/**************************************************
 Сохраняет содержимое в указанном бинарном потоке.
***************************************************/
void Word_Form::SaveBin( lem::Stream &bin ) const
{
 bool p = !!name;
 bin.write_bool( p );
 if( p )
  name->SaveBin(bin);

 p = !!normalized;
 bin.write_bool(p);
 if(p)
  normalized->SaveBin(bin);

// lexem_owner.SaveBin(bin);
// e_list.SaveBin(bin);
 pair.SaveBin(bin);
// bin.write( &tfield,     sizeof(tfield)     );
 bin.write( &entry_key,  sizeof(entry_key)  );
 bin.write( &val,        sizeof(val)        );
 bin.write( &score,        sizeof(score)        );
// bin.write( &icenter,    sizeof(icenter)    );
 bin.write( &origin_pos, sizeof(origin_pos) );

 bin.write_int( CastSizeToInt(alt.size()) );
 for( lem::Container::size_type i=0; i<alt.size(); ++i )
  alt[i]->SaveBin(bin);

 return;
}
示例#3
0
void PatternConstraint::SaveBin( lem::Stream &bin ) const
{
 bin.write( &from_marker, sizeof(from_marker) );
 bin.write( &to_marker, sizeof(to_marker) );
 bin.write_int( from_coord_id );
 bin.write_int( to_coord_id );
 bin.write( &constraint_func, sizeof(constraint_func) );
 return;
}
示例#4
0
void PatternLink::SaveBin( lem::Stream &bin ) const
{
 bin.write( &from_marker, sizeof(from_marker) );
 bin.write( &from_node, sizeof(from_node) );
 bin.write( &to_marker, sizeof(to_marker) );
 bin.write( &to_node, sizeof(to_node) );
 bin.write( &link_type, sizeof(link_type) );
 bin.write_bool(optional_to_node);
 return;
}
示例#5
0
void LA_WordProjBuffer::SaveBin( lem::Stream &bin ) const
{
 buffer.SaveBin(bin);
 list.SaveBin(bin);
 bin.write( &nmaxproj,    sizeof(nmaxproj)    );
 bin.write( &n_calls,     sizeof(n_calls)     );
 bin.write( &n_succ,      sizeof(n_succ)      );
 bin.write( &n_succ_prim, sizeof(n_succ_prim) );
 bin.write( &NTOT,        sizeof(NTOT)        );

 bin.write( &use_compiled, sizeof(use_compiled) );
 bin.write( &update_list, sizeof(update_list) );

 return;
}
示例#6
0
void Tree_Node::SaveBin(lem::Stream &bin) const
{
    bin.write(&ilink, sizeof(ilink));
    node->SaveBin(bin);
    child.SaveBin(bin);
    dims.SaveBin(bin);
    return;
}
示例#7
0
void TrFun_Lambda::SaveBin( lem::Stream& bin ) const
{ 
 TrFunCall::SaveBin(bin);
 ret_type.SaveBin(bin);
 bin.write( &name, sizeof(name) );
 arg_name.SaveBin(bin);
 locals.SaveBin(bin);
 return;
}
示例#8
0
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;
}
示例#9
0
void SG_calibrator::SaveBin(lem::Stream &bin) const
{
    bin.write_int(freq_type);
    bin.write(&word, sizeof(word));
    bin.write_int(id_class);
    coords.SaveBin(bin);
    bin.write_int(freq);

    return;
}
示例#10
0
void TreeDimension::SaveBin( lem::Stream &bin ) const
{
    bin.write( &name, sizeof(name) );

    bin.write_int( CastSizeToInt(nodes.size()) );
    for( lem::Container::size_type i=0; i<nodes.size(); ++i )
        nodes[i]->SaveBin(bin);

    return;
}
void TrFun_CreateWordform::SaveBin( lem::Stream& bin ) const
{
 TrFunCall::SaveBin(bin);

 ientry.SaveBin(bin);
 coords.SaveBin(bin);
 states.SaveBin(bin);
 bin.write( &form_name, sizeof(form_name) );

 return;
}
示例#12
0
void UCStringSet::Save_Packed( lem::Stream &bin ) const
{
 uint8_t N = size();

 LEM_CHECKIT_Z( N<128 );

 bin.write( &N, 1 );
 for( const_iterator i=begin(); i!=end(); i++ )
  lem::Save_Packed( *i, bin );

 return; 
}
示例#13
0
void TrFunction::SaveBin( lem::Stream& bin ) const
{
 bin.write( &name, sizeof(name) );
 ret_type.SaveBin(bin);

 arg_name.SaveBin(bin);
 arg_type.SaveBin(bin);

 bin.write_bool( body.NotNull() );
 if( body.NotNull() )
  body->SaveBin(bin);
 return;
}
示例#14
0
void TrType::SaveBin( lem::Stream& bin ) const
{
    bin.write( &is_const, sizeof(is_const) );
    bin.write( &type, sizeof(type) );
    return;
}
示例#15
0
void LA_ProjList::SaveBin( lem::Stream &bin ) const
{
 bin.write(&Char,sizeof(Char));
 Collect<LA_WordProjection>::SaveBin(bin);
 return;
}
示例#16
0
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;
}
示例#17
0
void SG_LanguageParam::SaveBin(lem::Stream &bin) const
{
    bin.write(&name, sizeof(name));
    values.SaveBin(bin);
    return;
}
void ExportCoordFunction_IfContains::SaveBin( lem::Stream & bin ) const
{
 ExportCoordFunction::SaveBin(bin);
 bin.write( &pair, sizeof(pair) );
 return;
}
示例#19
0
void TrFun_Var::SaveBin( lem::Stream& bin ) const
{
    TrFunCall::SaveBin(bin);
    bin.write( &var_name, sizeof(var_name) );
    return;
}