Vcsn  2.3
Be Rational
zmin.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>
8 #include <vcsn/weightset/nmin.hh>
10 
11 namespace vcsn
12 {
13  namespace detail
14  {
15  class zmin_impl
16  : public min_plus_impl<zmin_impl, int>
17  {
18  public:
20  using self_t = zmin;
21  using value_t = typename super_t::value_t;
22 
23  static symbol sname()
24  {
25  static auto res = symbol{"zmin"};
26  return res;
27  }
28 
30  static zmin make(std::istream& is)
31  {
32  eat(is, sname());
33  return {};
34  }
35 
36  using super_t::conv;
37  static value_t
39  {
40  return v;
41  }
42 
43  static value_t
45  {
46  return v;
47  }
48 
49  static constexpr bool has_lightening_weights() { return true; }
50 
51  std::ostream&
52  print_set(std::ostream& o, format fmt = {}) const
53  {
54  switch (fmt.kind())
55  {
56  case format::latex:
57  o << "\\mathbb{Z}_{\\text{min}}";
58  break;
59  case format::sname:
60  o << sname();
61  break;
62  case format::text:
63  o << "Zmin";
64  break;
65  case format::utf8:
66  o << "ℤmin";
67  break;
68  case format::raw:
69  assert(0);
70  break;
71  }
72  return o;
73  }
74  };
75 
79  }
80 
81  template <>
82  struct is_tropical<zmin> : std::true_type
83  {};
84 }
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
Definition: symbol.hh:23
static value_t conv(self_t, value_t v)
Definition: zmin.hh:38
static symbol sname()
Definition: zmin.hh:23
Print as a parsable type string.
Definition: format.hh:26
return res
Definition: multiply.hh:398
static zmin make(std::istream &is)
Build from the description in is.
Definition: zmin.hh:30
weightset_mixin< detail::zmin_impl > zmin
Definition: fwd.hh:57
VCSN_JOIN_SIMPLE(b, b)
std::ostream & print_set(std::ostream &o, format fmt={}) const
Definition: zmin.hh:52
Definition: a-star.hh:8
An input/output format for valuesets.
Definition: format.hh:13
Print as is. For instance, don't try to escape labels.
Definition: format.hh:24
weightset_mixin< detail::nmin_impl > nmin
Definition: fwd.hh:51
Print as rich UTF-8 text, escaped.
Definition: format.hh:30
static value_t conv(nmin, const nmin::value_t v)
Definition: zmin.hh:44
typename super_t::value_t value_t
Definition: zmin.hh:21
weightset_mixin< detail::b_impl > b
Definition: fwd.hh:48
Print for LaTeX.
Definition: format.hh:22
static value_t conv(b, b::value_t v)
Definition: min-plus.hh:127
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46
Print as plain (ASCII) text, escaped.
Definition: format.hh:28
char eat(std::istream &is, char c)
Check lookahead character and advance.
Definition: stream.cc:90
static constexpr bool has_lightening_weights()
Definition: zmin.hh:49