Vcsn  2.0
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vcsn::lazy_automaton_editor Class Reference

Build an automaton with unknown context. More...

#include <edit-automaton.hh>

Collaboration diagram for vcsn::lazy_automaton_editor:

Public Types

enum  labelset_type { labelset_type::empty, labelset_type::lal, labelset_type::lan, labelset_type::law }
 Labelset types, increasing generality. More...
 
using string_t = automaton_editor::string_t
 A hash-cons'ed string type. More...
 

Public Member Functions

void add_initial (string_t s, string_t w=string_t{})
 Add s as an initial state. More...
 
void add_final (string_t s, string_t w=string_t{})
 Add s as a final state. More...
 
void add_transition (string_t src, string_t dst, string_t lbl, string_t w=string_t{})
 Add an acceptor transition from src to dst, labeled by lbl. More...
 
void add_transition (string_t src, string_t dst, string_t lbl1, string_t lbl2, string_t w)
 Add a transducer transition from src to dst, labeled by (lbl1, lbl2). More...
 
dyn::automaton result ()
 Return the built automaton. More...
 
bool open (bool o)
 Whether unknown letters should be added, or rejected. More...
 
void reset ()
 Get ready to build another automaton. More...
 

Private Attributes

std::vector< std::tuple
< string_t, string_t, string_t,
string_t > > 
transitions_
 The collected transitions: (Source, Destination, Label, Weight). More...
 
std::vector< std::pair
< string_t, string_t > > 
initial_states_
 The collected initial states: (State, Weight). More...
 
std::vector< std::pair
< string_t, string_t > > 
final_states_
 The collected final states: (State, Weight). More...
 
labelset_type input_type_ = labelset_type::empty
 Labelset type for input tape. More...
 
labelset_type output_type_ = labelset_type::empty
 Labelset type for output tape. More...
 
bool weighted_ = false
 Whether we saw a non-empty weight. More...
 
bool real_ = false
 Whether we saw a period in a the weight. More...
 
bool open_ = false
 Whether the labelset is open. More...
 

Detailed Description

Build an automaton with unknown context.

Record the transitions, initial and final states as strings, and once the automata completed, decide what is its context, and build a genuine automaton.

Definition at line 270 of file edit-automaton.hh.

Member Typedef Documentation

A hash-cons'ed string type.

Definition at line 274 of file edit-automaton.hh.

Member Enumeration Documentation

Labelset types, increasing generality.

Enumerator
empty 
lal 
lan 
law 

Definition at line 277 of file edit-automaton.hh.

Member Function Documentation

void vcsn::lazy_automaton_editor::add_final ( string_t  s,
string_t  w = string_t{} 
)

Add s as a final state.

Definition at line 21 of file edit-automaton.cc.

References final_states_.

Referenced by vcsn::dyn::read_efsm(), and vcsn::dyn::read_fado().

void vcsn::lazy_automaton_editor::add_initial ( string_t  s,
string_t  w = string_t{} 
)

Add s as an initial state.

Definition at line 15 of file edit-automaton.cc.

References initial_states_.

Referenced by vcsn::dyn::read_efsm(), and vcsn::dyn::read_fado().

void vcsn::lazy_automaton_editor::add_transition ( string_t  src,
string_t  dst,
string_t  lbl,
string_t  w = string_t{} 
)

Add an acceptor transition from src to dst, labeled by lbl.

Add transitions from src to dst, labeled by entry.

Definition at line 82 of file edit-automaton.cc.

Referenced by vcsn::dyn::read_efsm(), and vcsn::dyn::read_fado().

void vcsn::lazy_automaton_editor::add_transition ( string_t  src,
string_t  dst,
string_t  lbl1,
string_t  lbl2,
string_t  w 
)

Add a transducer transition from src to dst, labeled by (lbl1, lbl2).

Add transitions from src to dst, labeled by entry.

Definition at line 57 of file edit-automaton.cc.

References input_type_, output_type_, real_, transitions_, and weighted_.

bool vcsn::lazy_automaton_editor::open ( bool  o)

Whether unknown letters should be added, or rejected.

Parameters
owhether to accept
Returns
the previous status.

Definition at line 91 of file edit-automaton.cc.

References open_.

Referenced by vcsn::dyn::read_efsm(), and vcsn::dyn::read_fado().

void vcsn::lazy_automaton_editor::reset ( )

Get ready to build another automaton.

Definition at line 128 of file edit-automaton.cc.

References final_states_, initial_states_, and transitions_.

dyn::automaton vcsn::lazy_automaton_editor::result ( )

Return the built automaton.

Create ctx and return the built automaton.

Definition at line 98 of file edit-automaton.cc.

References empty, final_states_, initial_states_, input_type_, lal, vcsn::dyn::make_automaton_editor(), vcsn::dyn::make_context(), open_, output_type_, real_, vcsn::to_string(), transitions_, and weighted_.

Referenced by vcsn::dyn::read_efsm(), and vcsn::dyn::read_fado().

Here is the call graph for this function:

Member Data Documentation

std::vector<std::pair<string_t, string_t> > vcsn::lazy_automaton_editor::final_states_
private

The collected final states: (State, Weight).

Definition at line 313 of file edit-automaton.hh.

Referenced by add_final(), reset(), and result().

std::vector<std::pair<string_t, string_t> > vcsn::lazy_automaton_editor::initial_states_
private

The collected initial states: (State, Weight).

Definition at line 311 of file edit-automaton.hh.

Referenced by add_initial(), reset(), and result().

labelset_type vcsn::lazy_automaton_editor::input_type_ = labelset_type::empty
private

Labelset type for input tape.

Definition at line 315 of file edit-automaton.hh.

Referenced by add_transition(), and result().

bool vcsn::lazy_automaton_editor::open_ = false
private

Whether the labelset is open.

Definition at line 323 of file edit-automaton.hh.

Referenced by open(), and result().

labelset_type vcsn::lazy_automaton_editor::output_type_ = labelset_type::empty
private

Labelset type for output tape.

Definition at line 317 of file edit-automaton.hh.

Referenced by add_transition(), and result().

bool vcsn::lazy_automaton_editor::real_ = false
private

Whether we saw a period in a the weight.

Definition at line 321 of file edit-automaton.hh.

Referenced by add_transition(), and result().

std::vector<std::tuple<string_t, string_t, string_t, string_t> > vcsn::lazy_automaton_editor::transitions_
private

The collected transitions: (Source, Destination, Label, Weight).

Definition at line 309 of file edit-automaton.hh.

Referenced by add_transition(), reset(), and result().

bool vcsn::lazy_automaton_editor::weighted_ = false
private

Whether we saw a non-empty weight.

Definition at line 319 of file edit-automaton.hh.

Referenced by add_transition(), and result().


The documentation for this class was generated from the following files: