Vcsn  2.1
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>
9 
10 namespace vcsn
11 {
12  namespace detail
13  {
14  class zmin_impl
15  : public min_plus_impl<int>
16  {
17  public:
19  using self_t = zmin;
20  using value_t = typename super_t::value_t;
21 
22  static symbol sname()
23  {
24  static symbol res("zmin");
25  return res;
26  }
27 
29  static zmin 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  std::ostream&
43  print_set(std::ostream& o, format fmt = {}) const
44  {
45  if (fmt == format::latex)
46  o << "\\mathbb{Z}_{\\text{min}}";
47  else if (fmt == format::text)
48  o << sname();
49  else
50  raise("invalid format: ", fmt);
51  return o;
52  }
53  };
54 
57  }
58 }
weightset_mixin< detail::zmin_impl > zmin
Definition: fwd.hh:57
typename super_t::value_t value_t
Definition: zmin.hh:20
std::istringstream is
The input stream: the specification to translate.
Definition: translate.cc:372
weightset_mixin< detail::b_impl > b
Definition: fwd.hh:48
char eat(std::istream &is, char c)
Check lookahead character and advance.
Definition: stream.cc:37
static zmin make(std::istream &is)
Build from the description in is.
Definition: zmin.hh:29
static value_t conv(self_t, value_t v)
Definition: zmin.hh:37
static symbol sname()
Definition: zmin.hh:22
An input/output format.
Definition: format.hh:11
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
Definition: symbol.hh:23
static value_t conv(b, b::value_t v)
Definition: min-plus.hh:122
std::ostream & print_set(std::ostream &o, format fmt={}) const
Definition: zmin.hh:43
VCSN_JOIN_SIMPLE(b, b)