Awali
Another Weighted Automata library
enum_utils.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 AWALI_COMMON_ENUMS_UTILS_HH
18 #define AWALI_COMMON_ENUMS_UTILS_HH
19 
20 
21 #include <awali/common/enums.hh>
22 
23 #include <string>
24 
25 namespace awali {
26 
33  direction_t make_direction(std::string const& name);
34 
35 
37  std::string name_of(direction_t val);
38 
39 
46  layout_t make_layout(std::string const& name);
47 
48 
50  std::string name_of(layout_t val);
51 
52 
61  quotient_algo_t make_quotient_algo(std::string const& name);
62 
63 
67  std::string name_of(quotient_algo_t val);
68 
69 
78  exp_to_aut_algo_t make_exp_to_aut_algo(std::string const& name);
79 
80 
84  std::string name_of(exp_to_aut_algo_t val);
85 
86 
95  io_format_t make_io_format(std::string const& name);
96 
97 
99  std::string name_of(io_format_t val);
100 
101 
104 
105 
114  state_elim_order_t make_state_elim_order_t(std::string const& name);
115 
116 
120  std::string name_of(state_elim_order_t val);
121 
122  namespace internal {
123 
124 
125  int enum_of_string (const std::string& enum_name,
126  const std::string& value);
127 
128 #define GENERATE_MAKE_ENUM(enum_t) \
129  template<typename T=enum_t> \
130  auto make_enum(std::string const& str) \
131  -> typename std::enable_if<std::is_same<T,enum_t>::value,T>::type \
132  { return (enum_t) enum_of_string(#enum_t,str); }
133 
134 
143 
144 
145 #undef GENERATE_MAKE_ENUM
146 
147 
148 
149  }//end of namespace awali::internal
150 } // end of namespace awali
151 
152 #endif
#define GENERATE_MAKE_ENUM(enum_t)
Definition: enum_utils.hh:128
direction_t
Used in some algorithms in which one may considers transitions forward or backwards.
Definition: enums.hh:35
state_elim_order_t
The different strategies for choosing which state to eliminate first when transforming an automaton i...
Definition: enums.hh:107
layout_t
The different layout that we may pass to program dot to compute geometry of automata.
Definition: enums.hh:44
quotient_algo_t
The different algorithms for computing the minimal quotient.
Definition: enums.hh:64
star_status_t
The different behaviours a weightset may have with respect to the star.
Definition: enums.hh:163
minim_algo_t
The different algorithms for computing the minimal automaton.
Definition: enums.hh:55
io_format_t
The different format for input/output of automata and expressions.
Definition: enums.hh:123
exp_to_aut_algo_t
The different algorithms for transforming an expression into an automaton.
Definition: enums.hh:70
int enum_of_string(const std::string &enum_name, const std::string &value)
static constexpr TOP< void > value
Definition: priority.hh:93
Main namespace of Awali.
Definition: ato.hh:22
exp_to_aut_algo_t make_exp_to_aut_algo(std::string const &name)
Builds a exp_to_aut_algo_t from a string describing its name.
layout_t make_layout(std::string const &name)
Builds a layout_t from a string describing its name.
direction_t make_direction(std::string const &name)
Builds a direction_t from a string describing its name.
quotient_algo_t make_quotient_algo(std::string const &name)
Builds a quotient_algo_t from a string describing its name.
io_format_t make_io_format(std::string const &name)
Builds a io_format_t from a string describing its name.
std::string name_of(direction_t val)
Return the canonical string reprensation of given direction_t.
std::string default_extension_of(io_format_t val)
Return the default extension of a file written in given format.
state_elim_order_t make_state_elim_order_t(std::string const &name)
Builds a state_elim_order_t from a string describing its name.