17 #ifndef DYN_ABSTRACT_AUTOMATON_HH
18 #define DYN_ABSTRACT_AUTOMATON_HH
37 namespace awali {
namespace dyn {
93 virtual const std::string&
get_name()
const = 0;
98 virtual const std::string&
get_desc()
const = 0;
112 virtual void set_name(
const std::string& name) = 0;
120 virtual void set_desc(
const std::string& desc) = 0;
Dynamical wrapper for a context, that is a weightset and a labelset.
Definition: context.hh:43
An options_t is a set of optional parameters that is passed on to called functions.
Definition: options.hh:86
internal::option_t< bool > PREPOST_PARADIGM
Option used to specify whether to consider initial/final status of states as normal transitions.
history_kind_t
The different kinds of history.
Definition: enums.hh:178
std::vector< transition_t > incoming(abstract_automaton_t const *aut, state_t s, bool all)
std::vector< transition_t > outgoing(abstract_automaton_t const *aut, state_t s, bool all)
std::vector< transition_t > transitions(abstract_automaton_t const *aut, bool all)
std::vector< state_t > states(abstract_automaton_t const *aut, bool all)
unsigned transition_t
Type representing automata transitions; currently simply identifiers of type unsigned,...
Definition: typedefs.hh:33
unsigned state_t
Type representing automata states; currently simply identifiers of type unsigned, but this might chan...
Definition: typedefs.hh:28
Main namespace of Awali.
Definition: ato.hh:22
Abstract interface listing the services provided by automata at the dynamical layer.
Definition: abstract_automaton.hh:68
virtual state_t post() const =0
Returns the postfinal state.
virtual bool has_explicit_name(state_t s) const =0
Returns true if state s has a name set.
virtual const std::string & get_desc() const =0
Return the description of this abstract_automaton_t.
virtual weight_t weight_of(transition_t t) const =0
Returns the weight of transition t.
virtual void del_state(state_t s)=0
Deletes state s from this abstract_automaton_t.
virtual transition_t del_transition(state_t src, state_t dst, label_t label)=0
Deletes the transition labelled by label and going from state src to state dst.
virtual bool is_eps_transition(transition_t t) const =0
Returns true if transition t is an epsilon-transition.
virtual weight_t add_eps_transition(state_t src, state_t dst)=0
Adds an epsilon transition going from src to dst.
virtual state_t src_of(transition_t t) const =0
Returns the source state of transition t.
virtual void del_transition(transition_t tr)=0
Deletes transition tr.
virtual context_t get_context() const =0
Gets the context of this abstract_automaton_t.
virtual transition_t get_transition(state_t src, state_t dst, label_t label) const =0
Gets the transition identifier going from state src to state dst and labelled by label.
virtual weight_t add_initial(state_t s, weight_t w)=0
Adds some initial weight of state s to w (useful only for weighted automata).
virtual transition_t set_transition(state_t src, state_t dst, label_t label)=0
Sets a transition going from src to dst and labelled by label.
std::vector< state_t > states(options_t opts={}) const
Returns the states of this abstract_automaton_t.
Definition: abstract_automaton.hh:409
virtual void set_final(state_t s, weight_t w)=0
Sets final weight of state s to w (useful only for weightset automata).
virtual std::vector< state_t > initial_states() const =0
Returns the initial states of this abstract_automaton_t.
virtual std::vector< state_t > predecessors(state_t s) const =0
Returns the sources of all transitions coming in state s.
virtual void unset_final(state_t s)=0
Sets state s as non-final.
virtual weight_t add_eps_transition(state_t src, state_t dst, weight_t weight)=0
Adds an epsilon transition going from src to dst and weighted by weight.
virtual void set_state_name(state_t s, std::string name)=0
Sets to name the name of s.
virtual state_t null_state() const =0
Returns the phony state, used for instance when no state is found.
virtual state_t origin_of(state_t s) const =0
[experimental] Gives the the origin of state s, in the case where it comes from a single state.
std::vector< transition_t > in(state_t s, options_t opts={}) const
Alias to incoming.
Definition: abstract_automaton.hh:458
virtual void strip_history()=0
Deletes all state history.
virtual std::vector< transition_t > outgoing(state_t s, label_t label) const =0
Returns the transitions going out of state s and labelled by label.
virtual transition_t set_eps_transition(state_t src, state_t dst)=0
Sets an epsilon transition going from src to dst.
virtual void del_transition(state_t src, state_t dst)=0
Deletes all transitions going from state src to state dst.
virtual std::vector< state_t > final_states() const =0
Returns the final states of this abstract_automaton_t.
virtual bool is_int_automaton() const =0
Returns true if the labelset of this abstract_automaton_t is Z.
virtual bool has_transition(state_t src, state_t dst, label_t label) const =0
Returns true if there is a transition going from state src to state dst and labelled by label.
virtual void set_initial(state_t s, weight_t w)=0
Sets initial weight of state s to w (useful only for weightset automata).
virtual state_t get_state_by_name(std::string name) const =0
Gets one of the state with given name.
virtual bool are_words_allowed() const =0
Returns true if words are allowed as labels.
virtual transition_t set_eps_transition(state_t src, state_t dst, weight_t weight)=0
Sets an epsilon transition going from src to dst and weighted by weight.
virtual weight_t add_transition(state_t src, state_t dst, label_t label, weight_t weight)=0
Adds a transition going from src to dst, labelled by label and with weight weight; or adds weight to ...
virtual state_t dst_of(transition_t t) const =0
Returns the destination state of transition t.
virtual void set_state_names_from_history()=0
[experimental] Sets the name of each state based on its history.
virtual size_t num_transitions() const =0
Returns the number of transitions in this abstract_automaton_t.
virtual weight_t get_initial_weight(state_t s) const =0
Gets the initial weight of s.
virtual bool is_final(state_t s) const =0
Returns true if given state s is final in this abstract_automaton_t.
virtual std::vector< state_t > predecessors(state_t s, label_t label) const =0
Returns the sources of all transitions labelled by label that are coming in state s.
virtual void del_eps_transition(state_t src, state_t dst)=0
Deletes the epsilon transition going from state src to state dst.
std::vector< transition_t > out(state_t s, label_t label) const
Alias to outgoing(state_t, label_t)const.
Definition: abstract_automaton.hh:454
virtual size_t num_states() const =0
Returns the number of states in this abstract_automaton_t.
virtual void set_initial(state_t s)=0
Sets state s as initial.
std::vector< transition_t > outgoing(state_t s, options_t opts={}) const
Returns the transitions going out ofstate s.
Definition: abstract_automaton.hh:587
virtual void unset_initial(state_t s)=0
Sets state s as non-initial.
virtual size_t num_initials() const =0
Returns the number of initial states in this abstract_automaton_t.
virtual ~abstract_automaton_t()
Definition: abstract_automaton.hh:595
virtual size_t num_finals() const =0
Returns the number of final states in this abstract_automaton_t.
virtual bool has_state(state_t s) const =0
Returns true if this abstract_automaton_t contains state s.
virtual weight_t add_transition(state_t src, state_t dst, label_t label)=0
Adds a transition going from src to dst, labelled by label.
virtual std::vector< transition_t > incoming(state_t s, label_t label) const =0
Returns the transitions coming in state s and labelled by label.
virtual weight_t lmul_weight(transition_t tr, weight_t w)=0
Multiplies by w on the left the weight of transition tr.
virtual label_t label_of(transition_t t, unsigned i) const =0
Returns the label of the i-th tape on the transition t (transducers only).
virtual bool is_transducer() const =0
Returns true if this abstract_automaton_t has multiple tapes.
virtual bool is_initial(state_t s) const =0
Returns true if given state s is initial in this abstract_automaton_t.
virtual weight_t add_weight(transition_t tr, weight_t w)=0
Adds w to the weight of transition tr.
virtual history_kind_t history_kind() const =0
[experimental] Gives the kind of data this abstract_automaton_t comes from.
virtual weight_t add_final(state_t s, weight_t w)=0
Adds some final weight of state s to w (useful only for weighted automata).
virtual weight_t get_final_weight(state_t s) const =0
Gets the final weight of s.
virtual state_t add_state()=0
Adds a new isolated states.
virtual state_t add_state(std::string name)=0
Adds a new isolated states with a custom name.
virtual std::vector< transition_t > in(state_t s, label_t label) const
Alias to incoming(state_t,label_t)const.
Definition: abstract_automaton.hh:463
virtual std::vector< transition_t > outin(state_t src, state_t dst) const =0
Returns all transitions going from src to dst.
std::vector< transition_t > transitions(options_t opts={}) const
Returns the transitions in this abstract_automaton_t.
Definition: abstract_automaton.hh:422
virtual std::list< label_t > labels_of(transition_t t) const =0
Returns the label of all tapes on the transition t (transducers only).
virtual void set_final(state_t s)=0
Sets state s as final.
virtual weight_t rmul_weight(transition_t tr, weight_t we)=0
Multiplies by w on the right the weight of transition tr.
virtual transition_t set_transition(state_t src, state_t dst, label_t label, weight_t weight)=0
Sets (and possibly replaces) a transition going from src to dst, labelled by label and with weight we...
std::vector< transition_t > out(state_t s, options_t opts={}) const
Alias to outgoing.
Definition: abstract_automaton.hh:450
virtual transition_t null_transition() const =0
Returns the phony transition_t, used for instance when transition is found.
virtual bool has_transition(transition_t t) const =0
Returns true if a transition with identifier t exists in this abstract_automaton_t.
virtual bool is_eps_allowed() const =0
Returns true if epsilon transitions are allowed.
virtual label_t label_of(transition_t t) const =0
Returns the label of transition t.
virtual std::vector< state_t > successors(state_t s) const =0
Returns the destinations of all transitions going out of s.
virtual const std::string & get_name() const =0
Return the name of this abstract_automaton_t.
std::vector< transition_t > incoming(state_t s, options_t opts={}) const
Returns the transitions coming in state s.
Definition: abstract_automaton.hh:570
virtual state_t pre() const =0
Returns the preinitial state.
virtual weight_t set_weight(transition_t tr, weight_t w)=0
Sets to w the weight of transition tr.
virtual std::vector< state_t > successors(state_t s, label_t label) const =0
Returns the destinations of all transitions labelled by label going out of s.
virtual std::vector< state_t > origins_of(state_t s) const =0
[experimental] Gives the origin of state s, in the case where it comes from a tuple of states.
virtual std::vector< label_t > alphabet() const =0
Return the alphabet of this abstract_automaton_t.
virtual std::string get_state_name(state_t s) const =0
Gets the name of state s.
virtual void set_name(const std::string &name)=0
Sets the name of this abstract_automaton_t.
virtual void set_desc(const std::string &desc)=0
Sets the description of this abstract_automaton_t.
Structure used to erase the type of labels/weights at the dyn layer.
Definition: any.hh:59