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

void Transducer::read ( FILE *  input  ) 

Read method

Parameters:
input the stream to read from

Definition at line 510 of file Transducer.C.

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

{
  Transducer new_t;

  new_t.initial = Compression::multibyte_read(input);
  int finals_size = Compression::multibyte_read(input);

  int base = 0;
  while(finals_size > 0)
  {
    finals_size--;

    base += Compression::multibyte_read(input);
    new_t.finals.insert(base);
  }

  base = Compression::multibyte_read(input);
  int number_of_states = base;
  int current_state = 0; 
  while(number_of_states > 0)
  {
    int number_of_local_transitions = Compression::multibyte_read(input);
    int tagbase = 0;
    while(number_of_local_transitions > 0)
    {
      number_of_local_transitions--;
      int tag = Compression::multibyte_read(input);
      int state = (current_state + Compression::multibyte_read(input)) % base;
      if(new_t.transitions.find(state) == new_t.transitions.end())
      {
        new_t.transitions[state].clear(); // force create
      }
      new_t.transitions[current_state].insert(pair<int, int>(tag+tagbase, state));
      tagbase += tag;
    }    
    number_of_states--;
    current_state++;
  }

  *this = new_t;
}


Generated by  Doxygen 1.6.0   Back to index