Vcsn  2.0
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
rmin.hh
Go to the documentation of this file.
1 #ifndef VCSN_WEIGHTSET_RMIN_HH
2 # define VCSN_WEIGHTSET_RMIN_HH
3 
4 # include <vcsn/core/join.hh>
5 # include <vcsn/misc/raise.hh>
6 # include <vcsn/misc/stream.hh> // eat
7 # include <vcsn/weightset/fwd.hh>
10 
11 namespace vcsn
12 {
13  namespace detail
14  {
15  class rmin_impl
16  : public min_plus_impl<int>
17  {
18  public:
20  using self_type = rmin;
21  using value_t = typename super_t::value_t;
22 
23  static std::string sname()
24  {
25  return "rmin";
26  }
27 
28  std::string vname(bool = true) const
29  {
30  return sname();
31  }
32 
34  static rmin make(std::istream& is)
35  {
36  eat(is, sname());
37  return {};
38  }
39 
40  using super_t::conv;
41  static value_t
43  {
44  return v;
45  }
46 
47  std::ostream&
48  print_set(std::ostream& o, symbol format = symbol{"text"}) const
49  {
50  if (format == "latex")
51  o << "\\mathbb{R}_{\\text{min}}";
52  else if (format == "text")
53  o << vname();
54  else
55  raise("invalid format: ", format);
56  return o;
57  }
58  };
59 
60  VCSN_JOIN_SIMPLE(b, rmin);
61  VCSN_JOIN_SIMPLE(rmin, rmin);
62  }
63 }
64 
65 #endif // !VCSN_WEIGHTSET_RMIN_HH
std::ostream & print_set(std::ostream &o, symbol format=symbol{"text"}) const
Definition: rmin.hh:48
static std::string sname()
Definition: rmin.hh:23
boost::flyweight< std::string, boost::flyweights::no_tracking > symbol
An internalized string.
Definition: symbol.hh:24
variadic_mul_mixin< detail::b_impl > b
Definition: fwd.hh:38
static value_t conv(self_type, value_t v)
Definition: rmin.hh:42
std::istringstream is
The input stream: the specification to translate.
Definition: translate.cc:329
std::string vname(bool=true) const
Definition: rmin.hh:28
typename super_t::value_t value_t
Definition: rmin.hh:21
VCSN_JOIN_SIMPLE(b, b)
static value_t conv(b, b::value_t v)
Definition: min-plus.hh:120
char eat(std::istream &is, char c)
Check lookahead character and advance.
Definition: stream.cc:37
static rmin make(std::istream &is)
Build from the description in is.
Definition: rmin.hh:34