Esempio n. 1
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;
}
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;
}
Esempio n. 3
0
/****************************************************************************
 Метод сохраняет информацию в контейнерах Автомата в бинарном потоке (файле).
 Производные классы перегружают метод, но должны в новом методе вызвать наш
 базовый для сохранения содежимого таблицы параметров.
*****************************************************************************/
void Automaton::SaveBin( lem::Stream &bin ) const
{
 bin.write_bool( param!=NULL );
 if( param!=NULL )
  param->SaveBin(bin);

 return;
}
Esempio n. 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;
}
Esempio n. 5
0
void TrFun_If::SaveBin( lem::Stream& bin ) const
{
 TrFunCall::SaveBin(bin);
 cond->SaveBin(bin);
 f_then->SaveBin(bin);
 bin.write_bool( f_else.NotNull() );
 if( f_else.NotNull() )
  f_else->SaveBin(bin);
  
 return;
}
Esempio n. 6
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;
}
Esempio n. 7
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;
}