Vcsn
2.2
Be Rational
|
Concrete Builder (the design pattern) for automata. More...
#include <edit-automaton.hh>
Public Types | |
using | super_t = automaton_editor |
using | automaton_t = name_automaton< Aut > |
using | string_t = super_t::string_t |
Public Types inherited from vcsn::automaton_editor | |
using | string_t = symbol |
Public Member Functions | |
edit_automaton (const context_t &ctx) | |
virtual bool | open (bool o) override final |
Whether unknown letters should be added, or rejected. More... | |
virtual void | add_state (string_t s) override final |
Register the existence of state named s. More... | |
virtual void | add_pre (string_t s) override final |
Register that state named s is preinitial. More... | |
virtual void | add_post (string_t s) override final |
Register that state named s is postfinal. More... | |
virtual void | add_initial (string_t s, string_t weight=string_t{}) override final |
virtual void | add_final (string_t s, string_t weight=string_t{}) override final |
virtual void | add_transition (string_t src, string_t dst, string_t label, string_t weight=string_t{}) override final |
Add a transition from src to dst. More... | |
virtual void | add_entry (string_t src, string_t dst, string_t entry) override final |
Add transitions from src to dst, labeled by entry. More... | |
virtual dyn::automaton | result () override final |
Return the built automaton. More... | |
virtual void | reset () override final |
Detach the built automaton. More... | |
Public Member Functions inherited from vcsn::automaton_editor | |
virtual | ~automaton_editor () |
void | set_separator (char c) |
Set the label separator. Defaults to '+'. More... | |
Private Types | |
using | context_t = context_t_of< automaton_t > |
using | entry_t = typename polynomialset< context_t >::value_t |
using | state_t = state_t_of< automaton_t > |
using | label_t = label_t_of< automaton_t > |
using | labelset_t = labelset_t_of< automaton_t > |
using | weight_t = weight_t_of< automaton_t > |
using | entry_map = std::unordered_map< string_t, entry_t > |
Memoize entry conversion. More... | |
using | label_map = std::unordered_map< string_t, label_t > |
Memoize label conversion. More... | |
using | weight_map = std::unordered_map< string_t, weight_t > |
Memoize weight conversion. More... | |
Private Member Functions | |
label_t | label_ (string_t l) |
Convert a label string to its value. More... | |
weight_t | weight_ (string_t w) |
Convert a weight string to its value. More... | |
state_t | state_ (string_t k) |
Convert a state name to a state handler. More... | |
Private Attributes | |
automaton_t | res_ |
The automaton under construction. More... | |
polynomialset< context_t > | ps_ |
Entries handler. More... | |
entry_map | emap_ |
label_map | lmap_ |
weight_map | wmap_ |
Additional Inherited Members | |
Protected Attributes inherited from vcsn::automaton_editor | |
char | sep_ = '+' |
The label separator. More... | |
Concrete Builder (the design pattern) for automata.
Returns (via result()) an allocated automaton.
FIXME: cannot be reused for several automata.
Definition at line 84 of file edit-automaton.hh.
using vcsn::edit_automaton< Aut >::automaton_t = name_automaton<Aut> |
Definition at line 88 of file edit-automaton.hh.
|
private |
Definition at line 92 of file edit-automaton.hh.
|
private |
Memoize entry conversion.
Definition at line 253 of file edit-automaton.hh.
|
private |
Definition at line 93 of file edit-automaton.hh.
|
private |
Memoize label conversion.
Definition at line 256 of file edit-automaton.hh.
|
private |
Definition at line 95 of file edit-automaton.hh.
|
private |
Definition at line 96 of file edit-automaton.hh.
|
private |
Definition at line 94 of file edit-automaton.hh.
using vcsn::edit_automaton< Aut >::string_t = super_t::string_t |
Definition at line 89 of file edit-automaton.hh.
using vcsn::edit_automaton< Aut >::super_t = automaton_editor |
Definition at line 87 of file edit-automaton.hh.
|
private |
Memoize weight conversion.
Definition at line 259 of file edit-automaton.hh.
|
private |
Definition at line 97 of file edit-automaton.hh.
|
inline |
Definition at line 100 of file edit-automaton.hh.
|
inlinefinaloverridevirtual |
Add transitions from src to dst, labeled by entry.
Implements vcsn::automaton_editor.
Definition at line 163 of file edit-automaton.hh.
References vcsn::conv(), vcsn::edit_automaton< Aut >::emap_, vcsn::label_of(), vcsn::edit_automaton< Aut >::ps_, vcsn::require(), vcsn::edit_automaton< Aut >::res_, vcsn::automaton_editor::sep_, vcsn::edit_automaton< Aut >::state_(), VCSN_REQUIRE, and vcsn::weight_of().
|
inlinefinaloverridevirtual |
Implements vcsn::automaton_editor.
Definition at line 142 of file edit-automaton.hh.
|
inlinefinaloverridevirtual |
Implements vcsn::automaton_editor.
Definition at line 136 of file edit-automaton.hh.
|
inlinefinaloverridevirtual |
Register that state named s is postfinal.
Implements vcsn::automaton_editor.
Definition at line 130 of file edit-automaton.hh.
References vcsn::edit_automaton< Aut >::res_.
|
inlinefinaloverridevirtual |
Register that state named s is preinitial.
Implements vcsn::automaton_editor.
Definition at line 123 of file edit-automaton.hh.
References vcsn::edit_automaton< Aut >::res_.
|
inlinefinaloverridevirtual |
Register the existence of state named s.
Implements vcsn::automaton_editor.
Definition at line 116 of file edit-automaton.hh.
References vcsn::edit_automaton< Aut >::state_().
|
inlinefinaloverridevirtual |
Add a transition from src to dst.
Implements vcsn::automaton_editor.
Definition at line 148 of file edit-automaton.hh.
|
inlineprivate |
Convert a label string to its value.
Definition at line 220 of file edit-automaton.hh.
References vcsn::conv(), vcsn::edit_automaton< Aut >::lmap_, and vcsn::edit_automaton< Aut >::res_.
|
inlinefinaloverridevirtual |
Whether unknown letters should be added, or rejected.
o | whether to accept |
Implements vcsn::automaton_editor.
Definition at line 109 of file edit-automaton.hh.
References vcsn::edit_automaton< Aut >::res_.
Referenced by vcsn::edit_automaton< Aut >::result().
|
inlinefinaloverridevirtual |
Detach the built automaton.
Implements vcsn::automaton_editor.
Definition at line 212 of file edit-automaton.hh.
References vcsn::edit_automaton< Aut >::res_.
|
inlinefinaloverridevirtual |
Return the built automaton.
Implements vcsn::automaton_editor.
Definition at line 204 of file edit-automaton.hh.
References vcsn::dyn::make_automaton(), vcsn::edit_automaton< Aut >::open(), and vcsn::edit_automaton< Aut >::res_.
|
inlineprivate |
Convert a state name to a state handler.
Definition at line 242 of file edit-automaton.hh.
References vcsn::edit_automaton< Aut >::res_.
Referenced by vcsn::edit_automaton< Aut >::add_entry(), and vcsn::edit_automaton< Aut >::add_state().
|
inlineprivate |
Convert a weight string to its value.
Definition at line 231 of file edit-automaton.hh.
References vcsn::conv(), vcsn::edit_automaton< Aut >::res_, and vcsn::edit_automaton< Aut >::wmap_.
|
private |
Definition at line 254 of file edit-automaton.hh.
Referenced by vcsn::edit_automaton< Aut >::add_entry().
|
private |
Definition at line 257 of file edit-automaton.hh.
Referenced by vcsn::edit_automaton< Aut >::label_().
|
private |
Entries handler.
Definition at line 250 of file edit-automaton.hh.
Referenced by vcsn::edit_automaton< Aut >::add_entry().
|
private |
The automaton under construction.
Definition at line 248 of file edit-automaton.hh.
Referenced by vcsn::edit_automaton< Aut >::add_entry(), vcsn::edit_automaton< Aut >::add_post(), vcsn::edit_automaton< Aut >::add_pre(), vcsn::edit_automaton< Aut >::label_(), vcsn::edit_automaton< Aut >::open(), vcsn::edit_automaton< Aut >::reset(), vcsn::edit_automaton< Aut >::result(), vcsn::edit_automaton< Aut >::state_(), and vcsn::edit_automaton< Aut >::weight_().
|
private |
Definition at line 260 of file edit-automaton.hh.
Referenced by vcsn::edit_automaton< Aut >::weight_().