next up previous
Next: Warning Up: The Deterministic Automaton Classes Previous: Edges:

Interface for DFAs

The interface on the automaton class in ASTL is willingly limited to some very basic operations to allow maximal flexibility and to minimize the amount of work when creating a new automaton class. Data types are described in Section 6.2.
template <class sigma, class tag>
class DFA_*
{ 
public:
  typedef sigma Sigma;
  typedef tag Tag;
  typedef sigma::Alphabet Alphabet;
  typedef State;
  typedef Edges;

  State        new_state();
  void         set_trans(State from, Alphabet a, State to);
  void         del_trans(State s, Alphabet a);
  void         change_trans(State s, Alphabet a, State new_aim);
  void         del_state(State s);
  void         copy_state(State from, State to);
  State        duplicate_state(State s);
  State        delta1(State s, Alphabet a) const;
  const Edges& delta2(State s) const;
  Tag&         tag(State s);
  void         initial(State s);
  State        initial() const;
  void         read(istream &in);
  void         write(ostream &out) const;
  iterator     begin();
  iterator     end();
new_state* Returns a handler on a freshly allocated state.
set_trans* Adds a transition between states from and to with the letter a.
del_trans* Removes the transition with letter a from state s.
change_trans* Redirects the transition with letter a of state s toward state new_aim.
del_state* Removes state s.
copy_state* Overwrites state to with state from.
duplicate_state* Allocates a new state and copies state s into it. Semantically equivalent to dfa.copy_state(s, dfa.new_state());
delta1 Returns the aim of transition with letter a of state s. If the transition is undefined, returns the value dfa.null_state.
delta2 Returns the set of all outgoing transitions of state s.
tag Returns a reference on the tag of state s.
initial(State)* Sets the initial state to s.
initial() Returns the initial state or dfa.null_state if undefined.
read Reads the automaton from binary stream in.
write Writes the automaton to binary stream out.
begin Returns an iterator on the first state of Q.
end Returns a past-the-end iterator on Q.


 
next up previous
Next: Warning Up: The Deterministic Automaton Classes Previous: Edges:
Vincent Lemaout
12/9/1997