Vcsn  2.2a
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<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 }
static value_t conv(b, b::value_t v)
Definition: min-plus.hh:122
std::istringstream is
The input stream: the specification to translate.
Definition: translate.cc:380
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46
VCSN_JOIN_SIMPLE(b, b)
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
weightset_mixin< detail::zmin_impl > zmin
Definition: fwd.hh:57
Print as plain (ASCII) text, escaped.
Definition: format.hh:26
weightset_mixin< detail::b_impl > b
Definition: fwd.hh:48
static value_t conv(nmin, const nmin::value_t v)
Definition: zmin.hh:44
Print as a parsable type string.
Definition: format.hh:24
Print for LaTeX.
Definition: format.hh:20
std::ostream & print_set(std::ostream &o, format fmt={}) const
Definition: zmin.hh:52
Print as is. For instance, don't try to escape labels.
Definition: format.hh:22
weightset_mixin< detail::nmin_impl > nmin
Definition: fwd.hh:51
char eat(std::istream &is, char c)
Check lookahead character and advance.
Definition: stream.cc:37
static symbol sname()
Definition: zmin.hh:23
typename super_t::value_t value_t
Definition: zmin.hh:21
Print as rich UTF-8 text, escaped.
Definition: format.hh:28
static zmin make(std::istream &is)
Build from the description in is.
Definition: zmin.hh:30
static constexpr bool has_lightening_weights()
Definition: zmin.hh:49
An input/output format for valuesets.
Definition: format.hh:11
Definition: a-star.hh:8