next up previous
Next: Basic Algorithms Up: Declarations Previous: Declaration of a DFA

Declaration of an adapter

We show in this section how to declare a DFA_compact which is an automaton adapter to construct it by copy or by reading it from a binary stream :
#include "dfa_map.hh"
#include "dfa_compact.hh"
#include "tag.hh"
#include "alphabet.hh"
#include <iostream.h>

  ofstream output_file;
  ifstream input_file;"file_name", ios::out | ios::bin);"file_name", ios::in | ios::bin);

  typedef DFA_matrix<Range_alphabet<char, 'a', 'z'>, STag> DFA_type;
  DFA_type dfa;
  // Construct the automaton
  // ....
  // Then declare the compact automaton
  DFA_compact<DFA_type> dfa_c1(dfa);        // Contruction by copy
  Dfa_c1.write(output_file);                // Writing to disk
  DFA_compact<DFA_type> dfa_c2(input_file); // Reading from disk

Vincent Lemaout