Awali
Another Weighted Automata library
ratexp.hh
Go to the documentation of this file.
1 
2 // This file is part of Awali.
3 // Copyright 2016-2021 Sylvain Lombardy, Victor Marsault, Jacques Sakarovitch
4 //
5 // Awali is a free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 #ifndef DYN_CORE_RATEXP_HH
19 #define DYN_CORE_RATEXP_HH
20 
21 #include<memory>
25 
26 namespace awali {
27 namespace dyn {
28 
66 class ratexp_t : public std::shared_ptr<abstract_ratexp_t> {
67  public:
68 
72  ratexp_t() : std::shared_ptr<abstract_ratexp_t>() {}
73 
74 
82  template<class T>
83  ratexp_t(const std::shared_ptr<T>& ptr,
84  typename std::enable_if<
86  int
87  >::type = 0)
88  : std::shared_ptr<abstract_ratexp_t>(ptr)
89  {}
90 
91 
94 
95  /* Concatenation of two rational expressions. */
96  ratexp_t operator* (ratexp_t exp);
97 
100  abstract_ratexp_t& operator*() {
101  return shared_ptr<abstract_ratexp_t>::operator*();
102  }
103 
113  static ratexp_t from (std::string str, std::string weightset = "B",
114  std::string alphabet ="auto");
115 
126  static ratexp_t from_context (std::string str, context_t ctx, bool fixed_alphabet = true);
127 
137  static ratexp_t from_context(std::string str, context::labelset_description cd,
139  bool fixed_alphabet = true);
144  struct with_int_labels {
148  static ratexp_t from_range(std::string str, int l, int u,
149  std::string weightset = "B");
150 
154  static ratexp_t from(std::string str, std::string weightset = "B");
155 
159  static ratexp_t from_size(std::string str,unsigned n,
160  std::string weightset = "B");
161  };
162 
171  static ratexp_t from(std::string str, unsigned n, std::string weightset = "B");
175  static ratexp_t from(std::string str, std::vector<std::string> alphabets, std::string weightset ="B");
176  };
177 
178 };
179 
180 }} // end of namespaces awali::dyn, and awali
181 #endif
awali::dyn::ratexp_t::ratexp_t
ratexp_t()
Buils an automaton_t that is essentially a nullptr; should generally not be used.
Definition: ratexp.hh:72
awali::dyn::ratexp_t::with_tuple_labels::from
static ratexp_t from(std::string str, unsigned n, std::string weightset="B")
awali
Main namespace of Awali.
Definition: ato.hh:22
awali::dyn::abstract_ratexp_t
Abstract interface for rational expression at the dynamical layer; lists the services provided by aut...
Definition: abstract_ratexp.hh:91
awali::dyn::ratexp_t::ratexp_t
ratexp_t(const std::shared_ptr< T > &ptr, typename std::enable_if< std::is_base_of< abstract_ratexp_t, T >::value, int >::type=0)
Builds a ratexp_t from a shared pointer to a class derived of abstract_ratexp_t; should generally not...
Definition: ratexp.hh:83
awali::dyn::ratexp_t::with_tuple_labels
Definition: ratexp.hh:167
context_description.hh
awali::dyn::context::weightset
weightset_description weightset(const std::string &k)
abstract_ratexp.hh
abstract_context.hh
awali::dyn::ratexp_t::from_context
static ratexp_t from_context(std::string str, context_t ctx, bool fixed_alphabet=true)
awali::dyn::internal::alphabets
std::vector< std::vector< char > > alphabets(automaton_t tdc)
awali::priority::value
static constexpr TOP< void > value
Definition: priority.hh:93
awali::dyn::ratexp_t
Main class for representing rational expresson at the dynamical layer.
Definition: ratexp.hh:66
awali::dyn::ratexp_t::with_int_labels::from_range
static ratexp_t from_range(std::string str, int l, int u, std::string weightset="B")
awali::dyn::ratexp_t::with_int_labels::from
static ratexp_t from(std::string str, std::string weightset="B")
awali::dyn::ratexp_t::with_int_labels::from_size
static ratexp_t from_size(std::string str, unsigned n, std::string weightset="B")
awali::dyn::ratexp_t::with_int_labels
Definition: ratexp.hh:144
awali::dyn::context::weightset_description
std::shared_ptr< weightset_description_impl > weightset_description
Definition: description_types.hh:33
awali::dyn::ratexp_t::from
static ratexp_t from(std::string str, std::string weightset="B", std::string alphabet="auto")
awali::dyn::context::labelset_description
std::shared_ptr< labelset_description_impl > labelset_description
Definition: description_types.hh:32
awali::dyn::ratexp_t::operator+
ratexp_t operator+(ratexp_t exp)
Sum of two rational expressions.