Awali
Another Weighted Automata library
automaton.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_AUTOMATON_HH
18 #define DYN_AUTOMATON_HH
19 
21 
22 namespace awali { namespace dyn {
23 
24 
93  class automaton_t : public std::shared_ptr<abstract_automaton_t> {
94  public:
95 
96 
101 
109  template <class T>
111  const std::shared_ptr<T> &ptr,
112  typename std::enable_if<
114  >::type = 0
115  )
116  : std::shared_ptr<abstract_automaton_t>(ptr)
117  {}
118 
144 
145 
186 
206  static automaton_t from(std::string alphabet,
207  std::string weightset = "B",
208  bool allow_eps_transitions = false);
209 
225  static automaton_t from(std::string alphabet,
226  bool allow_eps_transitions,
227  std::string = "B");
228 
229 
234  static automaton_t from(std::string alphabet, char const* ws);
235 
258  private:
259  with_int_labels() {}
260  public:
261 
262 
274  static automaton_t from_range(int l,
275  int u,
276  std::string weightset = "B",
277  bool allow_eps_transitions = false);
278 
279 
293  static automaton_t from_range(int l, int u, bool allow_eps_transitions);
294 
295 
300  static automaton_t from_range(int l, int u, char const* ws);
301 
302 
317  static automaton_t from_size(unsigned n,
318  std::string weightset = "B",
319  bool allow_eps_transitions = false);
320 
332  static automaton_t from_size(unsigned n, bool allow_eps_transitions);
333 
338  static automaton_t from_size(unsigned n, char const* weightset);
339 
340  };
341  };
342 
343 
344 }}
345 
346 
347 #endif
An automaton_t is essentially a shared pointer to an abstract_automaton_t, but also contains static f...
Definition: automaton.hh:93
automaton_t(const std::shared_ptr< T > &ptr, typename std::enable_if< std::is_base_of< abstract_automaton_t, T >::value, int >::type=0)
Builds a automaton from a shared pointer to a class derived of abstract_automaton_t; should generally...
Definition: automaton.hh:110
automaton_t()
Buils an automaton_t that is essentially a nullptr; should generally not be used.
Dynamical wrapper for a context, that is a weightset and a labelset.
Definition: context.hh:43
static automaton_t from_range(int l, int u, bool allow_eps_transitions)
Builds an automaton with alphabet {l, l+1, ..., u}, possibly allowing epsilon transitions.
static automaton_t from(std::string alphabet, std::string weightset="B", bool allow_eps_transitions=false)
Builds an automaton with labels in given alphabet possibly allowing epsilon transitions,...
static automaton_t from_size(unsigned n, std::string weightset="B", bool allow_eps_transitions=false)
Builds an automaton with alphabet {0, 1, ..., n-1} and weightset weightset.
automaton_t(context::labelset_description ld, context::weightset_description wd)
Builds a new empty automaton whose labelset is described by ld and weightset by wd.
static automaton_t from(std::string alphabet, bool allow_eps_transitions, std::string="B")
Builds a boolean automaton over given alphabet, that possibly allows eps_transitions.
static automaton_t from_context(context_t ctx)
Builds a new automaton whose labelset and weightset are given by ctx.
static automaton_t from_size(unsigned n, bool allow_eps_transitions)
Builds a Boolean automaton with alphabet {0, 1, ..., n-1}, possibly allowing epsilon transitions.
static automaton_t from_range(int l, int u, std::string weightset="B", bool allow_eps_transitions=false)
Builds an automaton with alphabet {l, l+1, ..., u} and weightset weightset
std::shared_ptr< weightset_description_impl > weightset_description
Definition: description_types.hh:33
weightset_description weightset(const std::string &k)
std::shared_ptr< labelset_description_impl > labelset_description
Definition: description_types.hh:32
static constexpr TOP< void > value
Definition: priority.hh:93
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
Helper class that contains convenience constructor for automata with int labels.
Definition: automaton.hh:257