Vcsn  2.2
Be Rational
rmin.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/core/join.hh>
4 #include <vcsn/misc/raise.hh>
5 #include <vcsn/misc/stream.hh> // eat
6 #include <vcsn/weightset/fwd.hh>
9 
10 namespace vcsn
11 {
12  namespace detail
13  {
14  class rmin_impl
15  : public min_plus_impl<double>
16  {
17  public:
19  using self_t = rmin;
20  using value_t = typename super_t::value_t;
21 
22  static symbol sname()
23  {
24  static auto res = symbol{"rmin"};
25  return res;
26  }
27 
29  static rmin make(std::istream& is)
30  {
31  eat(is, sname());
32  return {};
33  }
34 
35  using super_t::conv;
36  static value_t
38  {
39  return v;
40  }
41 
42  static constexpr bool has_lightening_weights() { return true; }
43 
44  std::ostream&
45  print_set(std::ostream& o, format fmt = {}) const
46  {
47  switch (fmt.kind())
48  {
49  case format::latex:
50  o << "\\mathbb{R}_{\\text{min}}";
51  break;
52  case format::sname:
53  o << sname();
54  break;
55  case format::text:
56  o << "Rmin";
57  break;
58  case format::utf8:
59  o << "ℝmin";
60  break;
61  case format::raw:
62  assert(0);
63  break;
64  }
65  return o;
66  }
67  };
68 
71  }
72 
73  template <>
74  struct is_tropical<rmin> : std::true_type
75  {};
76 }
Print as rich UTF-8 text, escaped.
Definition: format.hh:28
weightset_mixin< detail::rmin_impl > rmin
Definition: fwd.hh:55
std::ostream & print_set(std::ostream &o, format fmt={}) const
Definition: rmin.hh:45
VCSN_JOIN_SIMPLE(b, b)
typename super_t::value_t value_t
Definition: rmin.hh:20
Definition: a-star.hh:8
Print for LaTeX.
Definition: format.hh:20
Print as is. For instance, don't try to escape labels.
Definition: format.hh:22
static constexpr bool has_lightening_weights()
Definition: rmin.hh:42
An input/output format for valuesets.
Definition: format.hh:11
char eat(std::istream &is, char c)
Check lookahead character and advance.
Definition: stream.cc:37
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46
static value_t conv(self_t, value_t v)
Definition: rmin.hh:37
static rmin make(std::istream &is)
Build from the description in is.
Definition: rmin.hh:29
static symbol sname()
Definition: rmin.hh:22
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
Definition: symbol.hh:23
Print as plain (ASCII) text, escaped.
Definition: format.hh:26
std::istringstream is
The input stream: the specification to translate.
Definition: translate.cc:380
Print as a parsable type string.
Definition: format.hh:24
weightset_mixin< detail::b_impl > b
Definition: fwd.hh:48
static value_t conv(b, b::value_t v)
Definition: min-plus.hh:122