17 #ifndef AWALI_CORE_RAT_COPY_HH
18 # define AWALI_CORE_RAT_COPY_HH
25 namespace awali {
namespace sttc
30 template <
typename InRatExpSet,
typename OutRatExpSet = InRatExpSet>
32 :
public InRatExpSet::const_visitor
39 using super_type =
typename in_ratexpset_t::const_visitor;
40 using node_t =
typename super_type::node_t;
41 using inner_t =
typename super_type::inner_t;
42 template <type_t Type>
44 template <type_t Type>
46 using leaf_t =
typename super_type::leaf_t;
62 template <exp::type_t Type>
64 copy_unary(
const unary_t<Type>& v)
66 using out_unary_t =
typename out_ratexpset_t::template unary_t<Type>;
67 res_ = std::make_shared<out_unary_t>(copy(v.sub()));
71 template <exp::type_t Type>
73 copy_variadic(
const variadic_t<Type>& v)
75 using out_variadic_t =
typename out_ratexpset_t::template variadic_t<Type>;
76 typename out_ratexpset_t::ratexps_t sub;
78 sub.emplace_back(copy(s));
79 res_ = std::make_shared<out_variadic_t>(sub);
89 # define DEFINE(Type) \
90 using Type ## _t = typename super_type::Type ## _t; \
91 virtual void visit(const Type ## _t& v)
106 res_ = out_rs_.one();
112 res_ = out_rs_.zero();
117 res_ = out_rs_.atom(out_rs_.labelset()->conv(*in_rs_.labelset(),
123 res_ = out_rs_.lmul(out_rs_.weightset()->conv(*in_rs_.weightset(),
130 res_ = out_rs_.rmul(copy(v.sub()),
131 out_rs_.weightset()->conv(*in_rs_.weightset(),
145 template <
typename InRatExpSet,
typename OutRatExpSet = InRatExpSet>
146 typename OutRatExpSet::value_t
147 copy(
const InRatExpSet& in_rs,
const OutRatExpSet& out_rs,
148 const typename InRatExpSet::value_t& v)
typename in_ratexpset_t::const_visitor super_type
Definition: copy.hh:39
typename super_type::node_t node_t
Definition: copy.hh:40
typename super_type::template unary_t< Type > unary_t
Definition: copy.hh:43
copier(const in_ratexpset_t &in_rs, const out_ratexpset_t &out_rs)
Definition: copy.hh:48
InRatExpSet in_ratexpset_t
Definition: copy.hh:35
OutRatExpSet out_ratexpset_t
Definition: copy.hh:36
typename super_type::template variadic_t< Type > variadic_t
Definition: copy.hh:45
typename out_ratexpset_t::value_t out_value_t
Definition: copy.hh:38
typename super_type::inner_t inner_t
Definition: copy.hh:41
out_value_t operator()(const in_value_t &v)
Entry point: print v.
Definition: copy.hh:55
typename super_type::leaf_t leaf_t
Definition: copy.hh:46
typename in_ratexpset_t::value_t in_value_t
Definition: copy.hh:37
#define DEFINE(Type)
Definition: copy.hh:89
variadic< type_t::sum, Label, Weight > sum
Definition: fwd.hh:154
weight_node< type_t::lweight, Label, Weight > lweight
Definition: fwd.hh:164
unary< type_t::star, Label, Weight > star
Definition: fwd.hh:129
constant< type_t::zero, Label, Weight > zero
Definition: fwd.hh:113
variadic< type_t::ldiv, Label, Weight > ldiv
Definition: fwd.hh:148
variadic< type_t::conjunction, Label, Weight > conjunction
Definition: fwd.hh:145
variadic< type_t::shuffle, Label, Weight > shuffle
Definition: fwd.hh:151
weight_node< type_t::rweight, Label, Weight > rweight
Definition: fwd.hh:167
OutRatExpSet::value_t copy(const InRatExpSet &in_rs, const OutRatExpSet &out_rs, const typename InRatExpSet::value_t &v)
Definition: copy.hh:147
unary< type_t::transposition, Label, Weight > transposition
Definition: fwd.hh:132
constant< type_t::one, Label, Weight > one
Definition: fwd.hh:116
unary< type_t::complement, Label, Weight > complement
Definition: fwd.hh:126
variadic< type_t::prod, Label, Weight > prod
Definition: fwd.hh:142
Main namespace of Awali.
Definition: ato.hh:22