Vcsn  2.2
Be Rational
vcsn::edit_automaton< Aut > Class Template Reference

Concrete Builder (the design pattern) for automata. More...

#include <edit-automaton.hh>

Inheritance diagram for vcsn::edit_automaton< Aut >:
Collaboration diagram for vcsn::edit_automaton< Aut >:

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_tps_
 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...
 

Detailed Description

template<Automaton Aut>
class vcsn::edit_automaton< Aut >

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.

Member Typedef Documentation

template<Automaton Aut>
using vcsn::edit_automaton< Aut >::automaton_t = name_automaton<Aut>

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

template<Automaton Aut>
using vcsn::edit_automaton< Aut >::context_t = context_t_of<automaton_t>
private

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

template<Automaton Aut>
using vcsn::edit_automaton< Aut >::entry_map = std::unordered_map<string_t, entry_t>
private

Memoize entry conversion.

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

template<Automaton Aut>
using vcsn::edit_automaton< Aut >::entry_t = typename polynomialset<context_t>::value_t
private

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

template<Automaton Aut>
using vcsn::edit_automaton< Aut >::label_map = std::unordered_map<string_t, label_t>
private

Memoize label conversion.

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

template<Automaton Aut>
using vcsn::edit_automaton< Aut >::label_t = label_t_of<automaton_t>
private

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

template<Automaton Aut>
using vcsn::edit_automaton< Aut >::labelset_t = labelset_t_of<automaton_t>
private

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

template<Automaton Aut>
using vcsn::edit_automaton< Aut >::state_t = state_t_of<automaton_t>
private

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

template<Automaton Aut>
using vcsn::edit_automaton< Aut >::string_t = super_t::string_t

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

template<Automaton Aut>
using vcsn::edit_automaton< Aut >::super_t = automaton_editor

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

template<Automaton Aut>
using vcsn::edit_automaton< Aut >::weight_map = std::unordered_map<string_t, weight_t>
private

Memoize weight conversion.

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

template<Automaton Aut>
using vcsn::edit_automaton< Aut >::weight_t = weight_t_of<automaton_t>
private

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

Constructor & Destructor Documentation

template<Automaton Aut>
vcsn::edit_automaton< Aut >::edit_automaton ( const context_t ctx)
inline

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

Member Function Documentation

template<Automaton Aut>
virtual void vcsn::edit_automaton< Aut >::add_entry ( string_t  src,
string_t  dst,
string_t  entry 
)
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().

Here is the call graph for this function:

template<Automaton Aut>
virtual void vcsn::edit_automaton< Aut >::add_final ( string_t  s,
string_t  weight = string_t{} 
)
inlinefinaloverridevirtual

Implements vcsn::automaton_editor.

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

template<Automaton Aut>
virtual void vcsn::edit_automaton< Aut >::add_initial ( string_t  s,
string_t  weight = string_t{} 
)
inlinefinaloverridevirtual

Implements vcsn::automaton_editor.

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

template<Automaton Aut>
virtual void vcsn::edit_automaton< Aut >::add_post ( string_t  s)
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_.

template<Automaton Aut>
virtual void vcsn::edit_automaton< Aut >::add_pre ( string_t  s)
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_.

template<Automaton Aut>
virtual void vcsn::edit_automaton< Aut >::add_state ( string_t  s)
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_().

Here is the call graph for this function:

template<Automaton Aut>
virtual void vcsn::edit_automaton< Aut >::add_transition ( string_t  src,
string_t  dst,
string_t  label,
string_t  weight = string_t{} 
)
inlinefinaloverridevirtual

Add a transition from src to dst.

Implements vcsn::automaton_editor.

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

template<Automaton Aut>
label_t vcsn::edit_automaton< Aut >::label_ ( string_t  l)
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_.

Here is the call graph for this function:

template<Automaton Aut>
virtual bool vcsn::edit_automaton< Aut >::open ( bool  o)
inlinefinaloverridevirtual

Whether unknown letters should be added, or rejected.

Parameters
owhether to accept
Returns
the previous status.

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().

template<Automaton Aut>
virtual void vcsn::edit_automaton< Aut >::reset ( )
inlinefinaloverridevirtual

Detach the built automaton.

Implements vcsn::automaton_editor.

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

References vcsn::edit_automaton< Aut >::res_.

template<Automaton Aut>
virtual dyn::automaton vcsn::edit_automaton< Aut >::result ( )
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_.

Here is the call graph for this function:

template<Automaton Aut>
state_t vcsn::edit_automaton< Aut >::state_ ( string_t  k)
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().

template<Automaton Aut>
weight_t vcsn::edit_automaton< Aut >::weight_ ( string_t  w)
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_.

Here is the call graph for this function:

Member Data Documentation

template<Automaton Aut>
entry_map vcsn::edit_automaton< Aut >::emap_
private

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

Referenced by vcsn::edit_automaton< Aut >::add_entry().

template<Automaton Aut>
label_map vcsn::edit_automaton< Aut >::lmap_
private

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

Referenced by vcsn::edit_automaton< Aut >::label_().

template<Automaton Aut>
polynomialset<context_t> vcsn::edit_automaton< Aut >::ps_
private

Entries handler.

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

Referenced by vcsn::edit_automaton< Aut >::add_entry().

template<Automaton Aut>
weight_map vcsn::edit_automaton< Aut >::wmap_
private

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

Referenced by vcsn::edit_automaton< Aut >::weight_().


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