![]() |
Awali
Another Weighted Automata library
|
#include <mutable_automaton.hh>
Data Structures | |
| struct | stored_state_t |
| Data stored for each state. More... | |
Public Types | |
| using | automaton_nocv_t = mutable_automaton< context_t > |
| The (shared pointer) type to use it we have to create an automaton of the same (underlying) type. More... | |
| using | context_t = Context |
| using | free_store_t = std::vector< state_t > |
| A list of unused indexes in the states/transitions tables. More... | |
| using | history_t = std::shared_ptr< history_base > |
| History. More... | |
| using | kind_t = typename context_t::kind_t |
| using | label_t = typename labelset_t::value_t |
| Transition label. More... | |
| using | labelset_ptr = typename context_t::labelset_ptr |
| using | labelset_t = labelset_t_of< context_t > |
| using | names_t = std::shared_ptr< string_history > |
| using | st_store_t = std::vector< stored_state_t > |
| All the automaton's states. More... | |
| using | states_output_t = indice_filter< st_store_t > |
| using | stored_transition_t = transition_tuple< state_t, label_t, weight_t > |
| Data stored per transition. More... | |
| using | tr_cont_t = std::vector< transition_t > |
| All the incoming/outgoing transition handles of a state. More... | |
| using | tr_store_t = std::vector< stored_transition_t > |
| All the automaton's transitions. More... | |
| using | transitions_output_t = indice_filter< tr_store_t > |
| using | transitions_s_output_t = cont_filter< tr_cont_t > |
| using | weight_t = typename weightset_t::value_t |
| Transition weight. More... | |
| using | weightset_ptr = typename context_t::weightset_ptr |
| using | weightset_t = weightset_t_of< context_t > |
Public Member Functions | |
| mutable_automaton_impl ()=delete | |
| mutable_automaton_impl (const context_t &ctx) | |
| mutable_automaton_impl (const mutable_automaton_impl &)=delete | |
| mutable_automaton_impl (mutable_automaton_impl &&that) | |
| weight_t | add_final (state_t s, weight_t w) |
| weight_t | add_initial (state_t s, weight_t w) |
| state_t | add_state () |
| weight_t | add_transition (state_t src, state_t dst, label_t l) |
| Same as above, with weight one. More... | |
| weight_t | add_transition (state_t src, state_t dst, label_t l, weight_t w) |
| Add a transition between two states. More... | |
| template<typename A > | |
| weight_t | add_transition_copy (state_t src, state_t dst, const A &aut, transition_t t, bool transpose=false) |
| Add a transition between two states, copying the label from the given transition. More... | |
| weight_t | add_weight (transition_t t, weight_t w) |
| const tr_cont_t & | all_in (state_t s) const |
| Indexes of all transitions arriving to state s. More... | |
| const tr_cont_t & | all_out (state_t s) const |
| Indexes of all transitions leaving state s. More... | |
| tr_cont_t & | all_out_ (state_t s) |
| states_output_t | all_states () const |
| All states including pre()/post(). More... | |
| transitions_output_t | all_transitions () const |
| All the transition indexes between all states (including pre and post). More... | |
| const context_t & | context () const |
| void | del_state (state_t s) |
| void | del_transition (state_t s, state_t d) |
| Remove all the transitions between s and d. More... | |
| transition_t | del_transition (state_t src, state_t dst, label_t l) |
| Remove the transition (src, l, dst). More... | |
| void | del_transition (transition_t t) |
| state_t | dst_of (transition_t t) const |
| transitions_s_output_t | final_transitions () const |
| Indexes of transitions from visible final states. More... | |
| const std::string & | get_desc () const |
| ATTRIBUTE_PURE weight_t | get_final_weight (state_t s) const |
| ATTRIBUTE_PURE weight_t | get_initial_weight (state_t s) const |
| const std::string & | get_name () const |
| state_t | get_state_by_name (const std::string &name) const |
| std::string | get_state_name (state_t s) const |
| transition_t | get_transition (state_t src, state_t dst, label_t l) const |
| bool | has_explicit_name (state_t s) const |
| bool | has_history (state_t s) const |
| bool | has_state (state_t s) const |
| bool | has_transition (state_t src, state_t dst, label_t l) const |
| bool | has_transition (transition_t t) const |
| history_t | history () const |
| transitions_s_output_t | in (state_t s) const |
| Indexes of visible transitions arriving to state s. More... | |
| transitions_s_output_t | in (state_t s, const label_t &l) const |
| Indexes of visible transitions arriving to state s on label l. More... | |
| transitions_s_output_t | initial_transitions () const |
| Indexes of transitions to visible initial states. More... | |
| bool | is_final (state_t s) const |
| bool | is_initial (state_t s) const |
| label_t | label_of (transition_t t) const |
| const labelset_ptr & | labelset () const |
| weight_t | lmul_weight (transition_t t, weight_t w) |
| state_t | max_state () const |
| transition_t | new_transition (state_t src, state_t dst, label_t l) |
| Same as above, with weight one. More... | |
| transition_t | new_transition (state_t src, state_t dst, label_t l, weight_t w) |
| Create a transition between two states. More... | |
| template<typename A > | |
| transition_t | new_transition_copy (state_t src, state_t dst, const A &aut, transition_t t, bool transpose=false) |
| Copy the label of a transition between two states, creating a new transition. More... | |
| size_t | num_all_states () const |
| size_t | num_finals () const |
| size_t | num_initials () const |
| size_t | num_states () const |
| size_t | num_transitions () const |
| mutable_automaton_impl & | operator= (mutable_automaton_impl &&that) |
| transitions_s_output_t | out (state_t s) const |
| Indexes of visible transitions leaving state s. More... | |
| transitions_s_output_t | out (state_t s, const label_t &l) const |
| Indexes of all transitions leaving state s on label l. More... | |
| transitions_s_output_t | outin (state_t s, state_t d) const |
| Indexes of visible transitions from state s to state d. More... | |
| label_t | prepost_label () const |
| std::ostream & | print_state (state_t s, std::ostream &o) const |
| std::ostream & | print_state_history (state_t s, std::ostream &o, const std::string &fmt="text") const |
| std::ostream & | print_state_name (state_t s, std::ostream &o, const std::string &fmt="text") const |
| weight_t | rmul_weight (transition_t t, weight_t w) |
| void | set_desc (const std::string &d) |
| void | set_final (state_t s) |
| void | set_final (state_t s, weight_t w) |
| void | set_history (history_t h) |
| void | set_initial (state_t s) |
| void | set_initial (state_t s, weight_t w) |
| bool | set_name (const std::string &n) |
| void | set_state_name (state_t s, const std::string &n) |
| void | set_state_names_from_history () |
| transition_t | set_transition (state_t src, state_t dst, label_t l) |
| Same as above, with unit weight. More... | |
| transition_t | set_transition (state_t src, state_t dst, label_t l, weight_t w) |
| Set a transition between two states. More... | |
| template<typename A > | |
| transition_t | set_transition_copy (state_t src, state_t dst, const A &aut, transition_t t, bool transpose=false) |
| weight_t | set_weight (transition_t t, weight_t w) |
| state_t | src_of (transition_t t) const |
| states_output_t | states () const |
| All states excluding pre()/post(). More... | |
| void | strip_history () |
| void | strip_names () |
| transitions_output_t | transitions () const |
| All the transition indexes between visible states. More... | |
| void | unset_final (state_t s) |
| void | unset_initial (state_t s) |
| std::string | vname (bool full=true) const |
| weight_t | weight_of (transition_t t) const |
| const weightset_ptr & | weightset () const |
Static Public Member Functions | |
| static constexpr state_t | null_state () |
| static constexpr transition_t | null_transition () |
| static constexpr state_t | post () |
| static constexpr state_t | pre () |
| static std::string | sname () |
Data Fields | |
| context_t | ctx_ |
| The algebraic type of this automaton. More... | |
Protected Member Functions | |
| void | del_transition_container (tr_cont_t &tc, bool from_succ) |
| void | del_transition_from_dst (transition_t t) |
| Remove t from the ingoing transition of the destination state. More... | |
| void | del_transition_from_src (transition_t t) |
| Remove t from the outgoing transitions of the source state. More... | |
| struct awali::sttc::internal::mutable_automaton_impl::stored_state_t |
| using awali::sttc::internal::mutable_automaton_impl< Context >::automaton_nocv_t = mutable_automaton<context_t> |
The (shared pointer) type to use it we have to create an automaton of the same (underlying) type.
| using awali::sttc::internal::mutable_automaton_impl< Context >::context_t = Context |
| using awali::sttc::internal::mutable_automaton_impl< Context >::free_store_t = std::vector<state_t> |
A list of unused indexes in the states/transitions tables.
| using awali::sttc::internal::mutable_automaton_impl< Context >::history_t = std::shared_ptr<history_base> |
History.
| using awali::sttc::internal::mutable_automaton_impl< Context >::kind_t = typename context_t::kind_t |
| using awali::sttc::internal::mutable_automaton_impl< Context >::label_t = typename labelset_t::value_t |
Transition label.
| using awali::sttc::internal::mutable_automaton_impl< Context >::labelset_ptr = typename context_t::labelset_ptr |
| using awali::sttc::internal::mutable_automaton_impl< Context >::labelset_t = labelset_t_of<context_t> |
| using awali::sttc::internal::mutable_automaton_impl< Context >::names_t = std::shared_ptr<string_history> |
| using awali::sttc::internal::mutable_automaton_impl< Context >::st_store_t = std::vector<stored_state_t> |
All the automaton's states.
| using awali::sttc::internal::mutable_automaton_impl< Context >::states_output_t = indice_filter<st_store_t> |
| using awali::sttc::internal::mutable_automaton_impl< Context >::stored_transition_t = transition_tuple<state_t, label_t, weight_t> |
Data stored per transition.
| using awali::sttc::internal::mutable_automaton_impl< Context >::tr_cont_t = std::vector<transition_t> |
All the incoming/outgoing transition handles of a state.
| using awali::sttc::internal::mutable_automaton_impl< Context >::tr_store_t = std::vector<stored_transition_t> |
All the automaton's transitions.
| using awali::sttc::internal::mutable_automaton_impl< Context >::transitions_output_t = indice_filter<tr_store_t> |
| using awali::sttc::internal::mutable_automaton_impl< Context >::transitions_s_output_t = cont_filter<tr_cont_t> |
| using awali::sttc::internal::mutable_automaton_impl< Context >::weight_t = typename weightset_t::value_t |
Transition weight.
| using awali::sttc::internal::mutable_automaton_impl< Context >::weightset_ptr = typename context_t::weightset_ptr |
| using awali::sttc::internal::mutable_automaton_impl< Context >::weightset_t = weightset_t_of<context_t> |
|
delete |
|
delete |
| awali::sttc::internal::mutable_automaton_impl< Context >::mutable_automaton_impl | ( | const context_t & | ctx | ) |
| awali::sttc::internal::mutable_automaton_impl< Context >::mutable_automaton_impl | ( | mutable_automaton_impl< Context > && | that | ) |
| weight_t awali::sttc::internal::mutable_automaton_impl< Context >::add_final | ( | state_t | s, |
| weight_t | w | ||
| ) |
| weight_t awali::sttc::internal::mutable_automaton_impl< Context >::add_initial | ( | state_t | s, |
| weight_t | w | ||
| ) |
| state_t awali::sttc::internal::mutable_automaton_impl< Context >::add_state | ( | ) |
| weight_t awali::sttc::internal::mutable_automaton_impl< Context >::add_transition | ( | state_t | src, |
| state_t | dst, | ||
| label_t | l | ||
| ) |
Same as above, with weight one.
| weight_t awali::sttc::internal::mutable_automaton_impl< Context >::add_transition | ( | state_t | src, |
| state_t | dst, | ||
| label_t | l, | ||
| weight_t | w | ||
| ) |
Add a transition between two states.
Merge with an existing one with same label.
| src | source state |
| dst | destination state |
| l | label of the transition |
| w | weight of the transition |
| weight_t awali::sttc::internal::mutable_automaton_impl< Context >::add_transition_copy | ( | state_t | src, |
| state_t | dst, | ||
| const A & | aut, | ||
| transition_t | t, | ||
| bool | transpose = false |
||
| ) |
Add a transition between two states, copying the label from the given transition.
Merge with an existing one with same label.
| src | source state |
| dst | destination state |
| aut | the automaton whose transition will be copied. |
| t | transition of aut whose label and weight are to copy |
| transpose | whether label and weight should be transposed |
| weight_t awali::sttc::internal::mutable_automaton_impl< Context >::add_weight | ( | transition_t | t, |
| weight_t | w | ||
| ) |
| const tr_cont_t& awali::sttc::internal::mutable_automaton_impl< Context >::all_in | ( | state_t | s | ) | const |
Indexes of all transitions arriving to state s.
Invalidated by del_transition() and del_state().
| const tr_cont_t& awali::sttc::internal::mutable_automaton_impl< Context >::all_out | ( | state_t | s | ) | const |
Indexes of all transitions leaving state s.
Invalidated by del_transition() and del_state().
| tr_cont_t& awali::sttc::internal::mutable_automaton_impl< Context >::all_out_ | ( | state_t | s | ) |
| states_output_t awali::sttc::internal::mutable_automaton_impl< Context >::all_states | ( | ) | const |
All states including pre()/post().
Guaranteed in increasing order.
| transitions_output_t awali::sttc::internal::mutable_automaton_impl< Context >::all_transitions | ( | ) | const |
All the transition indexes between all states (including pre and post).
| const context_t& awali::sttc::internal::mutable_automaton_impl< Context >::context | ( | ) | const |
| void awali::sttc::internal::mutable_automaton_impl< Context >::del_state | ( | state_t | s | ) |
| void awali::sttc::internal::mutable_automaton_impl< Context >::del_transition | ( | state_t | s, |
| state_t | d | ||
| ) |
Remove all the transitions between s and d.
| transition_t awali::sttc::internal::mutable_automaton_impl< Context >::del_transition | ( | state_t | src, |
| state_t | dst, | ||
| label_t | l | ||
| ) |
Remove the transition (src, l, dst).
| void awali::sttc::internal::mutable_automaton_impl< Context >::del_transition | ( | transition_t | t | ) |
|
protected |
|
protected |
Remove t from the ingoing transition of the destination state.
|
protected |
Remove t from the outgoing transitions of the source state.
| state_t awali::sttc::internal::mutable_automaton_impl< Context >::dst_of | ( | transition_t | t | ) | const |
| transitions_s_output_t awali::sttc::internal::mutable_automaton_impl< Context >::final_transitions | ( | ) | const |
Indexes of transitions from visible final states.
| const std::string& awali::sttc::internal::mutable_automaton_impl< Context >::get_desc | ( | ) | const |
| ATTRIBUTE_PURE weight_t awali::sttc::internal::mutable_automaton_impl< Context >::get_final_weight | ( | state_t | s | ) | const |
| ATTRIBUTE_PURE weight_t awali::sttc::internal::mutable_automaton_impl< Context >::get_initial_weight | ( | state_t | s | ) | const |
| const std::string& awali::sttc::internal::mutable_automaton_impl< Context >::get_name | ( | ) | const |
| state_t awali::sttc::internal::mutable_automaton_impl< Context >::get_state_by_name | ( | const std::string & | name | ) | const |
| std::string awali::sttc::internal::mutable_automaton_impl< Context >::get_state_name | ( | state_t | s | ) | const |
| transition_t awali::sttc::internal::mutable_automaton_impl< Context >::get_transition | ( | state_t | src, |
| state_t | dst, | ||
| label_t | l | ||
| ) | const |
| bool awali::sttc::internal::mutable_automaton_impl< Context >::has_explicit_name | ( | state_t | s | ) | const |
| bool awali::sttc::internal::mutable_automaton_impl< Context >::has_history | ( | state_t | s | ) | const |
| bool awali::sttc::internal::mutable_automaton_impl< Context >::has_state | ( | state_t | s | ) | const |
| bool awali::sttc::internal::mutable_automaton_impl< Context >::has_transition | ( | state_t | src, |
| state_t | dst, | ||
| label_t | l | ||
| ) | const |
| bool awali::sttc::internal::mutable_automaton_impl< Context >::has_transition | ( | transition_t | t | ) | const |
| history_t awali::sttc::internal::mutable_automaton_impl< Context >::history | ( | ) | const |
| transitions_s_output_t awali::sttc::internal::mutable_automaton_impl< Context >::in | ( | state_t | s | ) | const |
Indexes of visible transitions arriving to state s.
Invalidated by del_transition() and del_state().
| transitions_s_output_t awali::sttc::internal::mutable_automaton_impl< Context >::in | ( | state_t | s, |
| const label_t & | l | ||
| ) | const |
Indexes of visible transitions arriving to state s on label l.
Invalidated by del_transition() and del_state().
| transitions_s_output_t awali::sttc::internal::mutable_automaton_impl< Context >::initial_transitions | ( | ) | const |
Indexes of transitions to visible initial states.
| bool awali::sttc::internal::mutable_automaton_impl< Context >::is_final | ( | state_t | s | ) | const |
| bool awali::sttc::internal::mutable_automaton_impl< Context >::is_initial | ( | state_t | s | ) | const |
| label_t awali::sttc::internal::mutable_automaton_impl< Context >::label_of | ( | transition_t | t | ) | const |
| const labelset_ptr& awali::sttc::internal::mutable_automaton_impl< Context >::labelset | ( | ) | const |
| weight_t awali::sttc::internal::mutable_automaton_impl< Context >::lmul_weight | ( | transition_t | t, |
| weight_t | w | ||
| ) |
| state_t awali::sttc::internal::mutable_automaton_impl< Context >::max_state | ( | ) | const |
| transition_t awali::sttc::internal::mutable_automaton_impl< Context >::new_transition | ( | state_t | src, |
| state_t | dst, | ||
| label_t | l | ||
| ) |
Same as above, with weight one.
| transition_t awali::sttc::internal::mutable_automaton_impl< Context >::new_transition | ( | state_t | src, |
| state_t | dst, | ||
| label_t | l, | ||
| weight_t | w | ||
| ) |
Create a transition between two states.
There must not exist a previous transition with same (src, dst, l).
| src | source state |
| dst | destination state |
| l | label of the transition |
| w | weight of the transition |
| transition_t awali::sttc::internal::mutable_automaton_impl< Context >::new_transition_copy | ( | state_t | src, |
| state_t | dst, | ||
| const A & | aut, | ||
| transition_t | t, | ||
| bool | transpose = false |
||
| ) |
Copy the label of a transition between two states, creating a new transition.
There must not exist a previous transition with same (src, dst, label_of(l)).
| src | source state |
| dst | destination state |
| aut | the automaton whose transition will be copied. |
| t | transition of aut whose label and weight are to copy |
| transpose | whether label and weight should be transposed |
|
staticconstexpr |
|
staticconstexpr |
| size_t awali::sttc::internal::mutable_automaton_impl< Context >::num_all_states | ( | ) | const |
| size_t awali::sttc::internal::mutable_automaton_impl< Context >::num_finals | ( | ) | const |
| size_t awali::sttc::internal::mutable_automaton_impl< Context >::num_initials | ( | ) | const |
| size_t awali::sttc::internal::mutable_automaton_impl< Context >::num_states | ( | ) | const |
| size_t awali::sttc::internal::mutable_automaton_impl< Context >::num_transitions | ( | ) | const |
| mutable_automaton_impl& awali::sttc::internal::mutable_automaton_impl< Context >::operator= | ( | mutable_automaton_impl< Context > && | that | ) |
| transitions_s_output_t awali::sttc::internal::mutable_automaton_impl< Context >::out | ( | state_t | s | ) | const |
Indexes of visible transitions leaving state s.
Invalidated by del_transition() and del_state().
| transitions_s_output_t awali::sttc::internal::mutable_automaton_impl< Context >::out | ( | state_t | s, |
| const label_t & | l | ||
| ) | const |
Indexes of all transitions leaving state s on label l.
Invalidated by del_transition() and del_state().
| transitions_s_output_t awali::sttc::internal::mutable_automaton_impl< Context >::outin | ( | state_t | s, |
| state_t | d | ||
| ) | const |
Indexes of visible transitions from state s to state d.
Invalidated by del_transition() and del_state().
|
staticconstexpr |
|
staticconstexpr |
| label_t awali::sttc::internal::mutable_automaton_impl< Context >::prepost_label | ( | ) | const |
| std::ostream& awali::sttc::internal::mutable_automaton_impl< Context >::print_state | ( | state_t | s, |
| std::ostream & | o | ||
| ) | const |
| std::ostream& awali::sttc::internal::mutable_automaton_impl< Context >::print_state_history | ( | state_t | s, |
| std::ostream & | o, | ||
| const std::string & | fmt = "text" |
||
| ) | const |
| std::ostream& awali::sttc::internal::mutable_automaton_impl< Context >::print_state_name | ( | state_t | s, |
| std::ostream & | o, | ||
| const std::string & | fmt = "text" |
||
| ) | const |
| weight_t awali::sttc::internal::mutable_automaton_impl< Context >::rmul_weight | ( | transition_t | t, |
| weight_t | w | ||
| ) |
| void awali::sttc::internal::mutable_automaton_impl< Context >::set_desc | ( | const std::string & | d | ) |
| void awali::sttc::internal::mutable_automaton_impl< Context >::set_final | ( | state_t | s | ) |
| void awali::sttc::internal::mutable_automaton_impl< Context >::set_final | ( | state_t | s, |
| weight_t | w | ||
| ) |
| void awali::sttc::internal::mutable_automaton_impl< Context >::set_history | ( | history_t | h | ) |
| void awali::sttc::internal::mutable_automaton_impl< Context >::set_initial | ( | state_t | s | ) |
| void awali::sttc::internal::mutable_automaton_impl< Context >::set_initial | ( | state_t | s, |
| weight_t | w | ||
| ) |
| bool awali::sttc::internal::mutable_automaton_impl< Context >::set_name | ( | const std::string & | n | ) |
| void awali::sttc::internal::mutable_automaton_impl< Context >::set_state_name | ( | state_t | s, |
| const std::string & | n | ||
| ) |
| void awali::sttc::internal::mutable_automaton_impl< Context >::set_state_names_from_history | ( | ) |
| transition_t awali::sttc::internal::mutable_automaton_impl< Context >::set_transition | ( | state_t | src, |
| state_t | dst, | ||
| label_t | l | ||
| ) |
Same as above, with unit weight.
| transition_t awali::sttc::internal::mutable_automaton_impl< Context >::set_transition | ( | state_t | src, |
| state_t | dst, | ||
| label_t | l, | ||
| weight_t | w | ||
| ) |
Set a transition between two states.
Override any possible existing transition with same states and label.
| src | source state |
| dst | destination state |
| l | label of the transition |
| w | weight of the transition |
| transition_t awali::sttc::internal::mutable_automaton_impl< Context >::set_transition_copy | ( | state_t | src, |
| state_t | dst, | ||
| const A & | aut, | ||
| transition_t | t, | ||
| bool | transpose = false |
||
| ) |
| weight_t awali::sttc::internal::mutable_automaton_impl< Context >::set_weight | ( | transition_t | t, |
| weight_t | w | ||
| ) |
|
static |
| state_t awali::sttc::internal::mutable_automaton_impl< Context >::src_of | ( | transition_t | t | ) | const |
| states_output_t awali::sttc::internal::mutable_automaton_impl< Context >::states | ( | ) | const |
All states excluding pre()/post().
Guaranteed in increasing order.
| void awali::sttc::internal::mutable_automaton_impl< Context >::strip_history | ( | ) |
| void awali::sttc::internal::mutable_automaton_impl< Context >::strip_names | ( | ) |
| transitions_output_t awali::sttc::internal::mutable_automaton_impl< Context >::transitions | ( | ) | const |
All the transition indexes between visible states.
| void awali::sttc::internal::mutable_automaton_impl< Context >::unset_final | ( | state_t | s | ) |
| void awali::sttc::internal::mutable_automaton_impl< Context >::unset_initial | ( | state_t | s | ) |
| std::string awali::sttc::internal::mutable_automaton_impl< Context >::vname | ( | bool | full = true | ) | const |
| weight_t awali::sttc::internal::mutable_automaton_impl< Context >::weight_of | ( | transition_t | t | ) | const |
| const weightset_ptr& awali::sttc::internal::mutable_automaton_impl< Context >::weightset | ( | ) | const |
| context_t awali::sttc::internal::mutable_automaton_impl< Context >::ctx_ |
The algebraic type of this automaton.