Logo Search packages:      
Sourcecode: lttoolbox version File versions  Download package

void Transducer::write ( FILE *  output  ) 

Write method

Parameters:
output the stream to write to

Definition at line 470 of file Transducer.C.

References finals, initial, Compression::multibyte_write(), and transitions.

{
  Compression::multibyte_write(initial, output);
  Compression::multibyte_write(finals.size(), output);
  int base = 0;
  for(set<int>::iterator it = finals.begin(), limit = finals.end(); 
      it != limit; it++)
  {
    Compression::multibyte_write(*it - base, output);
    base = *it;
  }

  base = transitions.size();
  Compression::multibyte_write(base, output);
  for(map<int, multimap<int, int> >::iterator it = transitions.begin(),
                                              limit = transitions.end();
      it != limit; it++)
  {
    Compression::multibyte_write(it->second.size(), output);
    int tagbase = 0;
    for(multimap<int, int>::iterator it2 = it->second.begin(),
                                     limit2 = it->second.end();
        it2 != limit2; it2++)
    {
      Compression::multibyte_write(it2->first-tagbase, output);
      tagbase = it2->first; 

      if(it2->second >= it->first)
      {
        Compression::multibyte_write(it2->second-it->first, output);
      }
      else
      {
        Compression::multibyte_write(it2->second+base-it->first, output);
      }
    }
  }
}


Generated by  Doxygen 1.6.0   Back to index