Awali
Another Weighted Automata library
context.hh
Go to the documentation of this file.
1 // This file is part of Awali.
2 // Copyright 2016-2022 Sylvain Lombardy, Victor Marsault, Jacques Sakarovitch
3 //
4 // Awali is a free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef DYN_MODULES_CONTEXT_HH
18 #define DYN_MODULES_CONTEXT_HH
19 
20 #include<string>
21 
24 #include <awali/dyn/core/ratexp.hh>
25 // #include <awali/dyn/core/automaton.hh>
29 
30 namespace awali {
31  namespace dyn {
32 
33  struct abstract_automaton_t;
34  class automaton_t;
35 
36  namespace internal {
37 
38 
39  /* Renames the states of `dst` that have an origin in `orig` based on
40  * their name in `orig`
41  *
42  * This is very unsafe: no verification is done.
43  * - `dst` is indeed the origin of dst
44  * - the history kind of `dst` is indeed single
45  * */
47 
49 
53 
57 
58 // automaton_t make_automaton(std::string alphabet,
59 // std::string semiring ="B");
60 // automaton_t make_automaton_with_eps(std::string alphabet,
61 // std::string semiring ="B");
62 
63 // automaton_t make_int_automaton(int a, int b, std::string semiring);
64 // automaton_t make_int_automaton(int n, std::string semiring);
65 // automaton_t make_int_automaton_with_eps(int a, int b,
66 // std::string semiring);
67 // automaton_t make_int_automaton_with_eps(int n, std::string semiring);
68 //
69 
70  automaton_t parse_automaton(std::istream& i);
71 
73 
75 
76  ratexp_t make_ratexp_with_context(const std::string& exp,
77  context_t ctx,
78  bool fixed_alphabet=true);
79 
80  ratexp_t make_ratexp_with_context(std::string const& exp,
82  bool fixed_alphabet);
83 
84  ratexp_t make_ratexp_with_context(const std::string& exp,
87  bool fixed_alphabet=true);
88 
89  ratexp_t make_ratexp_with_alphabet(const std::string& exp,
90  const std::string& alph,
91  const std::string& sr = "B",
92  bool fixed_alphabet=true);
93 
94  ratexp_t make_ratexp(const std::string& exp,
95  const std::string& sr = "B");
96 //
97 // ratexp_t make_int_ratexp_with_range(const std::string& exp,
98 // int a, int b,
99 // const std::string& sr ="B",
100 // bool fixed_alphabet=true) ;
101 // ratexp_t make_int_ratexp(const std::string& exp,
102 // const std::string& sr = "B");
103 //
104 // ratexp_t make_ratexp_with_alphabets(const std::string& exp,
105 // std::vector<std::string> alphabets,
106 // std::string semiring = "B",
107 // bool fixed_alphabet=true);
108 // ratexp_t make_tuple_ratexp(const std::string& exp,
109 // unsigned n,
110 // std::string semiring = "B");
111 
112  std::vector<state_t> states(abstract_automaton_t const* aut, bool all);
113  std::vector<transition_t> transitions(abstract_automaton_t const* aut, bool all);
114  std::vector<transition_t> outgoing(abstract_automaton_t const* aut, state_t s , bool all);
115  std::vector<transition_t> incoming(abstract_automaton_t const* aut, state_t s , bool all);
116 
117 
118  } // end of namespace awali::dyn::internal
119 
120  ratexp_t parse_ratexp(std::istream& i);
121 
122 
123  namespace internal {
125  }
126  } //end f namespace awali::dyn
127 }//end of ns awali
128 
129 #endif
An automaton_t is essentially a shared pointer to an abstract_automaton_t, but also contains static f...
Definition: automaton.hh:93
Dynamical wrapper for a context, that is a weightset and a labelset.
Definition: context.hh:43
Main class for representing rational expresson at the dynamical layer.
Definition: ratexp.hh:66
std::shared_ptr< weightset_description_impl > weightset_description
Definition: description_types.hh:33
std::shared_ptr< labelset_description_impl > labelset_description
Definition: description_types.hh:32
std::shared_ptr< context_description_impl > context_description
Definition: description_types.hh:31
std::vector< transition_t > incoming(abstract_automaton_t const *aut, state_t s, bool all)
automaton_t make_automaton_from_context(context_t ctx)
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)
context_t make_context(context::context_description cd)
ratexp_t make_ratexp(const std::string &exp, const std::string &sr="B")
ratexp_t parse_ratexp(json_ast_t obj)
ratexp_t make_ratexp_with_alphabet(const std::string &exp, const std::string &alph, const std::string &sr="B", bool fixed_alphabet=true)
void rename_from_origin_inplace(automaton_t dst, automaton_t orig)
automaton_t parse_automaton(std::istream &i)
ratexp_t make_ratexp_with_context(const std::string &exp, context_t ctx, bool fixed_alphabet=true)
automaton_t deprecated_parse_automaton(std::istream &i)
std::vector< state_t > states(abstract_automaton_t const *aut, bool all)
unsigned state_t
Type representing automata states; currently simply identifiers of type unsigned, but this might chan...
Definition: typedefs.hh:28
ratexp_t parse_ratexp(json_ast_t ast)
Main namespace of Awali.
Definition: ato.hh:22
std::shared_ptr< json::object_t > json_ast_t
Definition: json_ast.hh:27
Abstract interface listing the services provided by automata at the dynamical layer.
Definition: abstract_automaton.hh:68