Vcsn  2.8
Be Rational
read-automaton.hh
Go to the documentation of this file.
1 #pragma once
2 
4 #include <vcsn/dyn/algos.hh>
5 #include <vcsn/dyn/automaton.hh>
6 
7 namespace vcsn
8 {
9  /*------------------.
10  | read_automaton. |
11  `------------------*/
12 
20  template <Automaton Aut>
21  Aut
22  read_automaton(std::istream& is, const std::string& f = "default")
23  {
25  // Automaton typename.
26  auto vname = res->vname();
28  f, ": invalid context: ", vname,
29  ", expected: ", Aut::element_type::sname());
30  return std::move(res->as<Aut>());
31  }
32 } // namespace vcsn
A dyn automaton.
Definition: automaton.hh:17
symbol vname(T &t)
Definition: name.hh:99
automaton read_automaton(std::istream &is, const std::string &format="default", bool strip=true, const location &loc=location{})
Read an automaton from a stream.
Definition: read.cc:73
Aut read_automaton(std::istream &is, const std::string &f="default")
Static version of the read_automaton function.
Definition: a-star.hh:8
auto & as()
Extract wrapped typed automaton.
Definition: automaton.hh:37
symbol vname() const
A description of the automaton, sufficient to build it.
Definition: automaton.hh:30
symbol sname()
Definition: name.hh:65
#define VCSN_REQUIRE(Cond,...)
A macro similar to require.
Definition: raise.hh:98
return res
Definition: multiply.hh:399